/* =========================================================================
   UI kit — STEMbyAbe website
   Inherits tokens from colors_and_type.css
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Arial, sans-serif; font-size: 17px; line-height: 1.6; letter-spacing: 0; word-spacing: normal; background: var(--bg); color: var(--fg); -webkit-font-smoothing: antialiased; }
* { letter-spacing: inherit; word-spacing: inherit; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* --- Layout --- */
.page { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
.container { max-width: 1240px; margin: 0 auto; padding-left: clamp(1.25rem, 4vw, 3rem); padding-right: clamp(1.25rem, 4vw, 3rem); }
.stack > * + * { margin-top: var(--space-5); }
.rule { height: 1px; background: var(--ink-900); border: 0; margin: 0; opacity: .9; }
.section { padding-block: clamp(var(--space-7), 8vw, var(--space-9)); }
.section.tight { padding-block: var(--space-6); }
.section + .section { padding-top: 0; }

/* --- Nav --- */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: 72px;
  background: rgba(251, 248, 243, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-base) var(--ease-out);
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav-inner { height: 100%; display: flex; align-items: center; gap: var(--space-6); }
.brand { display: flex; align-items: baseline; gap: 4px; color: var(--ink-900); text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; letter-spacing: -.01em; }
.brand .sigma { font-size: 1.8rem; font-weight: 900; font-style: italic; color: var(--signal-500); line-height: 1; margin-right: 2px; }
.brand .by { font-weight: 400; font-style: italic; color: var(--ink-600); }
.nav-links { display: flex; gap: 2px; margin-left: auto; }
.nav-links a {
  font-family: var(--font-body); font-size: .95rem; font-weight: 500;
  color: var(--fg-muted); text-decoration: none;
  padding: .5rem .85rem; border-radius: 6px;
  transition: all var(--dur-quick) var(--ease-out);
  position: relative;
}
.nav-links a:hover { color: var(--ink-900); background: var(--paper-100); }
.nav-links a.active { color: var(--ink-900); }
.nav-links a.active::after { content: ""; position: absolute; left: .85rem; right: .85rem; bottom: 3px; height: 2px; background: var(--signal-500); border-radius: 1px; }
.nav-cta {
  padding: .55rem 1rem; background: var(--ink-900); color: var(--paper-50);
  border-radius: 7px; font-size: .85rem; font-weight: 600; text-decoration: none;
  transition: all var(--dur-quick) var(--ease-out);
}
.nav-cta:hover { background: var(--ink-800); transform: translateY(-1px); color: var(--paper-50); }

.nav-toggle {
  display: none; padding: .5rem; border-radius: 6px; margin-left: auto;
  color: var(--ink-900); font-size: 1.25rem; line-height: 1;
}
.nav-toggle:hover { background: var(--paper-100); }

/* --- Buttons --- */
.btn { display: inline-flex; align-items: center; gap: .5rem; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif; font-weight: 600; font-size: .95rem; letter-spacing: 0.005em; word-spacing: 0.05em; padding: .7rem 1.25rem; border-radius: 8px; text-decoration: none; transition: all var(--dur-quick) var(--ease-out); border: 1px solid transparent; cursor: pointer; }
.btn .arrow { display: inline-block; transition: transform var(--dur-quick) var(--ease-out); }
.btn:hover .arrow { transform: translateX(3px); }
.btn-primary { background: var(--signal-500); color: #fff; box-shadow: 0 1px 2px rgba(17,25,51,0.08); }
.btn-primary:hover { background: var(--signal-600); transform: translateY(-1px); box-shadow: 0 6px 14px -4px rgba(220,122,31,0.4); color: #fff; }
.btn-ink { background: var(--ink-900); color: var(--paper-50); }
.btn-ink:hover { background: var(--ink-800); transform: translateY(-1px); color: var(--paper-50); }
.btn-secondary { background: transparent; color: var(--fg); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--ink-900); background: var(--paper-100); }
.btn-ghost { color: var(--fg-muted); padding-inline: .6rem; }
.btn-ghost:hover { color: var(--signal-600); }
.btn-lg { padding: .95rem 1.75rem; font-size: 1.05rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* --- Hero --- */
.hero { position: relative; background: var(--ink-950); color: var(--paper-50); overflow: hidden; padding-block: clamp(var(--space-8), 12vw, var(--space-10)); }
.hero .grid-bg { position: absolute; inset: 0; background-image: linear-gradient(rgba(236,238,246,0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(236,238,246,0.06) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(ellipse at 25% 40%, #000 30%, transparent 75%); pointer-events: none; }
.hero .watermark { position: absolute; right: -40px; top: -20px; font-family: var(--font-display); font-style: italic; font-weight: 900; color: rgba(242,149,58,0.09); pointer-events: none; line-height: 1; font-size: clamp(14rem, 28vw, 26rem); user-select: none; }
.hero .eyebrow { color: var(--signal-300); margin: 0 0 var(--space-5); }
.hero h1 { font-family: var(--font-display); font-weight: 900; font-size: clamp(2.75rem, 1.6rem + 4.2vw, 5.25rem); line-height: 1.08; letter-spacing: -0.02em; color: #fff; font-variation-settings: "opsz" 144; max-width: 18ch; margin: 0; }
.hero h1 em { font-style: italic; color: var(--signal-300); font-weight: 700; }
.hero .lede { color: var(--ink-200); font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif; font-weight: 400; font-size: 1.0625rem; line-height: 1.65; letter-spacing: 0.005em; word-spacing: 0.05em; margin: var(--space-6) 0 var(--space-7); max-width: 58ch; }
.hero .cta-row { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.hero .btn-primary { background: var(--signal-500); }
.hero .btn-secondary { color: var(--paper-50); border-color: rgba(236,238,246,0.28); }
.hero .btn-secondary:hover { background: rgba(236,238,246,0.06); border-color: var(--paper-50); }
.hero-inner { position: relative; z-index: 1; }

/* --- Stat strip --- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-5); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding-block: var(--space-6); }
.stat .n { font-family: var(--font-display); font-weight: 700; font-size: clamp(2.25rem, 3.5vw, 3rem); line-height: 1; color: var(--ink-900); letter-spacing: -.02em; font-variation-settings: "opsz" 96; }
.stat .n sup { font-size: .5em; color: var(--signal-500); font-weight: 500; vertical-align: top; margin-left: .2em; }
.stat .lbl { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-subtle); margin-top: var(--space-2); }

/* --- Article card --- */
.card { background: var(--bg-raised); border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-sm); text-decoration: none; color: inherit; display: flex; flex-direction: column; transition: all var(--dur-base) var(--ease-out); cursor: pointer; }
.card:hover, .card:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card .thumb { aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-style: italic; font-weight: 900; color: #fff; font-size: 5rem; position: relative; border-bottom: 1px solid var(--border); }
.card .body { padding: var(--space-4) var(--space-5) var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); flex: 1; }
.card .meta { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-subtle); display: flex; gap: .6rem; flex-wrap: wrap; }
.card .meta .sep { color: var(--paper-400); }
.card h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; line-height: 1.2; letter-spacing: -.015em; color: var(--fg); margin: 0; font-variation-settings: "opsz" 36; text-wrap: balance; }
.card p { margin: 0; font-size: .95rem; color: var(--fg-muted); line-height: 1.55; }
.card .read { margin-top: auto; font-family: var(--font-mono); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--signal-600); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }

/* --- Filter bar --- */
.filter-bar { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-6) 0; }
.chip { padding: .45rem .9rem; border-radius: 999px; font-family: var(--font-mono); font-size: .8rem; letter-spacing: .04em; background: transparent; border: 1px solid var(--border-strong); color: var(--fg-muted); cursor: pointer; transition: all var(--dur-quick) var(--ease-out); display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { border-color: var(--ink-900); color: var(--ink-900); }
.chip.on { background: var(--ink-900); color: var(--paper-50); border-color: var(--ink-900); }
.chip .g { font-family: var(--font-display); font-weight: 700; font-style: italic; font-size: 1rem; line-height: 1; }

/* --- Article grid --- */
.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-5); }

/* --- Section header --- */
.section-head { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: end; gap: var(--space-6); margin-bottom: var(--space-7); border-bottom: 1px solid var(--ink-900); padding-bottom: var(--space-5); position: relative; }
.section-head .title .eyebrow { margin: 0 0 var(--space-3); display: block; }
.section-head h2 { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-h2); line-height: 1.1; letter-spacing: -.015em; margin: 0; color: var(--fg); font-variation-settings: "opsz" 72; text-wrap: balance; }
.section-head .side { color: var(--fg-muted); font-size: .95rem; line-height: 1.55; max-width: 42ch; justify-self: end; }
@media (max-width: 820px) { .section-head { grid-template-columns: 1fr; } .section-head .side { justify-self: start; } }

/* --- Services (dark cards) --- */
.services { background: var(--paper-100); }
.service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-4); }
.svc { background: var(--ink-900); color: var(--paper-50); border-radius: var(--radius-lg); padding: var(--space-6); position: relative; overflow: hidden; transition: all var(--dur-base) var(--ease-out); cursor: pointer; display: flex; flex-direction: column; gap: var(--space-3); min-height: 300px; border: 0; text-align: left; width: 100%; color: var(--paper-50); }
.svc:hover, .svc:focus-visible { transform: translateY(-3px); background: var(--ink-800); }
.svc .num { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .18em; color: var(--signal-300); margin-bottom: var(--space-4); }
.svc h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; line-height: 1.15; letter-spacing: -.015em; color: #fff; margin: 0; font-variation-settings: "opsz" 48; }
.svc p { font-size: .95rem; line-height: 1.55; color: var(--ink-200); margin: 0; }
.svc .price { margin-top: auto; font-family: var(--font-mono); font-size: .78rem; letter-spacing: .08em; color: var(--signal-500); text-transform: uppercase; }
.svc .price b { color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 1.75rem; letter-spacing: -.01em; text-transform: none; margin-right: 4px; }
.svc .deco { position: absolute; right: -24px; bottom: -48px; font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 14rem; line-height: 1; color: rgba(242,149,58,0.08); pointer-events: none; user-select: none; }
.svc .cta { margin-top: var(--space-4); align-self: flex-start; color: var(--signal-300); font-family: var(--font-mono); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none; }
.svc:hover .cta .arrow { transform: translateX(3px); }

/* --- Two-col intro --- */
.two-col { display: grid; grid-template-columns: 1fr 1.3fr; gap: var(--space-8); align-items: start; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; gap: var(--space-5); } }

/* --- About prose --- */
.prose { font-family: var(--font-body); font-size: var(--fs-body); line-height: 1.7; color: var(--fg-muted); max-width: var(--prose-max); }
.prose p + p { margin-top: var(--space-4); }
.prose h3 { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-h3); color: var(--fg); margin: var(--space-6) 0 var(--space-3); }
.prose .latex { font-family: var(--font-math); font-style: italic; font-size: 1.15em; color: var(--ink-900); padding: .1em .4em; background: var(--bg-sunken); border-radius: 4px; }

/* --- Contact form --- */
.form { display: grid; gap: var(--space-4); max-width: 520px; }
.form label { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-subtle); font-weight: 500; display: block; margin-bottom: 6px; }
.form .field { display: block; width: 100%; padding: .7rem .9rem; font-family: var(--font-body); font-size: .95rem; color: var(--fg); background: #fff; border: 1px solid var(--border-strong); border-radius: 8px; transition: all var(--dur-quick); }
.form .field:focus { outline: none; border-color: var(--signal-500); box-shadow: var(--shadow-focus); }
.form textarea.field { resize: vertical; min-height: 120px; font-family: var(--font-body); }
.form-status { font-family: var(--font-mono); font-size: .85rem; margin: 0; }
.form-status.err { color: var(--signal-600); }
.form-status.ok  { color: var(--moss); }

/* --- Footer --- */
.footer { background: var(--ink-950); color: var(--paper-200); padding-block: var(--space-7); margin-top: var(--space-9); position: relative; overflow: hidden; }
.footer .container { max-width: 960px !important; padding-left: 2rem !important; padding-right: 2rem !important; }
.footer-inner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-6); position: relative; z-index: 1; }
.footer .brand { color: var(--paper-50); justify-content: center; }
.footer .brand .by { color: var(--ink-300); }
.footer-tagline { color: var(--ink-300); margin: var(--space-2) auto 0; max-width: 48ch; font-size: .95rem; line-height: 1.55; text-align: center; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3) var(--space-6); list-style: none; padding: 0; margin: 0; }
.footer-links li { margin: 0; }
.footer-links a { color: var(--paper-200); text-decoration: none; font-family: var(--font-mono); font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; transition: color var(--dur-quick); display: inline-block; }
.footer-links a:hover { color: var(--signal-300); }
.footer-bottom { margin-top: var(--space-6); padding-top: var(--space-5); border-top: 1px solid rgba(236,238,246,0.12); display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; align-items: center; font-family: var(--font-mono); font-size: .75rem; color: var(--ink-400); letter-spacing: .04em; position: relative; z-index: 1; text-align: center; }
.footer-bottom > span + span::before { content: "·"; margin: 0 var(--space-3); color: var(--ink-600); }
.footer .big-sigma { position: absolute; right: -180px; bottom: -200px; font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 16rem; line-height: 1; color: rgba(242,149,58,0.035); pointer-events: none; user-select: none; }

/* --- Entry animation --- */
@keyframes rise-in { 0% { opacity: 0; transform: translateY(10px) } 100% { opacity: 1; transform: none } }
.rise { opacity: 1; animation: rise-in var(--dur-reveal) var(--ease-out); }
.rise.d1 { animation-delay: 60ms; }
.rise.d2 { animation-delay: 120ms; }
.rise.d3 { animation-delay: 180ms; }
.rise.d4 { animation-delay: 240ms; }
.rise.d5 { animation-delay: 300ms; }
@media (prefers-reduced-motion: reduce) { .rise { animation: none; } }

/* --- Article card: real image cover --- */
.card .thumb.thumb--image { position: relative; overflow: hidden; }
.card .thumb.thumb--image img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: contrast(1.05) saturate(0.92);
  transition: transform 600ms var(--ease-out), filter 400ms var(--ease-out);
}
.card:hover .thumb.thumb--image img { transform: scale(1.04); filter: contrast(1.08) saturate(1); }
.card .thumb.thumb--image .thumb-glyph {
  position: absolute; right: 18px; bottom: 10px; z-index: 2;
  font-family: var(--font-display); font-style: italic; font-weight: 900;
  font-size: 2.2rem; line-height: 1; color: rgba(255,255,255,0.7);
  text-shadow: 0 1px 10px rgba(0,0,0,0.45);
  padding: 4px 10px 4px 12px;
  min-width: 2.4em;
  display: inline-flex; align-items: center; justify-content: center;
}

/* --- Article view (reader) --- */
.article-view .article-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2rem, 1.2rem + 2.6vw, 3.2rem);
  line-height: 1.08; letter-spacing: -.02em;
  margin: 0 0 var(--space-5); color: var(--fg);
  font-variation-settings: "opsz" 96; text-wrap: balance;
}
.article-hero {
  aspect-ratio: 16/9; border-radius: var(--radius-lg); overflow: hidden;
  margin-block: var(--space-6); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); background: var(--paper-100);
}
.article-hero img { width: 100%; height: 100%; object-fit: cover; filter: contrast(1.04) saturate(0.92); }
.article-hero--glyph { display: flex; align-items: center; justify-content: center; color: #fff; font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 10rem; }
.article-view .lede {
  font-family: var(--font-display); font-weight: 400;
  font-size: var(--fs-body-lg); line-height: 1.45; color: var(--fg);
  margin: 0 0 var(--space-6); font-variation-settings: "opsz" 24, "SOFT" 50;
  text-wrap: pretty;
  max-width: var(--prose-max);
}
.article-view .prose { color: var(--fg); font-size: 1.05rem; line-height: 1.7; max-width: 68ch; }
.article-view .prose p { margin: 0 0 var(--space-4); }
.article-view .prose h3 { margin: var(--space-7) 0 var(--space-3); font-size: 1.55rem; border-left: 3px solid var(--signal-500); padding-left: .7rem; font-variation-settings: "opsz" 48; }
.article-view .prose h4 { margin: var(--space-5) 0 var(--space-3); font-size: 1.2rem; color: var(--fg); font-family: var(--font-display); font-weight: 600; }
.article-view .prose ul, .article-view .prose ol { padding-left: 1.4rem; margin: 0 0 var(--space-4); }
.article-view .prose li { margin-bottom: .4rem; }
.article-view .prose strong { color: var(--fg); }
.article-view .prose a { color: var(--signal-600); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.article-view .prose a:hover { text-decoration-thickness: 2px; }

.display-math {
  margin: var(--space-5) 0;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-sunken);
  border-left: 3px solid var(--ink-900);
  border-radius: 0 8px 8px 0;
  overflow-x: auto;
  font-size: 1.02rem;
}
.inline-math { font-family: var(--font-math); }

.article-figure { margin: var(--space-6) 0; }
.article-figure img {
  width: 100%; border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background: #fff;
}
.article-figure figcaption {
  font-family: var(--font-mono); font-size: .82rem; line-height: 1.55;
  color: var(--fg-subtle); margin-top: .6rem;
}
.article-code {
  background: var(--ink-950); color: var(--paper-100);
  padding: var(--space-4) var(--space-5); border-radius: 10px;
  overflow-x: auto; margin: var(--space-4) 0;
  font-family: var(--font-mono); font-size: .88rem; line-height: 1.55;
  white-space: pre;
}
.code-download { margin: var(--space-6) 0 var(--space-4); }
.code-download .btn { border-style: dashed; }
.article-refs {
  font-family: var(--font-mono); font-size: .82rem; line-height: 1.65;
  color: var(--fg-muted); padding-left: 1.4rem;
}
.article-refs li { margin-bottom: .45rem; }
.article-refs a { color: var(--signal-600); word-break: break-word; }

/* --- About page: set-builder flourish --- */
.about-grid { grid-template-columns: 1fr 1.3fr; gap: var(--space-9); }
.about-head { position: sticky; top: calc(72px + var(--space-6)); align-self: start; }
.about-head .eyebrow { margin-bottom: var(--space-4); display: block; }
.about-head .about-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2rem, 1.3rem + 2.4vw, 3rem);
  margin: 0 0 var(--space-5);
  letter-spacing: -.02em; line-height: 1.08; text-wrap: balance;
  color: var(--fg);
  font-variation-settings: "opsz" 96;
}
.about-head .about-setbuilder {
  font-family: var(--font-display); font-style: italic; font-weight: 500;
  font-size: clamp(1.4rem, 1.05rem + .8vw, 1.9rem);
  line-height: 1.2;
  color: var(--signal-600);
  letter-spacing: -.005em;
  padding-top: var(--space-4);
  border-top: 1px solid var(--ink-900);
  font-variation-settings: "opsz" 48;
}
@media (max-width: 820px) {
  .about-grid { grid-template-columns: 1fr; gap: var(--space-5); }
  .about-head { position: static; }
}

/* =========================================================================
   Math-motion — animated math flourishes.
   ========================================================================= */
.hero-constellation {
  position: absolute; right: -40px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none; z-index: 0;
  opacity: 0.9;
}
.hero-constellation--behind {
  right: auto; left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.55;
  mix-blend-mode: screen;
}
.hero-constellation--behind .roots-svg {
  width: clamp(520px, 62vw, 820px) !important;
}
.hero-constellation .roots-svg { width: clamp(320px, 34vw, 560px); height: auto; }
@media (max-width: 980px) {
  .hero-constellation { right: -120px; opacity: 0.45; }
  .hero-constellation--behind { right: auto; left: 50%; opacity: 0.38; }
}
@media (max-width: 640px) {
  .hero-constellation:not(.hero-constellation--behind) { display: none; }
  .hero-constellation--behind { opacity: 0.28; }
}

.rsvg-chord {
  animation: chordDraw 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  shape-rendering: geometricPrecision;
}
@keyframes chordDraw {
  0%   { stroke-dashoffset: var(--chord-len, 240); opacity: 0; }
  40%  { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0.8; }
}
.rsvg-root {
  opacity: 0;
  animation: rootAppear 520ms cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  shape-rendering: geometricPrecision;
}
@keyframes rootAppear {
  0%   { opacity: 0; }
  60%  { opacity: 1; }
  100% { opacity: 1; }
}
.rsvg-still .rsvg-chord, .rsvg-still .rsvg-root, .rsvg-still .rsvg-chords {
  animation: none; stroke-dashoffset: 0; opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .rsvg-chord, .rsvg-root, .rsvg-chords { animation: none !important; stroke-dashoffset: 0 !important; opacity: 1 !important; }
}

.hero-formula {
  margin-top: var(--space-7);
  font-family: var(--font-math); font-style: italic;
  font-size: .98rem; letter-spacing: .01em;
  color: rgba(236,238,246,0.42);
  display: flex; gap: .4em; flex-wrap: wrap;
  opacity: 0; animation: formulaIn 900ms ease-out 1.2s forwards;
}
.hero-formula-eq { color: var(--signal-300); opacity: 0.9; }
.hero-formula-prod { font-size: 1.25em; color: var(--signal-300); opacity: 0.9; }
@keyframes formulaIn { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hero-formula { opacity: 1; animation: none; } }

.cg { position: relative; display: inline-block; line-height: 1; padding-right: 0.1em; }
.cg-a, .cg-b {
  display: inline-block; transition: transform 420ms var(--ease-out), opacity 420ms var(--ease-out);
}
.cg-b {
  position: absolute; inset: 0;
  transform: scaleY(-1) translateY(0);
  color: rgba(92,200,215,0.85);
  opacity: 0;
  mix-blend-mode: screen;
}
.card:hover .cg-a { transform: translateY(-3px); }
.card:hover .cg-b { transform: scaleY(-1) translateY(-6px); opacity: 0.9; }
@media (prefers-reduced-motion: reduce) {
  .cg-a, .cg-b { transition: none; }
}

.section-head::after {
  content: ""; position: absolute; left: 0; bottom: -1px;
  height: 2px; background: var(--signal-500);
  width: 0;
  animation: ruleGrow 1200ms cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
@keyframes ruleGrow {
  0%   { width: 0; }
  100% { width: clamp(80px, 18vw, 240px); }
}
@media (prefers-reduced-motion: reduce) { .section-head::after { width: clamp(80px, 18vw, 240px); animation: none; } }

/* --- Responsive tweaks --- */
@media (max-width: 720px) {
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .nav-cta { display: none; }
  .nav.open .nav-links { display: flex; flex-direction: column; position: absolute; top: 72px; left: 0; right: 0; background: var(--paper-50); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: var(--space-3) var(--space-5); gap: var(--space-1); margin-left: 0; }
  .nav.open .nav-links a { padding: .6rem .25rem; border-radius: 4px; }
  .nav.open .nav-links a.active::after { left: .25rem; right: auto; width: 14px; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-links { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .footer-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Figure placeholder for missing images */
.figure-placeholder {
  aspect-ratio: 16/9;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center; gap: 0.5em;
  color: rgba(255,255,255,0.9);
  font-family: var(--font-display, serif);
  letter-spacing: 0.02em;
}
.figure-placeholder .fig-label { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.15em; opacity: 0.7; }
.figure-placeholder .fig-num   { font-size: 3rem; font-weight: 500; }
