/* Frameshift Design System */

/* ── Self-hosted EB Garamond ──────────────────────────────────── */
@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/eb-garamond-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/eb-garamond-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/eb-garamond-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/eb-garamond-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/eb-garamond-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/eb-garamond-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/eb-garamond-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/eb-garamond-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  /* Colour */
  --ink:        #0d0d0d;
  --ink-2:      #3a3a3a;
  --muted:      #6e6e73;
  --accent:     #1a6b3c;
  --accent-dim: #e6f2ec;
  --bg:         #faf6f3;
  --tint:       #f3ede8;
  --surface:    #ffffff;
  /* Hero particle canvas reads these (see hero-variants.js readInk/readBg). */
  --hero-ink:   var(--ink);
  --hero-bg:    var(--bg);
  --border:     rgba(0, 0, 0, 0.08);

  /* Shadow */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);

  /* Radius */
  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;

  /* Type */
  --font:      "EB Garamond", Georgia, serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;
  --space-32: 8rem;
}

/* ── Reset ───────────────────────────────────────────────────── */
html { scroll-behavior: smooth; font-size: 112.5%; /* 16px → 18px base; rem-based sizing scales up */ }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  font-size: 1.0625rem;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }

/* ── Layout ──────────────────────────────────────────────────── */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container--narrow {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* ── Navigation ──────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 246, 243, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.site-logo { display: flex; align-items: center; flex-shrink: 0; }
.site-logo img { height: 32px; width: auto; filter: hue-rotate(280deg) saturate(3) brightness(1.1); }

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.site-nav a {
  font-size: 0.9375rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 0.15s;
}

.site-nav a:hover {
  color: var(--ink);
  text-decoration: none;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
  padding: 0.7rem 1.75rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
  opacity: 0.88;
  text-decoration: none;
  color: #fff;
}

.btn--ghost {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.btn--full { width: 100%; }

/* ── Eyebrow ─────────────────────────────────────────────────── */
.eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: var(--space-4);
}

/* ── Section base ────────────────────────────────────────────── */
.section {
  padding: clamp(var(--space-8), 5vw, var(--space-16)) 0;
  border-bottom: 1px solid var(--border);
}

.section--tinted {
  background: var(--tint);
}

.section-title {
  font-size: clamp(1.85rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: var(--space-4);
  letter-spacing: -0.01em;
}

.section-lead {
  font-size: 1.1rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 560px;
  margin-bottom: var(--space-8);
}

/* ── Hero ────────────────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(var(--space-12), 7vw, var(--space-24)) 0 clamp(var(--space-8), 5vw, var(--space-16));
  border-bottom: 1px solid var(--border);
}

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

.hero-content { max-width: 620px; }

.hero-visual {
  position: absolute;
  right: 10%;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(300px, 42vw, 560px);
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
}

.hero-visual img { width: 100%; }

/* When the animated canvas is mounted, expand .hero-visual to fill the hero
   and drop the fallback opacity tint (the canvas sets its own alpha per
   particle). Uses :has() — modern-browser only; older browsers see the
   pinned-right fallback with the static illustration. */
.hero-visual:has(#hero-anim) {
  inset: 0;
  right: 0;
  top: 0;
  left: 0;
  transform: none;
  width: auto;
  opacity: 1;
}

/* Hide the static fallback as soon as CSS paints, so there's no flash
   while the canvas mounts. No-:has() / no-JS browsers keep the fallback. */
.hero-visual:has(#hero-anim) > img {
  display: none;
}

.hero-anim {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-anim__stage {
  position: relative;
  width: 100%;
  max-width: 1600px;
  aspect-ratio: 2 / 1;
  max-height: 100%;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.75rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: var(--space-6);
}

.hero-sub {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--muted);
  line-height: 1.7;
  max-width: 540px;
  margin-bottom: var(--space-8);
}

.hero-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ── Team ────────────────────────────────────────────────────── */
.team-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.team-card {
  display: flex;
  gap: var(--space-6);
  align-items: flex-start;
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
}

.team-avatar {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent-dim);
}

.team-info h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-1);
}

.team-role {
  display: block;
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-3);
}

.team-info p {
  font-size: 0.97rem;
  color: var(--muted);
  line-height: 1.65;
}

.about-sub-heading {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-top: var(--space-12);
  margin-bottom: var(--space-6);
}

/* ── Posts ───────────────────────────────────────────────────── */
.posts {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.post-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}

.post-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.post-meta {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.post-date {
  font-size: 0.8rem;
  color: var(--muted);
}

.post-tag {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--accent-dim);
  color: var(--accent);
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
}

.post-title {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: var(--space-3);
}

.post-title a { color: var(--ink); }
.post-title a:hover { color: var(--accent); text-decoration: none; }

.post-excerpt {
  font-size: 0.97rem;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: var(--space-6);
}

.post-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.post-author { font-size: 0.82rem; color: var(--muted); }

.read-more {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}

/* ── Section header with action ─────────────────────────────── */
.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.section-header-row .section-lead {
  margin-bottom: var(--space-8);
}

