/* ─────────────────────────────────────────────────────
   phaniputtabakula.com
   Layout: sticky sidebar + scrollable content
   Fonts: Instrument Serif (display) + Lora (body)
   ───────────────────────────────────────────────────── */

/* ─── Tokens ──────────────────────────────────────────────── */

:root {
  --bg:        #ffffff;
  --surface:   #f5f5f3;
  --border:    #e5e3de;
  --text:      #111111;
  --muted:     #555550;
  --faint:     #aaa9a4;
  --accent:    #8a6030;
  --accent-bg: rgba(138, 96, 48, 0.07);

  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --body:  'Lora', Georgia, 'Times New Roman', serif;
  --sans:  -apple-system, system-ui, sans-serif;
  --mono:  'SF Mono', 'Cascadia Code', 'Fira Code', ui-monospace, monospace;

  --sidebar-w: 240px;
  --ease:      cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0c0b0a;
    --surface:   #141210;
    --border:    #242018;
    --text:      #ede8e1;
    --muted:     #7d7872;
    --faint:     #4c4840;
    --accent:    #c8a96e;
    --accent-bg: rgba(200, 169, 110, 0.08);
  }
}

/* ─── Reset ───────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ─── Site Shell ──────────────────────────────────────────── */

.site {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ─── Sidebar ─────────────────────────────────────────────── */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 2.5rem 1.5rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-top { flex: 1; }

.sidebar-avatar {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.sidebar-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.sidebar-name {
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
  display: block;
  transition: color 0.2s;
}
.sidebar-name:hover { color: var(--accent); }

.sidebar-tagline {
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 0.5rem;
}

.sidebar-bio {
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--muted);
  margin-top: 1.25rem;
}
.sidebar-bio a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 2px;
  transition: color 0.2s;
}
.sidebar-bio a:hover { color: var(--accent); }

.sidebar-location {
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--faint);
  margin-top: 0.625rem;
}

/* Sidebar Nav */

.sidebar-nav {
  display: flex;
  flex-direction: column;
  margin-top: 2rem;
}

.sidebar-nav-link {
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--muted);
  padding: 0.3125rem 0;
  display: block;
  transition: color 0.2s;
}
.sidebar-nav-link:hover,
.sidebar-nav-link.active { color: var(--text); }

.sidebar-nav-link.ext::after {
  content: '\202f↗';
  font-size: 0.7em;
  opacity: 0.5;
  vertical-align: 0.12em;
}

/* Connect */

.sidebar-connect {
  border-top: 1px solid var(--border);
  padding-top: 1.375rem;
  margin-top: 2rem;
}

.sidebar-connect-label {
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.625rem;
}

.sidebar-connect-link {
  display: block;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--muted);
  padding: 0.25rem 0;
  transition: color 0.2s;
}
.sidebar-connect-link:hover { color: var(--text); }

/* Sidebar copyright */

.sidebar-foot {
  font-family: var(--sans);
  font-size: 0.6875rem;
  color: var(--faint);
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* ─── Content ─────────────────────────────────────────────── */

.content {
  padding: 3rem clamp(2rem, 5vw, 3.5rem);
  max-width: 720px;
}

/* ─── Section ─────────────────────────────────────────────── */

.section {
  padding: clamp(2rem, 5vh, 3rem) 0;
  border-top: 1px solid var(--border);
}
.section:first-child { border-top: none; }

.section-label {
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 1.5rem;
}

/* ─── Building ────────────────────────────────────────────── */

.building-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.bld-name {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.4rem;
  transition: color 0.2s;
}
.bld-arr {
  font-size: 0.75em;
  color: var(--faint);
  transition: transform 0.2s var(--ease), color 0.2s;
}
a.bld-name:hover { color: var(--accent); }
a.bld-name:hover .bld-arr { transform: translate(2px, -2px); color: var(--accent); }

.bld-desc {
  font-size: 0.9375rem;
  line-height: 1.72;
  color: var(--muted);
}

/* ─── Writing list ────────────────────────────────────────── */

.writing-list { list-style: none; }

.wl-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
}
.wl-item:first-child { border-top: 1px solid var(--border); }

