/* ============================================================
   THEME TOKENS — exact palette & typography from medhavenkatapathy.com
   ============================================================ */
:root {
  /* Base */
  --bg: #fdfcfa;
  --bg-alt: #f7f5f2;
  --fg: #1a1a1a;
  --ink: #1a1a1a;
  --body: #4a4744;
  --muted: #6b6860;
  --border: #e8e5e0;
  --border-dark: #d0cdc8;
  --line: #e8e5e0;

  /* Three-color accent system */
  --rose: #c45d5d;
  --rose-soft: #f5e8e8;
  --rose-muted: #d4a5a5;

  --sage: #5d8a6b;
  --sage-soft: #e8f0ea;
  --sage-muted: #a5c4ad;

  --gold: #b8860b;
  --gold-soft: #f5f0e0;
  --gold-muted: #d4c4a0;

  --ml: var(--rose);
  --phys: var(--sage);
  --sys: var(--gold);

  --link: #8a8580;
  --toggle-a: #b8860b;
  --toggle-b: #e6d49a;
  --petal: #1a1a1a;
  --card: #f7f5f2;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --max-width: 900px;
  --radius: 12px;
  --radius-sm: 6px;
}

html[data-theme="dark"] {
  --bg: #1a1a1f;
  --bg-alt: #232328;
  --fg: #e8e5e0;
  --ink: #e8e5e0;
  --body: #b0aca5;
  --muted: #a09a90;
  --border: #333338;
  --border-dark: #444448;
  --line: #333338;

  --rose: #e07070;
  --rose-soft: #3a2525;
  --rose-muted: #8a5555;

  --sage: #7ab08a;
  --sage-soft: #253028;
  --sage-muted: #5a8a65;

  --gold: #d4a020;
  --gold-soft: #302a18;
  --gold-muted: #8a7a40;

  --ml: var(--rose);
  --phys: var(--sage);
  --sys: var(--gold);

  --link: #5a545e;
  --toggle-a: #4a464e;
  --toggle-b: #6b6570;
  --petal: #e8e5e0;
  --card: #232328;
}

/* ============================================================
   BASE & GRAIN OVERLAY
   ============================================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  position: relative;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

::selection {
  background: var(--rose-soft);
  color: var(--fg);
}

::-moz-selection {
  background: var(--rose-soft);
  color: var(--fg);
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--rose);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Subtle grain texture overlay */
.grain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.03;
  z-index: 1000;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .grain {
  opacity: 0.015;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Constellation Canvas */
#stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
}

nav, main, footer {
  position: relative;
  z-index: 1;
}

/* ============================================================
   NAVIGATION
   ============================================================ */
nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-inner {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
}

.nav-name {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: color 0.2s ease;
}

.nav-name:hover {
  color: var(--rose);
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
  transition: color 0.2s ease;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--rose), var(--gold));
  border-radius: 1px;
  transition: width 0.3s ease;
}

.nav-links a:hover {
  color: var(--fg);
}

.nav-links a:hover::after,
.nav-links a.nav-active::after {
  width: 100%;
}

.nav-links a.nav-active {
  color: var(--fg);
}

/* Theme Toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--muted);
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--gold-muted);
  color: var(--gold);
  transform: rotate(20deg);
}

:root:not([data-theme="dark"]) .theme-toggle {
  font-weight: 900;
  border-color: var(--gold-muted);
  color: var(--gold);
}

/* ============================================================
   HERO & FLOATING AURA BLOBS
   ============================================================ */
@keyframes blob-drift {
  0%   { transform: translate(0px,   0px)   scale(1);    }
  25%  { transform: translate(18px, -22px)  scale(1.04); }
  50%  { transform: translate(-12px, 14px)  scale(0.97); }
  75%  { transform: translate(10px,  20px)  scale(1.03); }
  100% { transform: translate(0px,   0px)   scale(1);    }
}

@keyframes blob-drift-2 {
  0%   { transform: translate(0px,  0px)  scale(1);    }
  33%  { transform: translate(-20px, 12px) scale(1.05); }
  66%  { transform: translate(14px, -18px) scale(0.96); }
  100% { transform: translate(0px,  0px)  scale(1);    }
}

.hero {
  position: relative;
  padding: 4rem 0 5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.22;
  transition: opacity 0.4s ease;
}

.hero-blob-rose {
  width: 340px;
  height: 280px;
  background: radial-gradient(circle, var(--rose) 0%, transparent 70%);
  top: -60px;
  right: -40px;
  animation: blob-drift 9s ease-in-out infinite;
}

.hero-blob-gold {
  width: 260px;
  height: 220px;
  background: radial-gradient(circle, var(--gold) 0%, transparent 70%);
  bottom: -20px;
  left: -30px;
  animation: blob-drift-2 11s ease-in-out infinite;
}

html[data-theme="dark"] .hero-blob-rose {
  opacity: 0.32;
}

html[data-theme="dark"] .hero-blob-gold {
  opacity: 0.22;
}

.hero-text {
  flex: 1;
  position: relative;
  z-index: 1;
}

.hero-photo, .portrait {
  flex: 0 0 auto;
  width: 160px;
  height: 160px;
  overflow: hidden;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.portrait img,
.portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% 28%;
  display: block;
}

.ph {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sage);
  background: var(--sage-soft);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  margin-bottom: 1.2rem;
}

.hero h1 {
  font-family: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1.2rem;
  background: linear-gradient(135deg, var(--fg) 0%, #4a4a4a 50%, var(--fg) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

html[data-theme="dark"] .hero h1 {
  background: linear-gradient(135deg, var(--fg) 0%, #b0aca5 50%, var(--fg) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .intro {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 560px;
  line-height: 1.7;
  margin-bottom: 1rem;
}

.hero-tags {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1.2rem;
}

.tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  text-transform: lowercase;
}

.tag-rose {
  background: var(--rose-soft);
  color: var(--rose);
}

.tag-sage {
  background: var(--sage-soft);
  color: var(--sage);
}

.tag-gold {
  background: var(--gold-soft);
  color: var(--gold);
}

/* ============================================================
   SECTIONS & RESEARCH / PROJECTS
   ============================================================ */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

.section {
  padding: 2.5rem 0;
}

.research-section {
  position: relative;
  padding: 2.5rem 0;
}

.section h2 {
  font-family: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--fg);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.section-icon {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  opacity: 0.5;
}

/* Editorial Project Index */
.project-list {
  border-top: 1px solid var(--border-dark);
}

.project-row {
  position: relative;
  display: grid;
  grid-template-columns: 2.5rem minmax(12rem, 0.85fr) minmax(16rem, 1.15fr) 1rem;
  gap: 1rem;
  align-items: start;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
  transition: padding 0.2s ease, background 0.2s ease;
}

.project-row::before {
  content: '';
  position: absolute;
  inset: 0 -0.75rem;
  z-index: -1;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.project-row-link:hover::before {
  opacity: 1;
}

.project-number {
  padding-top: 0.16rem;
  color: var(--muted);
  font-family: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.55;
}

.project-heading h3 {
  color: var(--fg);
  font-family: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.25;
  transition: color 0.2s ease;
}

.project-heading,
.project-row p {
  min-width: 0;
  overflow-wrap: anywhere;
}

.project-domain {
  display: inline-block;
  margin-top: 0.45rem;
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.project-domain-rose { color: var(--rose); }
.project-domain-sage { color: var(--sage); }
.project-domain-gold { color: var(--gold); }

.project-row p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.project-arrow {
  color: var(--rose);
  font-size: 0.95rem;
  opacity: 0.75;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.project-row-link:hover .project-arrow {
  opacity: 1;
  transform: translate(2px, -2px);
}

/* Decorative Section Divider */
.section-divider {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  margin: 1rem 0;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
}

.section-divider::before {
  background: linear-gradient(90deg, transparent, var(--rose-muted) 40%, var(--gold-muted));
}

.section-divider::after {
  background: linear-gradient(90deg, var(--gold-muted), var(--sage-muted) 60%, transparent);
}

.divider-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose-muted), var(--gold-muted));
  flex-shrink: 0;
  margin: 0 0.75rem;
}

/* ============================================================
   WRITING
   ============================================================ */
.writing-section {
  padding: 2.5rem 0;
}

.post-list {
  display: flex;
  flex-direction: column;
}

.post-preview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: padding-left 0.2s ease;
}

.post-preview:last-child {
  border-bottom: none;
}

.post-preview:hover {
  padding-left: 0.5rem;
}

.post-preview:hover .post-title {
  color: var(--rose);
}

.post-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--fg);
  transition: color 0.2s ease;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.post-tag {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* ============================================================
   FOR FUN & 3D CARDS
   ============================================================ */
.fun-section {
  padding: 2.5rem 0;
}

.fun-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.fun-grid .fun-item:nth-child(1) { transition-delay: 0s; }
.fun-grid .fun-item:nth-child(2) { transition-delay: 0.08s; }
.fun-grid .fun-item:nth-child(3) { transition-delay: 0.16s; }

.fun-item {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.fun-item:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.fun-image-full,
.fun-item img {
  width: 100%;
  height: 100%;
  min-height: 200px;
  object-fit: cover;
  display: block;
}

.fun-image-placeholder {
  width: 100%;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.8rem;
  font-family: var(--mono);
  background: linear-gradient(135deg, var(--border) 0%, var(--bg-alt) 100%);
}

.fun-label {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
}

html[data-theme="dark"] .fun-label {
  background: rgba(0, 0, 0, 0.6);
}

/* ============================================================
   FOOTER (Exact layout & metrics from medhavenkatapathy.com)
   ============================================================ */
footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.footer-content,
.foot-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
}

.footer-tagline,
.reach {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 1.5rem;
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.6;
}

.footer-links,
.links {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.footer-link,
.links a,
.links button {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease;
}

.footer-link:hover,
.links a:hover,
.links button:hover {
  color: var(--rose);
  transform: translateY(-2px);
}

/* ============================================================
   LIGHTBOX & TOAST
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 900;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.lightbox.lightbox-open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: 85vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: var(--radius);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.lightbox.lightbox-open img {
  transform: scale(1);
}

.lightbox-label {
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  margin-top: 1rem;
  opacity: 0.8;
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--fg);
  color: var(--bg);
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 999;
  pointer-events: none;
}

.toast.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   SCROLL PROGRESS PETAL (pure visual ambient decoration)
   ============================================================ */
.scroll-petal {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  width: 36px;
  height: 36px;
  z-index: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.scroll-petal.visible {
  opacity: 1;
}

.scroll-petal svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

.petal-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 2.5;
  pointer-events: none;
}

.petal-progress {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke: url(#petal-gradient);
  transform-origin: center;
  transform: rotate(-90deg);
  transition: stroke-dashoffset 0.1s linear;
  pointer-events: none;
}

.petal-symbol {
  font-size: 13px;
  fill: var(--fg);
  text-anchor: middle;
  dominant-baseline: central;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  pointer-events: none;
}

/* ============================================================
   SPARKLE TRAIL (Exact transparency from medhavenkatapathy.com)
   ============================================================ */
@keyframes sparkle-pop {
  0%   { transform: scale(0); opacity: 0.7; }
  40%  { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(0); opacity: 0; }
}

.sparkle {
  position: fixed;
  pointer-events: none;
  z-index: 99999;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  animation: sparkle-pop 0.8s ease-out forwards;
}

/* ============================================================
   SCROLL REVEAL ANIMATION
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.revealed,
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   RESPONSIVE BREAKPOINTS (matching medhavenkatapathy.com)
   ============================================================ */
@media (max-width: 768px) {
  .hero {
    flex-direction: column-reverse;
    align-items: center;
    text-align: center;
  }

  .hero-tags {
    justify-content: center;
  }

  .hero-photo, .portrait {
    width: 120px;
    height: 120px;
  }

  .fun-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .project-row {
    display: block;
    padding: 1.2rem 0;
    padding-left: 2.5rem;
  }

  .project-number {
    position: absolute;
    top: 1.34rem;
    left: 0;
  }

  .project-heading {
    padding-right: 1.5rem;
  }

  .project-row p {
    margin-top: 0.8rem;
    width: 100%;
  }

  .project-arrow {
    position: absolute;
    top: 1.2rem;
    right: 0;
  }
}

@media (max-width: 600px) {
  html {
    font-size: 15px;
  }

  nav, .nav-inner {
    padding: 1.25rem 1.25rem;
  }

  main {
    padding: 0 1.25rem 3rem;
  }

  .hero {
    padding: 2.5rem 0 3rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .footer-content,
  .foot-inner {
    padding: 0 1.25rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }

  .footer-links,
  .links {
    flex-direction: column;
    gap: 1rem;
  }
}

/* ============================================================
   BLOG PAGE (Exact match from medhavenkatapathy.com/blog.html)
   ============================================================ */
.page-header {
  padding: 4rem 0 2rem;
  border-bottom: 1px solid var(--border);
  animation: fadeInUp 0.7s ease-out;
}

.page-header h1 {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.blog-list {
  padding: 1rem 0 2rem;
}

.blog-post-item {
  display: block;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: padding-left 0.2s ease;
  animation: fadeInUp 0.5s ease-out backwards;
}

.blog-post-item:nth-child(1) { animation-delay: 0.1s; }
.blog-post-item:nth-child(2) { animation-delay: 0.15s; }
.blog-post-item:nth-child(3) { animation-delay: 0.2s; }
.blog-post-item:nth-child(4) { animation-delay: 0.25s; }

.blog-post-item:last-child {
  border-bottom: none;
}

.blog-post-item:hover {
  padding-left: 0.75rem;
}

.blog-post-item h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.4rem;
  transition: color 0.2s ease;
}

.blog-post-item:hover h3 {
  color: var(--rose);
}

.blog-post-item .excerpt {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.blog-post-item .meta {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--sage);
  font-family: var(--sans);
}

.footer-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  opacity: 0.7;
}

.footer-link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.footer-link:hover {
  transform: translateY(-2px);
}

.footer-link span:last-child {
  font-size: 0.9rem;
  color: var(--fg);
  font-weight: 500;
}

.footer-link:hover span:last-child {
  color: var(--rose);
}

/* ============================================================
   ARTICLE / POST LAYOUT (matching medhavenkatapathy.com/posts/...)
   ============================================================ */
.blog-layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

.article-wrapper {
  position: relative;
  padding-top: 2rem;
}

.article-toc {
  position: fixed;
  top: 5rem;
  left: calc((100vw - 900px - 4rem) / 2 - 180px - 1.5rem);
  width: 180px;
  text-align: right;
}

@media (max-width: 1300px) {
  .article-toc {
    position: static;
    width: auto;
    text-align: left;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.5rem;
  }
}

.article-toc ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.article-toc a {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
  line-height: 1.4;
  display: block;
}

.article-toc a:hover,
.article-toc a.toc-active {
  color: var(--fg);
}

.article-toc a.toc-active {
  font-weight: 600;
}

article {
  padding: 2rem 0 4rem;
  max-width: 780px;
  animation: fadeInUp 0.7s ease-out;
}

article header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

article h1 {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 2.6rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  line-height: 1.2;
  color: var(--fg);
}

article .meta {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--sage);
}

article .content {
  font-family: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.85;
}

article .content p {
  margin-bottom: 1.5rem;
}

article .content h2 {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 400;
  margin: 3rem 0 1.25rem;
  color: var(--fg);
  position: relative;
  padding-left: 1rem;
}

article .content h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.35em;
  width: 4px;
  height: 1em;
  background: linear-gradient(180deg, var(--rose), var(--gold));
  border-radius: 2px;
}

article .content ul,
article .content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

article .content li {
  margin-bottom: 0.5rem;
}

article .content li::marker {
  color: var(--rose);
}

article .content blockquote {
  border-left: 3px solid var(--sage);
  background: var(--sage-soft);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--fg);
}

article .content blockquote p {
  margin-bottom: 0;
}

article .content code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: var(--rose-soft);
  padding: 0.2em 0.45em;
  border-radius: 4px;
  color: var(--rose);
}

article .content pre {
  background: #2d2d2d;
  color: #f8f8f2;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 1.5rem 0;
}

article .content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 0.9rem;
}

article .content strong {
  font-weight: 600;
  color: var(--fg);
}

article .content figure {
  margin: 2rem 0;
}

article .content figure img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

article .content figcaption {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.6rem;
  font-style: italic;
}

.citation-block {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.citation-block h2 {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 400;
  margin-bottom: 1rem;
  color: var(--fg);
}

.citation-code {
  position: relative;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.citation-copy {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.citation-copy:hover {
  color: var(--rose);
  border-color: var(--rose-muted);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 3rem;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.back-link:hover {
  color: var(--rose);
  border-color: var(--rose-muted);
  transform: translateX(-4px);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}
