/* ============================================================
   Ali Miraftab — Personal Site
   Modern AI/ML aesthetic · dark-first · minimal · typographic
   ============================================================ */

/* -------- Design Tokens -------- */
:root {
  /* Dark (default) */
  --bg:            #0a0d14;
  --bg-elev:       #11151f;
  --bg-elev-2:     #161b27;
  --surface:       #141926;
  --border:        rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.14);
  --text:          #e6e9ef;
  --text-muted:    #9aa3b8;
  --text-dim:      #6b7488;
  --accent:        #5eead4;          /* mint / teal */
  --accent-2:      #a78bfa;          /* purple */
  --accent-warm:   #fbbf24;          /* amber */
  --link:          #7dd3fc;
  --link-hover:    #38bdf8;
  --code-bg:       rgba(94, 234, 212, 0.08);
  --grad-1: linear-gradient(135deg, #5eead4 0%, #7dd3fc 50%, #a78bfa 100%);
  --grad-soft: radial-gradient(60% 60% at 50% 0%, rgba(94,234,212,0.10) 0%, transparent 70%);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow:    0 8px 24px rgba(0,0,0,0.35);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.45);
  --radius:    14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --maxw: 1080px;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="light"] {
  --bg:            #fbfbfd;
  --bg-elev:       #ffffff;
  --bg-elev-2:     #f3f5f9;
  --surface:       #ffffff;
  --border:        rgba(10,13,20,0.08);
  --border-strong: rgba(10,13,20,0.16);
  --text:          #11151f;
  --text-muted:    #4a5468;
  --text-dim:      #6b7488;
  --accent:        #0d9488;
  --accent-2:      #7c3aed;
  --accent-warm:   #b45309;
  --link:          #0369a1;
  --link-hover:    #0284c7;
  --code-bg:       rgba(13,148,136,0.08);
  --grad-soft: radial-gradient(60% 60% at 50% 0%, rgba(13,148,136,0.08) 0%, transparent 70%);
  --shadow-sm: 0 1px 2px rgba(10,13,20,0.06);
  --shadow:    0 8px 24px rgba(10,13,20,0.08);
  --shadow-lg: 0 20px 60px rgba(10,13,20,0.10);
}

/* -------- Base -------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(94,234,212,0.06), transparent 60%),
    radial-gradient(1000px 500px at -10% 10%, rgba(167,139,250,0.06), transparent 60%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
}

[data-theme="light"] body {
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(13,148,136,0.06), transparent 60%),
    radial-gradient(1000px 500px at -10% 10%, rgba(124,58,237,0.05), transparent 60%);
}

img, svg { max-width: 100%; display: block; }

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--link-hover); }

::selection { background: var(--accent); color: #0a0d14; }

/* -------- Typography -------- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
  margin: 0 0 0.6em;
}
h1 { font-size: clamp(2.2rem, 4.5vw, 3.6rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.6rem, 2.8vw, 2.1rem); margin-top: 2.2em; }
h3 { font-size: 1.25rem; margin-top: 1.8em; }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1em; color: var(--text); }
p + p { margin-top: 0; }

ul, ol { padding-left: 1.25rem; margin: 0 0 1.2em; }
li { margin: 0.35em 0; }

hr {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: 3rem 0;
}

blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5em 0;
  padding: 0.4em 0 0.4em 1.2em;
  color: var(--text-muted);
  font-style: italic;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  color: var(--accent);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

pre {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  overflow-x: auto;
  font-size: 0.88em;
  line-height: 1.55;
}
pre code { background: transparent; color: var(--text); padding: 0; }

/* -------- Syntax highlighting (Rouge) -------- */
:root {
  --syn-comment: #6b7488;
  --syn-keyword: #a78bfa;
  --syn-string:  #6ee7b7;
  --syn-number:  #fbbf24;
  --syn-func:    #5eead4;
  --syn-class:   #fbbf24;
  --syn-builtin: #5eead4;
  --syn-op:      #c3c9d6;
  --syn-punct:   #9aa3b8;
  --syn-name:    #e6e9ef;
  --syn-deco:    #fbbf24;
  --syn-err:     #f87171;
}
[data-theme="light"] {
  --syn-comment: #8a93a6;
  --syn-keyword: #7c3aed;
  --syn-string:  #0f7a5a;
  --syn-number:  #b45309;
  --syn-func:    #0d9488;
  --syn-class:   #b45309;
  --syn-builtin: #0d9488;
  --syn-op:      #3a4252;
  --syn-punct:   #5a6374;
  --syn-name:    #11151f;
  --syn-deco:    #b45309;
  --syn-err:     #b91c1c;
}

.highlight, .highlight pre, .highlighter-rouge .highlight { background: transparent; }
.highlight .c, .highlight .ch, .highlight .cm, .highlight .cp, .highlight .cpf,
.highlight .c1, .highlight .cs { color: var(--syn-comment); font-style: italic; }
.highlight .k, .highlight .kc, .highlight .kd, .highlight .kn, .highlight .kp,
.highlight .kr { color: var(--syn-keyword); }
.highlight .kt { color: var(--syn-class); }
.highlight .o, .highlight .ow { color: var(--syn-op); }
.highlight .p { color: var(--syn-punct); }
.highlight .s, .highlight .sa, .highlight .sb, .highlight .sc, .highlight .dl,
.highlight .sd, .highlight .s2, .highlight .se, .highlight .sh, .highlight .si,
.highlight .sx, .highlight .sr, .highlight .s1, .highlight .ss { color: var(--syn-string); }
.highlight .m, .highlight .mb, .highlight .mf, .highlight .mh, .highlight .mi,
.highlight .il, .highlight .mo { color: var(--syn-number); }
.highlight .na { color: var(--syn-func); }
.highlight .nb, .highlight .bp { color: var(--syn-builtin); }
.highlight .nf, .highlight .fm { color: var(--syn-func); }
.highlight .nc, .highlight .nn { color: var(--syn-class); }
.highlight .nd { color: var(--syn-deco); }
.highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi,
.highlight .n, .highlight .nl, .highlight .nx, .highlight .py { color: var(--syn-name); }
.highlight .no { color: var(--syn-number); }
.highlight .nt { color: var(--syn-keyword); }
.highlight .gr, .highlight .err { color: var(--syn-err); }
.highlight .gi { color: var(--syn-string); }
.highlight .gd { color: var(--syn-err); }
.highlight .gh, .highlight .gu { color: var(--syn-keyword); font-weight: 600; }

/* -------- Layout -------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container--narrow { max-width: 760px; }

main {
  padding: 6rem 0 5rem;
  min-height: calc(100vh - 200px);
}

/* -------- Nav -------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  max-width: var(--maxw);
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--text); }

.brand__mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--grad-1);
  display: inline-grid;
  place-items: center;
  color: #0a0d14;
  font-weight: 800;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  box-shadow: 0 6px 18px rgba(94,234,212,0.25);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  margin: 0; padding: 0;
}
.nav__links a {
  color: var(--text-muted);
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  font-size: 0.94rem;
  font-weight: 500;
  transition: all 0.15s ease;
}
.nav__links a:hover,
.nav__links a.is-active {
  color: var(--text);
  background: var(--bg-elev-2);
}

.theme-toggle {
  margin-left: 0.4rem;
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: all 0.18s ease;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Mobile nav */
.nav__toggle {
  display: none;
  background: none; border: 0; cursor: pointer;
  color: var(--text); padding: 6px; border-radius: 8px;
}

@media (max-width: 680px) {
  .nav__links { display: none; gap: 0; }
  .nav__links.is-open {
    display: flex;
    position: absolute;
    inset: 100% 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem;
  }
  .nav__links a { padding: 0.85rem 1rem; }
  .nav__toggle { display: inline-grid; place-items: center; }
}

/* -------- Hero -------- */
.hero {
  position: relative;
  padding: 4rem 0 3.5rem;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -120px 0 auto 0;
  height: 380px;
  background: var(--grad-soft);
  z-index: -1;
  pointer-events: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--code-bg);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.25); opacity: 0.55; }
}

.hero h1 {
  margin-top: 1.2rem;
  font-size: clamp(2.4rem, 5.5vw, 4.2rem);
}
.hero h1 .grad {
  background: var(--grad-1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.hero__lede {
  font-size: clamp(1.05rem, 1.4vw, 1.18rem);
  color: var(--text-muted);
  max-width: 680px;
  line-height: 1.7;
  margin: 1.1rem 0 1.8rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.6rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.15rem;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.95rem;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  transition: all 0.18s ease;
}
.btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border-strong));
  color: var(--text);
}
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #06201a;
  font-weight: 600;
}
.btn--primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, white);
  color: #06201a;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 25%, transparent);
}
.btn svg { width: 16px; height: 16px; }

/* -------- Meta strip -------- */
.meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  margin-top: 1.6rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.meta-strip span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.meta-strip svg { width: 14px; height: 14px; color: var(--accent); }

/* -------- Section -------- */
.section {
  padding: 3.5rem 0 1rem;
}
.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.6rem;
  flex-wrap: wrap;
}
.section__title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}
.section__title::before {
  content: "";
  display: inline-block;
  width: 6px; height: 22px;
  border-radius: 2px;
  background: var(--grad-1);
}
.section__sub {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-family: var(--font-mono);
}

/* -------- Card grids -------- */
.grid {
  display: grid;
  gap: 1rem;
}
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 820px) {
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.4rem 1.25rem;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.card__kicker {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.card__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
  color: var(--text);
}
.card__body {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}

/* Stat */
.stat {
  padding: 1.2rem 1.3rem;
}
.stat__value {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  background: var(--grad-1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}
.stat__label {
  margin-top: 0.4rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* -------- Tag pills -------- */
.tags {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  padding: 0; margin: 0; list-style: none;
}
.tag {
  display: inline-block;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  transition: all 0.15s ease;
}
.tag:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.tag--solid {
  background: var(--code-bg);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent);
}

/* -------- Timeline (CV) -------- */
.timeline { position: relative; padding-left: 1.6rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), transparent);
  opacity: 0.4;
}
.tl-item {
  position: relative;
  padding: 0 0 2.2rem;
}
.tl-item::before {
  content: "";
  position: absolute;
  left: -1.6rem;
  top: 0.45rem;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.tl-head {
  display: flex; flex-wrap: wrap; align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
}
.tl-role {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
  font-size: 1.08rem;
}
.tl-org { color: var(--accent); font-weight: 500; }
.tl-meta {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-dim);
}
.tl-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0.2rem 0 0.9rem;
  font-style: italic;
}
.tl-list { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.tl-list li { color: var(--text-muted); margin: 0.4rem 0; }
.tl-list li b, .tl-list li strong { color: var(--text); font-weight: 600; }

/* -------- Skills cluster -------- */
.skills { display: grid; gap: 1rem; }
.skill {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.skill__head {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  margin: 0 0 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.skill__head::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--accent);
  transform: rotate(45deg);
}

/* -------- Blog list -------- */
.post-list {
  display: grid;
  gap: 0.9rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.post-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.3rem 1.4rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s ease;
}
.post-card:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.post-card__meta {
  display: flex; align-items: center; gap: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}
.post-card__topic {
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  background: var(--code-bg);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}
.post-card__title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin: 0.15rem 0 0;
  line-height: 1.35;
}
.post-card a { color: inherit; }
.post-card:hover .post-card__title { color: var(--accent); }

/* Filter chips */
.filters {
  display: flex; flex-wrap: wrap; gap: 0.45rem;
  margin: 0 0 1.4rem;
}
.filter {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.filter:hover { color: var(--text); border-color: var(--border-strong); }
.filter.is-active {
  background: var(--code-bg);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent);
}

/* -------- Post page -------- */
.post {
  max-width: 740px;
  margin: 0 auto;
}
.post__header {
  margin-bottom: 2rem;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--border);
}
.post__title {
  font-size: clamp(1.8rem, 3.6vw, 2.6rem);
  margin: 0.6rem 0 0.8rem;
}
.post__meta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
}
.post__body p,
.post__body li {
  font-size: 1.02rem;
  line-height: 1.78;
}
.post__body h1, .post__body h2 { margin-top: 2.2em; }
.post__body strong { color: var(--text); }

/* Reading progress bar */
.read-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: var(--grad-1);
  z-index: 60;
  transition: width 0.1s ease-out;
}

/* -------- Footer -------- */
footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.footer__links {
  display: flex;
  gap: 0.6rem;
  list-style: none;
  padding: 0; margin: 0;
}
.footer__links a {
  color: var(--text-muted);
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: inline-grid;
  place-items: center;
  background: var(--bg-elev);
  transition: all 0.18s ease;
}
.footer__links a:hover {
  color: var(--accent);
  transform: translateY(-1px);
  border-color: var(--border-strong);
}
.footer__links svg { width: 16px; height: 16px; }

/* -------- Utilities -------- */
.muted { color: var(--text-muted); }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem;
}

/* -------- Fade-in on load -------- */
.fade-in {
  opacity: 0;
  transform: translateY(8px);
  animation: fadeUp 0.7s ease forwards;
}
.fade-in.delay-1 { animation-delay: 0.08s; }
.fade-in.delay-2 { animation-delay: 0.18s; }
.fade-in.delay-3 { animation-delay: 0.28s; }
.fade-in.delay-4 { animation-delay: 0.38s; }
@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in, .eyebrow::before { animation: none; opacity: 1; transform: none; }
  * { transition: none !important; }
}

/* -------- Tables in long-form content -------- */
.post__body table,
.series table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 0.92rem;
  display: block;
  overflow-x: auto;
}
.post__body table thead th,
.series table thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--code-bg);
  border-bottom: 1px solid var(--border-strong);
  padding: 0.6rem 0.8rem;
  white-space: nowrap;
}
.post__body table td,
.series table td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.post__body table tr:last-child td,
.series table tr:last-child td { border-bottom: none; }
.post__body table tbody tr:hover,
.series table tbody tr:hover { background: var(--code-bg); }

/* -------- Mermaid diagrams -------- */
.mermaid {
  margin: 1.8em 0;
  text-align: center;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  overflow-x: auto;
}
/* Let Mermaid scale up to fill the box instead of its small natural width */
.mermaid svg { width: 100% !important; max-width: 880px !important; height: auto; margin: 0 auto; }

/* -------- Series hub page -------- */
.series-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
  align-items: baseline;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.series-card:hover { border-color: var(--border-strong); transform: translateX(3px); }
.series-card .num {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent);
  grid-row: span 2;
}
.series-card .t { font-weight: 600; font-family: var(--font-display); }
.series-card .d { color: var(--text-muted); font-size: 0.9rem; grid-column: 2; }

/* Series banner on the Writing page */
.series-banner {
  display: block;
  padding: 1.3rem 1.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--grad-soft), var(--bg-elev);
  text-decoration: none;
  color: var(--text);
  margin-bottom: 2rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.series-banner:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); transform: translateY(-2px); }
.series-banner .kick { font-family: var(--font-mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); }
.series-banner h3 { margin: 0.35rem 0 0.4rem; font-size: 1.25rem; }
.series-banner p { margin: 0; color: var(--text-muted); font-size: 0.95rem; }