.wl-title {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.45;
  transition: color 0.2s;
}
a.wl-item:hover .wl-title { color: var(--accent); }

.wl-date {
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--faint);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.more-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 1.25rem;
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--muted);
  transition: color 0.2s;
}
.more-link:hover { color: var(--text); }

/* ─── Page header ─────────────────────────────────────────── */

.page-header {
  padding-bottom: clamp(1.5rem, 4vh, 2.5rem);
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 4vw, 2.375rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.page-desc {
  font-size: 1rem;
  color: var(--muted);
}

/* ─── Archive ─────────────────────────────────────────────── */

.archive { list-style: none; padding: 0; }

.empty-state {
  padding: 3rem 0;
  font-size: 0.9375rem;
  color: var(--faint);
}

/* ─── Single post ─────────────────────────────────────────── */

.post-header {
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.post-title {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 4vw, 2.375rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.875rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.post-meta span::before {
  content: '·';
  margin-right: 1.25rem;
}

/* ─── Prose ───────────────────────────────────────────────── */

.prose {
  padding: 2.5rem 0;
  font-size: 1.0625rem;
  line-height: 1.82;
  color: var(--text);
}

.prose > * + * { margin-top: 1.375rem; }

.prose h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: -0.018em;
  line-height: 1.22;
  margin-top: 3rem;
  margin-bottom: 0.875rem;
}

.prose h3 {
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

.prose h4 {
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 500;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.prose a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.2s, text-decoration-color 0.2s;
}
.prose a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.prose strong { font-weight: 500; }
.prose em { font-style: italic; }

.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { color: var(--muted); margin-bottom: 0.375rem; }
.prose li strong { color: var(--text); }

.prose blockquote {
  border-left: 2px solid var(--accent);
  padding: 0.125rem 0 0.125rem 1.25rem;
  color: var(--muted);
  font-style: italic;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.75rem 0;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.38em;
}

.prose pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.875rem 0;
}
.prose pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.65;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin: 1.875rem 0;
}
.prose th, .prose td {
  text-align: left;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border);
}
.prose th {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: 0.03em;
}
.prose td { color: var(--muted); }

/* ─── Post navigation ─────────────────────────────────────── */

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
}

.pn-link { display: flex; flex-direction: column; gap: 0.3rem; }
.pn-link.pn-next { align-items: flex-end; text-align: right; }

.pn-dir {
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.pn-title {
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.4;
  transition: color 0.2s;
}
.pn-link:hover .pn-title { color: var(--text); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding-top: 2.5rem;
  padding-bottom: 1.5rem;
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--faint);
  border-top: 1px solid var(--border);
  transition: color 0.2s;
}
.back-link:hover { color: var(--muted); }

/* ─── Animations ──────────────────────────────────────────── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ani { animation: fadeUp 0.45s var(--ease) both; }
.d0  { animation-delay: 0s; }
.d1  { animation-delay: 0.07s; }
.d2  { animation-delay: 0.14s; }
.d3  { animation-delay: 0.21s; }
.d4  { animation-delay: 0.28s; }

/* ─── Mobile ──────────────────────────────────────────────── */

@media (max-width: 720px) {
  .site {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 1.25rem;
  }

  .sidebar-bio,
  .sidebar-foot { display: none; }

  .content { padding: 2rem 1.25rem; }

  .post-nav { grid-template-columns: 1fr; }
  .pn-link.pn-next { align-items: flex-start; text-align: left; }

  .wl-item { flex-direction: column; gap: 0.2rem; }
}

/* ─── Selection & Scrollbar ───────────────────────────────── */

::selection { background: var(--accent-bg); color: var(--text); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }
