/* ============ 42.AI — shared styles ============ */

/* Self-hosted fonts (latin subset, variable weight) */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter.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: "Fraunces";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/fraunces.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: "Fraunces";
  font-style: italic;
  font-weight: 400 500;
  font-display: swap;
  src: url("fonts/fraunces-italic.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;
}

:root {
  --bg: #fbf6f1;
  --bg-alt: #f5ede6;
  --bg-tint: #f3e4de;
  --ink: #221418;
  --ink-soft: #5c4a4e;
  --ink-faint: #7a6266; /* AA-contrast on cream for small labels */
  --accent: #a83240;
  --accent-dark: #8a2634;
  --line: #eadfd8;
  --radius: 12px;
  --container: 1100px;
  --font: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
}

/* ---- Dark theme (set by theme-init.js; falls back to OS preference) ---- */
[data-theme="dark"] {
  --bg: #171012;
  --bg-alt: #1f1618;
  --bg-tint: #2a1c1f;
  --ink: #f4ece9;
  --ink-soft: #cbb9b6;
  --ink-faint: #a08f8d;
  --accent: #e0808d;
  --accent-dark: #ec9aa5;
  --line: #34272a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171012;
    --bg-alt: #1f1618;
    --bg-tint: #2a1c1f;
    --ink: #f4ece9;
    --ink-soft: #cbb9b6;
    --ink-faint: #a08f8d;
    --accent: #e0808d;
    --accent-dark: #ec9aa5;
    --line: #34272a;
  }
}

/* Accent-background components need dark text on the bright-rose dark accent */
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .to-top,
[data-theme="dark"] .filter-btn.active,
[data-theme="dark"] .chat-msg.user {
  color: #171012;
}
[data-theme="dark"] .btn-primary { box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); }

/* The spotlight band is already dark; in dark mode make it a bordered panel that
   still reads as distinct from the page. */
[data-theme="dark"] .spotlight {
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
[data-theme="dark"] .spotlight h2 { color: var(--ink); }
[data-theme="dark"] .spotlight .lead { color: var(--ink-soft); }
[data-theme="dark"] .spotlight .eyebrow { color: var(--accent); }
[data-theme="dark"] .spotlight-eco { color: var(--ink-soft); }
[data-theme="dark"] .spotlight-eco a { color: var(--accent); }
[data-theme="dark"] .spotlight-readlink { color: var(--accent); }
[data-theme="dark"] .spotlight .btn-primary { background: var(--accent); color: #171012; }
[data-theme="dark"] .spotlight::before,
[data-theme="dark"] .spotlight::after { opacity: 0.5; }

/* Legal template callout keeps contrast */
[data-theme="dark"] .rc-read { background: #123020; color: #7fd6a0; }

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px; /* keep anchored sections clear of the sticky header */
}

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

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

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

/* ---------- Scroll progress ---------- */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 200;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent), #d98f9a);
  box-shadow: 0 0 10px rgba(168, 50, 64, 0.4);
  transition: width 0.1s linear;
  will-change: width;
}

/* ---------- Typography ---------- */

h1 {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6.5vw, 4.6rem);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.05;
}

h1 em {
  font-style: italic;
  color: var(--accent);
}

h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.6vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-bottom: 16px;
}

h3 { font-size: 1.05rem; font-weight: 600; }

.eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.lead {
  font-size: 1.12rem;
  color: var(--ink-soft);
  max-width: 640px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 13px 28px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease,
    color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(168, 50, 64, 0.22);
}
.btn-primary:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(168, 50, 64, 0.28);
}

.btn-ghost {
  border-color: var(--line);
  color: var(--ink);
  background: transparent;
}
.btn-ghost:hover { border-color: var(--ink-faint); }

.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

:is(a, button, input, textarea):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  z-index: 200;
}
.skip-link:focus { left: 0; }

/* ---------- Header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(251, 246, 241, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  transition: box-shadow 0.25s ease;
}
.site-header.scrolled { box-shadow: 0 6px 18px rgba(34, 20, 24, 0.06); }

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.logo-mark {
  width: 30px;
  height: auto;
  flex-shrink: 0;
}
.logo-mark circle { mix-blend-mode: multiply; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.site-nav a:not(.btn) {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.18s ease;
}
.site-nav a:not(.btn):hover,
.site-nav a.active { color: var(--ink); }

.nav-cta { padding: 9px 20px; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-left: 6px;
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.theme-toggle:hover { border-color: var(--ink-faint); color: var(--ink); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 9px;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 110px 0 120px;
  text-align: center;
  background:
    radial-gradient(60% 55% at 50% 0%, var(--bg-tint) 0%, rgba(243, 228, 222, 0) 100%);
}

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

.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* Legibility scrim: keeps the headline crisp over the 3D brain (both themes). */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 56% 46% at 50% 44%,
    color-mix(in srgb, var(--bg) 80%, transparent) 0%,
    color-mix(in srgb, var(--bg) 36%, transparent) 46%,
    transparent 72%);
}

/* Faint echo of the three-circle logo mark, drifting slowly */
.hero-motif {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle 240px at 82% 88%, rgba(92, 31, 43, 0.06), transparent 70%);
}

.hero-motif::before,
.hero-motif::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
}
.hero-motif::before {
  width: 380px;
  height: 380px;
  left: -160px;
  top: -120px;
  background: rgba(158, 48, 64, 0.07);
  animation: drift 16s ease-in-out infinite alternate;
}
.hero-motif::after {
  width: 420px;
  height: 420px;
  right: -180px;
  top: 60px;
  background: rgba(197, 73, 90, 0.07);
  animation: drift 22s ease-in-out infinite alternate-reverse;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(46px, 34px, 0); }
}

.accent-dot { color: var(--accent); }

.hero h1 { max-width: 760px; margin: 0 auto; }

.hero-sub {
  font-size: 1.18rem;
  color: var(--ink-soft);
  max-width: 560px;
  margin: 22px auto 0;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 36px;
  flex-wrap: wrap;
}

.hero-fields {
  margin-top: 52px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- Sections ---------- */

.section { padding: 96px 0; }
.section-alt { background: var(--bg-alt); }

/* ---------- Stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 56px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}

.stat-number {
  display: block;
  font-family: var(--font-display);
  font-size: 2.7rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--accent);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--ink-faint);
}

/* ---------- Verticals ---------- */

.verticals {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 48px;
}
.verticals-3 { grid-template-columns: repeat(3, 1fr); }

.vertical {
  position: relative;
  overflow: hidden;
  display: block;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 30px;
  color: inherit;
  text-decoration: none;
  transform-style: preserve-3d;
}
.vertical > * { position: relative; z-index: 1; }

/* Cursor-following glow */
.vertical::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), rgba(168, 50, 64, 0.12), transparent 55%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.vertical:hover::after { opacity: 1; }

a.vertical:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.vertical-more {
  display: inline-block;
  margin-top: 18px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  transition: transform 0.18s ease;
}
a.vertical:hover .vertical-more { transform: translateX(4px); }
.verticals .vertical {
  transition: opacity 0.5s ease, transform 0.3s ease,
    border-color 0.18s ease, box-shadow 0.3s ease;
}
.vertical:hover {
  border-color: rgba(168, 50, 64, 0.45);
  transform: translateY(-3px);
  box-shadow: 0 16px 32px rgba(92, 31, 43, 0.08);
}
.vertical:hover .vertical-num { color: var(--accent); }

.vertical-wide { grid-column: 1 / -1; }

.vertical-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.vertical-num {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  transition: color 0.18s ease;
}

.icon {
  width: 46px;
  height: 46px;
  padding: 11px;
  color: var(--accent);
  background: var(--bg-tint);
  border-radius: 50%;
}

.vertical h3 { font-size: 1.15rem; margin-bottom: 4px; }

.vertical-tag {
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 8px;
}

.vertical-desc {
  font-size: 0.94rem;
  color: var(--ink-soft);
}

/* ---------- Spotlight ---------- */

.spotlight {
  position: relative;
  overflow: hidden;
  background: #2b1218 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.05'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.spotlight::before,
.spotlight::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.spotlight::before {
  width: 360px;
  height: 360px;
  right: -90px;
  top: -140px;
  background: rgba(197, 73, 90, 0.16);
}
.spotlight::after {
  width: 280px;
  height: 280px;
  right: 150px;
  bottom: -120px;
  background: rgba(158, 48, 64, 0.2);
}

.spotlight .container { position: relative; z-index: 1; }
.spotlight .eyebrow { color: #d98f9a; }
.spotlight h2 { color: #fbf6f1; }
.spotlight .lead { color: rgba(251, 246, 241, 0.8); }

.spotlight .btn-primary {
  background: var(--bg);
  color: var(--accent-dark);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}
.spotlight .btn-primary:hover {
  background: #f2e3da;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.3);
}

.spotlight-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 40px;
}

/* ---------- Ethics ---------- */

.ethics { padding: 72px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.ethics-line {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.55rem;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
  color: var(--ink);
}

/* ---------- Contact ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 56px;
  margin-top: 40px;
}

.form-field { margin-bottom: 18px; }

.form-field label {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 6px;
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 1rem; /* ≥16px so mobile browsers don't zoom on focus */
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.18s ease;
}

/* Honeypot: visually removed, still in the form for bots */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.form-field input:hover,
.form-field textarea:hover { border-color: var(--ink-faint); }

.form-field input.invalid,
.form-field textarea.invalid { border-color: #dc2626; }

.form-status {
  margin-top: 14px;
  font-size: 0.92rem;
  min-height: 1.4em;
}

.form-alt {
  margin-top: 10px;
  font-size: 0.88rem;
  color: var(--ink-faint);
}
.form-alt a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.form-alt a:hover { text-decoration: underline; }

.form-privacy {
  margin-top: 16px;
  font-size: 0.82rem;
  color: var(--ink-faint);
}
.form-privacy a {
  color: inherit;
  text-decoration: underline;
}
.form-privacy a:hover { color: var(--accent); }

/* ---------- Partner with us ---------- */
.partner-modes {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 28px 0 4px;
}
.partner-modes li {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}
.partner-modes strong { display: block; margin-bottom: 4px; }
.partner-modes span { font-size: 0.9rem; color: var(--ink-soft); }

.partner-form { max-width: 640px; margin-top: 28px; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.partner-form select {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.18s ease;
}
.partner-form select:hover { border-color: var(--ink-faint); }

@media (max-width: 640px) {
  .partner-modes { grid-template-columns: 1fr; }
  .form-2col { grid-template-columns: 1fr; }
}

/* ---------- Cite (BibTeX) ---------- */
.ref-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.ref-head h4 { margin-bottom: 0; }
.cite-btn {
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}
.cite-btn:hover { background: var(--bg-tint); border-color: var(--accent); }
.form-status.ok { color: #15803d; }
.form-status.error { color: #dc2626; }

.contact-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-content: start;
}

.info-block h3 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}

.info-block p { font-size: 0.95rem; color: var(--ink-soft); }

.info-block a {
  color: var(--accent);
  text-decoration: none;
}
.info-block a:hover { text-decoration: underline; }

/* ---------- Footer ---------- */

.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
  padding: 56px 0 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
}

.footer-brand p {
  margin-top: 12px;
  font-size: 0.92rem;
  color: var(--ink-soft);
  max-width: 300px;
}

.footer-brand p.footer-tagline {
  margin-top: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.footer-tagline + p { margin-top: 8px; }

.footer-links { display: flex; flex-direction: column; gap: 10px; }

.footer-links h3 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 4px;
}

.footer-links a {
  font-size: 0.92rem;
  color: var(--ink-soft);
  text-decoration: none;
}
.footer-links a:hover { color: var(--ink); }

.footer-bottom {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  padding-bottom: 20px;
}

.footer-bottom p {
  font-size: 0.85rem;
  color: var(--ink-faint);
}

/* ---------- Legal pages ---------- */

.legal-page { padding: 72px 0 96px; }

.legal-page .container { max-width: 760px; }

.legal-page h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: 8px; }

.back-link {
  display: inline-block;
  margin-bottom: 28px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}
.back-link:hover { text-decoration: underline; }

.legal-meta { color: var(--ink-faint); font-size: 0.9rem; margin-bottom: 40px; }

.legal-page h2 {
  font-size: 1.25rem;
  margin: 36px 0 10px;
}

.legal-page p, .legal-page li {
  color: var(--ink-soft);
  font-size: 0.97rem;
}

.legal-page ul { padding-left: 22px; margin: 10px 0; }

.legal-note {
  background: var(--bg-tint);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 0.9rem;
  margin-bottom: 40px;
}

/* ---------- Back to top ---------- */

.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(168, 50, 64, 0.3);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, background-color 0.18s ease;
}
.to-top.visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.to-top:hover { background: var(--accent-dark); }
.to-top svg { width: 20px; height: 20px; }

/* ---------- Project detail pages ---------- */

.project-page { padding: 64px 0 96px; }
.project-page .container { max-width: 820px; }

.project-hero { margin-bottom: 8px; }
.project-hero .icon-lg {
  width: 56px;
  height: 56px;
  padding: 14px;
  color: var(--accent);
  background: var(--bg-tint);
  border-radius: 50%;
  margin-bottom: 22px;
}
.project-hero h1 { margin-bottom: 18px; }
.project-lead {
  font-size: 1.2rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.project-purpose {
  margin: 40px 0 8px;
  padding: 28px 30px;
  background: var(--bg-alt);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.project-purpose h2 {
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.project-purpose p { color: var(--ink-soft); }
.project-purpose p + p { margin-top: 12px; }

.articles-head {
  margin: 64px 0 8px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.article-card {
  padding: 34px 0;
  border-top: 1px solid var(--line);
}
.article-card:last-of-type { border-bottom: 1px solid var(--line); }

.article-cat {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.article-card h3 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}
.article-body p { color: var(--ink-soft); margin-bottom: 14px; }

.references {
  margin-top: 22px;
  padding: 18px 20px;
  background: var(--bg-alt);
  border-radius: var(--radius);
}
.references h4 {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 10px;
}
.reference {
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.55;
  padding-left: 20px;
  text-indent: -20px;
}
.reference + .reference { margin-top: 10px; }
.reference a { color: var(--accent); text-decoration: none; word-break: break-word; }
.reference a:hover { text-decoration: underline; }
.reference cite { font-style: italic; }

.project-next {
  margin-top: 56px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.project-next p { color: var(--ink-soft); }
.project-next .next-links { display: flex; gap: 20px; flex-wrap: wrap; }
.project-next .next-links a { color: var(--accent); text-decoration: none; font-weight: 500; }
.project-next .next-links a:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .article-card h3 { font-size: 1.35rem; }
  .project-purpose { padding: 22px; }
}

/* ---------- Animated nav underline ---------- */

.site-nav a:not(.btn) { position: relative; }
.site-nav a:not(.btn)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.25s ease;
}
.site-nav a:not(.btn):hover::after,
.site-nav a:not(.btn).active::after { transform: scaleX(1); }

/* ---------- Project hero animated motifs ---------- */

.project-motif {
  width: 100%;
  max-width: 460px;
  height: auto;
  margin: 18px 0 2px;
  overflow: visible;
}
.motif-chat { max-width: 150px; }

.motif-edge {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-dasharray: 3 7;
  opacity: 0.4;
  animation: motif-flow 2.6s linear infinite;
}
@keyframes motif-flow { to { stroke-dashoffset: -20; } }

.motif-node {
  fill: var(--accent);
  transform-box: fill-box;
  transform-origin: center;
  animation: motif-pulse 2.4s ease-in-out infinite;
}
.motif-node:nth-of-type(2) { animation-delay: 0.3s; }
.motif-node:nth-of-type(3) { animation-delay: 0.6s; }
.motif-node:nth-of-type(4) { animation-delay: 0.9s; }
.motif-node:nth-of-type(5) { animation-delay: 1.2s; }
.motif-node:nth-of-type(6) { animation-delay: 1.5s; }
@keyframes motif-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); }
}

.motif-wave {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 6 8;
  animation: motif-flow 1.8s linear infinite;
}

.motif-bubble {
  fill: none;
  stroke: var(--accent);
  stroke-opacity: 0.4;
  stroke-width: 1.5;
}
.motif-dot {
  fill: var(--accent);
  transform-box: fill-box;
  transform-origin: center;
  animation: motif-bounce 1.3s ease-in-out infinite;
}
.motif-dot:nth-of-type(2) { animation-delay: 0.18s; }
.motif-dot:nth-of-type(3) { animation-delay: 0.36s; }
@keyframes motif-bounce {
  0%, 100% { opacity: 0.4; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-5px); }
}

/* ---------- Ecosystem cards ---------- */

.eco-intro {
  color: var(--ink-soft);
  margin: 4px 0 24px;
  max-width: 640px;
}
.ecosystem {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.eco-card {
  display: block;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.eco-card:hover {
  border-color: rgba(168, 50, 64, 0.45);
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(92, 31, 43, 0.08);
}
.eco-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.eco-card p { font-size: 0.92rem; color: var(--ink-soft); margin-bottom: 14px; }
.eco-link { font-size: 0.85rem; font-weight: 600; color: var(--accent); }

.spotlight-eco {
  margin-top: 18px;
  font-size: 0.95rem;
  color: rgba(251, 246, 241, 0.8);
}
.spotlight-eco a {
  color: #e8a9b2;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.spotlight-eco a:hover { color: #fff; }

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

/* ---------- Connectome explorer ---------- */

.explorer {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  align-items: stretch;
  margin-top: 16px;
}
.explorer-stage {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
}
.explorer-stage svg { width: 100%; height: auto; display: block; overflow: visible; }

.exp-edge {
  stroke: var(--ink-faint);
  stroke-opacity: 0.3;
  stroke-width: 1.4;
  transition: stroke 0.2s, stroke-opacity 0.2s, stroke-width 0.2s;
}
.exp-edge.active { stroke: var(--accent); stroke-opacity: 0.9; stroke-width: 2.2; }

.exp-node { cursor: pointer; transition: opacity 0.2s; }
.exp-node-dot { fill: var(--accent); transition: fill 0.2s, r 0.2s; }
.exp-node:focus { outline: none; }
.exp-node:focus-visible .exp-node-dot { stroke: var(--ink); stroke-width: 2; }
.exp-node.selected .exp-node-dot { fill: var(--accent-dark); }
.exp-node.dim { opacity: 0.3; }
.exp-label {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  fill: var(--ink-soft);
  pointer-events: none;
}
.exp-node.selected .exp-label { fill: var(--ink); font-weight: 600; }

.explorer-panel {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
}
.exp-hint { color: var(--ink-faint); }
.exp-region { font-family: var(--font-display); font-size: 1.4rem; font-weight: 500; margin-bottom: 8px; }
.exp-blurb { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 14px; }
.exp-count { font-weight: 600; color: var(--accent); margin-bottom: 10px; }
.exp-conns { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.exp-conns li {
  font-size: 0.8rem;
  background: var(--bg-tint);
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--ink-soft);
}

/* ---------- Research hub ---------- */

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 28px; }
.filter-btn {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.filter-btn:hover { border-color: var(--ink-faint); color: var(--ink); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.research-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.research-card {
  display: flex;
  flex-direction: column;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.research-card:hover {
  border-color: rgba(168, 50, 64, 0.45);
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(92, 31, 43, 0.08);
}
.rc-project {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.rc-cat { font-size: 0.8rem; color: var(--ink-faint); margin-bottom: 6px; }
.research-card h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: 10px;
}
.research-card p { font-size: 0.92rem; color: var(--ink-soft); margin-bottom: 16px; flex: 1; }
.rc-more { font-size: 0.88rem; font-weight: 600; color: var(--accent); }
.research-empty { color: var(--ink-faint); margin-top: 20px; }

/* ---------- 404 ---------- */

.notfound { padding: 96px 0 110px; text-align: center; }
.notfound .container { max-width: 640px; }
.notfound .lead { margin: 16px auto 0; }
.notfound .hero-actions { justify-content: center; margin-top: 32px; }
.notfound-motif { width: 200px; height: auto; margin: 0 auto 24px; display: block; }

/* ---------- Spotlight read link ---------- */

.spotlight-readlink {
  display: inline-block;
  margin-left: 18px;
  color: #f2e3da;
  font-weight: 600;
  text-decoration: none;
}
.spotlight-readlink:hover { color: #fff; text-decoration: underline; }

@media (max-width: 720px) {
  .explorer { grid-template-columns: 1fr; }
  .research-grid { grid-template-columns: 1fr; }
  .spotlight-readlink { display: block; margin-left: 0; margin-top: 12px; }
}

/* ---------- Scrollytelling: signal to thought ---------- */

/* How a thought forms — compact self-playing explainer (one screen) */
.how { padding: 96px 0; }
.how-panel {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
  align-items: center;
  margin-top: 32px;
  padding: 32px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.how-graphic { display: flex; align-items: center; justify-content: center; }
.how-graphic svg { width: 100%; max-width: 440px; overflow: visible; }

.sc-edge {
  stroke: var(--line);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 5 6;
  transition: stroke 0.45s ease, stroke-opacity 0.45s ease;
}
.sc-edge.on { stroke: var(--accent); stroke-opacity: 0.85; animation: motif-flow 1.6s linear infinite; }
.sc-dot { fill: var(--bg); stroke: var(--ink-faint); stroke-width: 2; transition: fill 0.45s ease, stroke 0.45s ease; }
.sc-node.on .sc-dot { fill: var(--accent); stroke: var(--accent); }
.sc-node.current .sc-dot { filter: drop-shadow(0 0 8px rgba(168, 50, 64, 0.6)); }
.sc-label { font-family: var(--font); font-size: 12px; font-weight: 500; fill: var(--ink-faint); transition: fill 0.45s ease; }
.sc-node.on .sc-label { fill: var(--ink); font-weight: 600; }
.how-pulse { fill: var(--accent); filter: drop-shadow(0 0 6px rgba(168, 50, 64, 0.75)); transition: opacity 0.3s ease; }

.how-caption { min-height: 210px; }
.how-num {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 500;
  color: var(--accent);
  display: block;
  line-height: 1;
  margin-bottom: 10px;
}
.how-caption h3 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: 10px;
}
.how-caption p { color: var(--ink-soft); font-size: 1.05rem; }
.how-num, .how-caption h3, .how-caption p { transition: opacity 0.28s ease; }
.how-caption.swap .how-num, .how-caption.swap h3, .how-caption.swap p { opacity: 0; }

.how-dots { display: flex; gap: 10px; margin-top: 26px; }
.how-dot {
  width: 28px; height: 8px; padding: 0;
  border: none; border-radius: 999px;
  background: var(--line);
  cursor: pointer;
  transition: background 0.25s ease, width 0.25s ease;
}
.how-dot:hover { background: var(--ink-faint); }
.how-dot.active { background: var(--accent); width: 42px; }

/* ---------- Emotion map playground ---------- */

.emomap { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center; margin-top: 16px; }
.emomap-stage { background: var(--bg-alt); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.emomap-stage svg { width: 100%; height: auto; display: block; touch-action: none; }
.emo-axis { stroke: var(--line); stroke-width: 1.5; }
.emo-axis-label { font-family: var(--font); font-size: 11px; font-weight: 500; fill: var(--ink-faint); }
.emo-ring { fill: none; stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 3 5; }
.emo-handle { fill: var(--accent); stroke: #fff; stroke-width: 3; cursor: grab; filter: drop-shadow(0 4px 10px rgba(168, 50, 64, 0.35)); }
.emo-handle:active { cursor: grabbing; }
.emomap-stage svg:focus { outline: none; }
.emomap-stage svg:focus-visible .emo-handle { stroke: var(--ink); }

.emomap-panel { text-align: center; }
.emo-face { width: 130px; height: 130px; margin: 0 auto 18px; display: block; }
.emo-face-bg { fill: var(--bg-tint); }
.emo-eye { fill: var(--ink); }
.emo-mouth { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; }
.emo-name { font-family: var(--font-display); font-size: 2rem; font-weight: 500; margin-bottom: 4px; }
.emo-sub { color: var(--ink-faint); font-size: 0.9rem; }
.emo-readout { margin-top: 14px; font-size: 0.85rem; color: var(--ink-soft); }
.emo-readout b { color: var(--accent); }

/* ---------- Companion chat demo ---------- */

.chatdemo { max-width: 560px; margin-top: 16px; }
.chat-window {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
  overflow: hidden;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-alt);
}
.chat-avatar { width: 30px; height: 30px; flex-shrink: 0; }
.chat-head b { font-size: 0.95rem; }
.chat-head span { font-size: 0.78rem; color: var(--ink-faint); }
.chat-log { padding: 18px; display: flex; flex-direction: column; gap: 12px; min-height: 220px; max-height: 360px; overflow-y: auto; }
.chat-msg { max-width: 82%; padding: 11px 15px; border-radius: 16px; font-size: 0.95rem; line-height: 1.45; }
.chat-msg.bot { align-self: flex-start; background: var(--bg-tint); color: var(--ink); border-bottom-left-radius: 5px; }
.chat-msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.chat-typing { align-self: flex-start; display: inline-flex; gap: 5px; padding: 14px 16px; background: var(--bg-tint); border-radius: 16px; border-bottom-left-radius: 5px; }
.chat-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint);
  animation: motif-bounce 1.3s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.18s; }
.chat-typing span:nth-child(3) { animation-delay: 0.36s; }
.chat-prompts { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 18px; }
.chat-prompt {
  font: inherit; font-size: 0.85rem; font-weight: 500;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); color: var(--accent);
  cursor: pointer; transition: background-color 0.18s ease, border-color 0.18s ease;
}
.chat-prompt:hover { background: var(--bg-tint); border-color: var(--accent); }
.chat-note { font-size: 0.8rem; color: var(--ink-faint); margin-top: 12px; }

@media (max-width: 720px) {
  .how { padding: 64px 0; }
  .how-panel { grid-template-columns: 1fr; gap: 18px; padding: 22px; }
  .how-caption { min-height: 168px; }
  .emomap { grid-template-columns: 1fr; }
}

/* ---------- Newsletter signup ---------- */

.signup { border-top: 1px solid var(--line); }
.signup-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 44px;
  align-items: center;
}
.signup-copy .lead { margin-top: 8px; }
.signup-row { display: flex; gap: 10px; flex-wrap: wrap; }
.signup-row input {
  flex: 1;
  min-width: 220px;
  padding: 14px 18px;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color 0.18s ease;
}
.signup-row input:hover { border-color: var(--ink-faint); }
.signup-row input.invalid { border-color: #dc2626; }
.signup-fine { margin-top: 12px; font-size: 0.8rem; color: var(--ink-faint); }
.signup-fine a { color: var(--accent); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Read + exploration progress ---------- */

.read-progress { font-size: 0.92rem; color: var(--ink-soft); margin: 0 0 22px; }
.rc-read {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #15803d;
  background: #eaf5ee;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.research-card.is-read { border-color: rgba(21, 128, 61, 0.35); }
.exp-progress { margin-top: 16px; font-size: 0.92rem; color: var(--ink-soft); }
.exp-progress.complete { color: var(--accent); font-weight: 600; }

/* ---------- Touch: larger tap targets on coarse pointers ---------- */

@media (pointer: coarse) {
  .chat-prompt { padding: 11px 16px; }
  .filter-btn { padding: 11px 18px; }
  .footer-links a { padding: 7px 0; }
  .site-nav a:not(.btn) { padding-top: 14px; padding-bottom: 14px; }
  .exp-hint::after { content: " — tap a region to explore."; }
}

/* ---------- Safe-area insets (notched phones) ---------- */

.site-header .nav-wrap {
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}
.site-footer { padding-bottom: env(safe-area-inset-bottom); }

/* ---------- Reveal animation ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .contact-grid { grid-template-columns: 1fr; gap: 48px; }
  .spotlight-inner { grid-template-columns: 1fr; gap: 24px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .section { padding: 72px 0; }
  .hero { padding: 80px 0 88px; }

  .nav-toggle { display: flex; }

  .site-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 8px 24px 16px;
  }
  .site-nav.open { display: flex; box-shadow: 0 12px 24px rgba(34, 20, 24, 0.08); }
  .site-nav a:not(.btn) { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .site-nav .nav-cta { margin-top: 14px; text-align: center; }

  .verticals { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; gap: 20px; }
  .contact-info { grid-template-columns: 1fr; }

  .hero-fields {
    font-size: 0.68rem;
    line-height: 2.1;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
  }

  .to-top {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
  }

  .signup-inner { grid-template-columns: 1fr; gap: 20px; }
}