.btn--see-all {
  flex-shrink: 0;
  margin-top: var(--space-2);
}

/* ── Post list page ─────────────────────────────────────────── */
.post-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--space-6);
  flex-wrap: wrap;
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

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

.filter-tags {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.tag-filter-btn {
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}

.tag-filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tag-filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.filter-select {
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  appearance: auto;
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 107, 60, 0.12);
}

.filter-sort-btn {
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.filter-sort-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.sort-arrow {
  font-size: 0.75rem;
  margin-left: 0.2rem;
}

.no-results {
  font-size: 1rem;
  color: var(--muted);
  padding: var(--space-8) 0;
}

/* ── Team LinkedIn ───────────────────────────────────────────── */
.team-linkedin {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: var(--space-3);
}

/* ── Why Frameshift ──────────────────────────────────────────── */
.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
}

.why-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
}

.why-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-3);
  line-height: 1.3;
}

.why-card p {
  font-size: 0.93rem;
  color: var(--muted);
  line-height: 1.65;
}

/* ── Contact meta ────────────────────────────────────────────── */
.contact-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.contact-steps {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.contact-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.9rem;
  color: var(--ink-2);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.contact-arrow {
  color: var(--muted);
  font-size: 0.85rem;
}

.contact-email {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}

/* ── Footer ──────────────────────────────────────────────────── */
/* (overrides the earlier simple footer rule) */
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.footer-left {
  font-size: 0.82rem;
  color: var(--muted);
}

.footer-tagline {
  font-size: 0.85rem;
  color: var(--ink-2);
  font-weight: 500;
  margin-bottom: var(--space-2);
}

.footer-links {
  display: flex;
  gap: var(--space-6);
}

.footer-links a {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
  transition: color 0.15s;
}

.footer-links a:hover { color: var(--accent); text-decoration: none; }

/* ── Research ────────────────────────────────────────────────── */
.research-scroll-outer {
  position: relative;
}


.research-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0.5rem 0 var(--space-4);
  cursor: grab;
}

.research-scroll-wrap::-webkit-scrollbar { display: none; }

.research-track {
  display: flex;
  gap: var(--space-4);
  padding: 0.5rem var(--space-6);
  width: max-content;
  max-width: 100%;
}

/* Align left edge with .container */
@media (min-width: 601px) {
  .research-track {
    padding-left: max(var(--space-6), calc((100vw - 960px) / 2 + var(--space-6)));
    padding-right: max(var(--space-6), calc((100vw - 960px) / 2 + var(--space-6)));
  }
}

.research-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  width: 460px;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  transition: box-shadow 0.2s, transform 0.2s;
}

.research-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.research-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.research-journal {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.research-year {
  font-size: 0.78rem;
  color: var(--muted);
}

.research-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

.research-summary {
  font-size: 0.93rem;
  color: var(--muted);
  line-height: 1.65;
  flex: 1;
}

.research-link {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: auto;
}

/* ── Services ────────────────────────────────────────────────── */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
}

.service-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}

.service-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.service-num {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: var(--space-4);
}

.service-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-3);
  line-height: 1.3;
}

.service-card p {
  font-size: 0.93rem;
  color: var(--muted);
  line-height: 1.65;
}

/* ── Contact form ────────────────────────────────────────────── */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.01em;
}

.form-group input,
.form-group textarea {
  font-family: var(--font);
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: #bbb; }

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 107, 60, 0.12);
}

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: var(--space-6) 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── Single post page ────────────────────────────────────────── */
.post-page-wrap { padding: var(--space-8) 0 var(--space-24); }

.back-link {
  display: inline-block;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: var(--space-8);
}
.back-link:hover { color: var(--accent); text-decoration: none; }

.post-header { margin-bottom: var(--space-8); }
.post-header .post-meta { margin-bottom: var(--space-4); }

.post-header h1 {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 700;
  line-height: 1.22;
  margin-bottom: var(--space-3);
  color: var(--ink);
}

.post-byline { font-size: 0.88rem; color: var(--muted); }

.post-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-8) 0;
}

.post-body {
  font-size: 1.075rem;
  line-height: 1.82;
  color: var(--ink-2);
  margin-bottom: var(--space-12);
}

.post-body p { margin-bottom: 1.2rem; }

.post-body h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: var(--space-12) 0 var(--space-4);
  color: var(--ink);
}

.post-body ul, .post-body ol {
  padding-left: var(--space-6);
  margin-bottom: 1.2rem;
}

.post-body li { margin-bottom: var(--space-2); }
.post-body strong { font-weight: 700; }
.post-body em { font-style: normal; }

.post-body figure {
  margin: var(--space-8) 0;
  text-align: center;
}

.post-body figure img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

.post-body figcaption {
  font-size: 0.83rem;
  color: var(--muted);
  margin-top: var(--space-3);
}

.post-body .callout {
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
  padding: var(--space-4) var(--space-6);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: var(--space-6) 0;
  font-size: 0.97rem;
}

.post-body details {
  background: #1e1e2e;
  border-radius: var(--radius-sm);
  padding: var(--space-4) var(--space-6);
  margin: var(--space-8) 0;
}

.post-body details summary {
  color: #a6e3a1;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
  margin-bottom: var(--space-3);
}

.post-body pre {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: var(--radius-sm);
  padding: var(--space-6);
  overflow-x: auto;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  line-height: 1.6;
  margin: var(--space-6) 0;
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.83em;
  background: #ede9e5;
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.post-body pre code { background: transparent; padding: 0; font-size: inherit; }

.post-reference {
  font-size: 0.84rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: var(--space-6);
  margin-top: var(--space-8);
}

/* ── Hamburger menu ─────────────────────────────────────────── */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  z-index: 200;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  margin: 5px 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ── Responsive ──────────────────────────────────────────────── */

/* Nav tightens on tablet */
@media (max-width: 780px) {
  .site-nav { gap: var(--space-4); }
  .site-nav a { font-size: 0.85rem; }
  .hero-visual { opacity: 0.09; }
  .hero-visual:has(#hero-anim) { opacity: 0.35; }
}

/* Small tablet / large phone — hamburger kicks in */
@media (max-width: 600px) {
  .site-header .container {
    position: relative;
  }
  .nav-toggle { display: block; order: -1; }
  .site-logo { order: 0; margin: 0 auto; }
  .ghost-toggle { order: 1; margin-left: 0; }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: var(--space-4) var(--space-6);
    gap: var(--space-2);
    box-shadow: var(--shadow-md);
  }

  .site-nav.open { display: flex; }

  .site-nav a {
    font-size: 1rem;
    padding: var(--space-2) 0;
  }

  .container { padding: 0 var(--space-4); }
  .container--narrow { padding: 0 var(--space-4); }
  .form-row { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
  .contact-steps { flex-direction: column; align-items: flex-start; }
  .contact-arrow { display: none; }
  .team-card { flex-direction: column; gap: var(--space-4); }
  /* On mobile, the canvas doesn't mount — show the static illustration
     pinned behind the text instead. */
  .hero-visual:has(#hero-anim) {
    inset: auto;
    right: -5%;
    top: 50%;
    left: auto;
    transform: translateY(-50%);
    width: clamp(220px, 70vw, 420px);
    opacity: 0.08;
  }
  .hero-visual:has(#hero-anim) > img { display: block; }
  #hero-anim { display: none; }
  .filter-bar { flex-direction: column; align-items: flex-start; }
  .section-header-row { flex-direction: column; }
  .btn--see-all { margin-top: 0; }
}

/* Phone */
@media (max-width: 480px) {
  .site-header { padding: var(--space-2) 0; }
  .site-logo img { height: 24px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .research-card { width: 85vw; }
  .post-card { padding: var(--space-6); }
}

/* ── Ghost toggle (dark mode easter egg) ─────────────────────── */
.ghost-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: var(--space-2);
  opacity: 0.25;
  transition: opacity 0.3s ease, transform 0.3s ease;
  display: flex;
  align-items: center;
}

.ghost-toggle:hover {
  opacity: 0.6;
  transform: scale(1.15);
}

.ghost-toggle img {
  height: 14px;
  width: auto;
}

/* ── Dark mode transition ──────────────────────────────────── */
*,
*::before,
*::after {
  transition: background-color 0.4s ease,
              color 0.4s ease,
              border-color 0.4s ease,
              box-shadow 0.4s ease,
              filter 0.4s ease;
}

/* ── Dark mode ──────────────────────────────────────────────── */
body.dark {
  --ink:        #e8e4e0;
  --ink-2:      #c5c0ba;
  --muted:      #9a9590;
  --accent:     #3dba73;
  --accent-dim: #1a2e23;
  --bg:         #1c1c1e;
  --tint:       #252527;
  --surface:    #2c2c2e;
  --border:     rgba(255, 255, 255, 0.1);
  /* Custom properties don't re-resolve var() references through inheritance,
     so --hero-ink/--hero-bg must be re-declared here to pick up dark mode. */
  --hero-ink:   #e8e4e0;
  --hero-bg:    #1c1c1e;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.25), 0 1px 2px rgba(0,0,0,0.15);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.15);
}

body.dark .site-header {
  background: rgba(28, 28, 30, 0.85);
}

body.dark .site-header.scrolled {
  background: rgba(28, 28, 30, 0.97);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

body.dark .site-logo img {
  filter: brightness(0) invert(1);
}

body.dark .ghost-toggle img {
  filter: invert(1);
}

body.dark .error-logo {
  filter: brightness(0) invert(1) !important;
}

body.dark .hero-visual img {
  filter: brightness(0) invert(1);
  opacity: 0.2;
}

body.dark .btn--primary {
  background: var(--accent);
  color: #111;
}

body.dark .btn--ghost {
  border-color: var(--border);
  color: var(--ink);
}

body.dark code {
  background: #333;
}

body.dark .post-body pre {
  background: #252527;
}

body.dark img:not(.site-logo img):not(.ghost-toggle img) {
  border-radius: var(--radius-sm);
}
