/* ==========================================================================
   Elements of fMRI — landing page styles
   "Warm paper, neural signal": light, warm, editorial.
   Fraunces (display) + Inter (text). Amber reserved for energy/interaction.
   ========================================================================== */

:root {
  --bg: #faf8f4;
  --bg-2: #f2efe8;
  --bg-3: #e9edf0;
  --ink: #1a2332;
  --ink-2: #3a4049;
  --muted: #646b75;
  --line: #e3dfd6;
  --line-2: #d3cfc6;
  --amber: #e9b949;
  --amber-deep: #c7931a;
  --amber-soft: #fbf0d0;
  --steel: #6f8fb0;
  --steel-soft: #e3ebf3;
  --white: #ffffff;
  --shadow: 0 1px 2px rgba(26,35,50,.04), 0 12px 32px -12px rgba(26,35,50,.16);
  --radius: 18px;
  --max: 1180px;
  --pad: clamp(20px, 4vw, 48px);
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(.2,.7,.2,1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
p a, li a, dd a { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; transition: text-decoration-color .2s; }
p a:hover, li a:hover, dd a:hover { text-decoration-color: var(--amber-deep); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; line-height: 1.1; margin: 0 0 .5em; }
h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); font-variation-settings: "opsz" 144, "SOFT" 40; }
h2 { font-size: clamp(2rem, 3.6vw, 3rem); font-variation-settings: "opsz" 96; }
h3 { font-size: clamp(1.3rem, 2vw, 1.6rem); }
.lede { font-size: clamp(1.12rem, 1.6vw, 1.35rem); color: var(--ink-2); line-height: 1.5; max-width: 42em; }
.muted { color: var(--muted); }
.eyebrow {
  font-family: var(--sans); font-size: .78rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--amber-deep); margin: 0 0 1rem; display: inline-flex; align-items: center; gap: .6em;
}
.eyebrow::before { content: ""; width: 26px; height: 1px; background: var(--amber-deep); }
.wrap { max-width: var(--max); margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: .55em; padding: .85em 1.5em; border-radius: 999px;
  font-weight: 600; font-size: .95rem; border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s, border-color .25s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--ink); color: var(--white); box-shadow: 0 8px 20px -10px rgba(26,35,50,.5); }
.btn-primary:hover { background: #2b3648; }
.btn-amber { background: var(--amber); color: var(--ink); box-shadow: 0 10px 24px -10px rgba(199,147,26,.7); }
.btn-amber:hover { background: #f0c45b; }
.btn-ghost { background: rgba(255,255,255,.55); border-color: var(--line-2); color: var(--ink); backdrop-filter: blur(8px); }
.btn-ghost:hover { border-color: var(--ink); }
.btn svg { width: 1em; height: 1em; }

/* Header */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: 72px;
  display: flex; align-items: center; transition: background .35s, box-shadow .35s;
}
.site-header .wrap { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.site-header.scrolled { background: rgba(250,248,244,.85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 1px 0 var(--line); }
.brand { font-family: var(--serif); font-size: 1.12rem; display: flex; align-items: center; gap: .55em; }
.brand span b { font-weight: 600; }
.nav { display: flex; gap: .2rem; align-items: center; }
.nav a { padding: .55em .9em; border-radius: 999px; font-size: .92rem; font-weight: 500; color: var(--ink-2); transition: background .2s, color .2s; }
.nav a:hover { background: rgba(26,35,50,.06); color: var(--ink); }
.nav a.cta { background: var(--amber); color: var(--ink); font-weight: 600; margin-left: .5rem; }
.nav a.cta:hover { background: #f0c45b; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line-2); border-radius: 999px; width: 42px; height: 42px; cursor: pointer; align-items: center; justify-content: center; }
.nav-toggle span { display: block; width: 18px; height: 2px; background: var(--ink); position: relative; }
.nav-toggle span::before, .nav-toggle span::after { content: ""; position: absolute; left: 0; width: 18px; height: 2px; background: var(--ink); }
.nav-toggle span::before { top: -6px; } .nav-toggle span::after { top: 6px; }
@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .nav { position: fixed; top: 72px; left: 0; right: 0; background: rgba(250,248,244,.97); backdrop-filter: blur(14px);
    flex-direction: column; align-items: stretch; padding: .6rem var(--pad) 1.2rem; border-bottom: 1px solid var(--line);
    transform: translateY(-8px); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
  .nav.open { opacity: 1; transform: none; pointer-events: auto; }
  .nav a.cta { margin: .5rem 0 0; text-align: center; justify-content: center; display: flex; }
}

/* Sticky-curtain parallax */
.curtain { position: relative; }
.curtain-media {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; z-index: 0;
  background: linear-gradient(160deg, #faf8f4 0%, #f3f2ee 55%, #e9edf0 100%);
}
.curtain-media .hero-copy { position: absolute; inset: 0; display: flex; align-items: center; z-index: 2; pointer-events: none; }
.curtain-media .hero-copy .wrap { width: 100%; }
.curtain-media .hero-copy a, .curtain-media .hero-copy button { pointer-events: auto; }
.curtain-body { position: relative; z-index: 1; background: var(--bg); box-shadow: 0 -30px 60px -30px rgba(26,35,50,.18); border-top: 1px solid rgba(255,255,255,.7); }
.curtain-body::before { content: ""; display: block; height: 6px; background: linear-gradient(90deg, var(--amber), var(--amber-soft)); opacity: .9; }
@media (prefers-reduced-motion: reduce) { .curtain-media { position: relative; height: 78vh; } }

/* Hero */
#brainmesh { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.hero-copy h1 { max-width: 10.5em; margin-bottom: .35em; }
.hero-copy .authors { font-family: var(--serif); font-size: 1.15rem; color: var(--ink-2); margin: 0 0 1.1rem; }
.hero-copy .lede { margin: 0 0 1.6rem; max-width: 30em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; }
.hero-pill { display: inline-flex; align-items: center; gap: .6em; padding: .45em 1em .45em .6em; border-radius: 999px; background: rgba(255,255,255,.7); border: 1px solid var(--line); font-size: .9rem; font-weight: 500; margin-bottom: 1.4rem; backdrop-filter: blur(6px); }
.hero-pill .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(233,185,73,.25); }
.hero-hint { position: absolute; right: var(--pad); bottom: 30px; z-index: 2; font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: .5em; pointer-events: none; }
.hero-hint .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); animation: pulse 2.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(233,185,73,.6);} 70% { box-shadow: 0 0 0 10px rgba(233,185,73,0);} }
@media (max-width: 720px) { .hero-hint { display: none; } .hero-copy { align-items: flex-end; } .hero-copy .wrap { padding-bottom: 84px; } }

.scroll-cue { position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%); z-index: 3; }
.scroll-cue a {
  display: inline-flex; align-items: center; gap: .6em; padding: .7em 1.3em; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: .8rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  box-shadow: 0 12px 28px -10px rgba(26,35,50,.55); transition: transform .3s var(--ease), background .3s;
}
.scroll-cue a:hover { transform: translateY(-2px); background: #2b3648; }
.scroll-cue a svg { width: 16px; height: 16px; animation: nudge 1.8s infinite; }
@keyframes nudge { 0%,100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

/* Sections */
.section { padding: clamp(64px, 9vw, 120px) 0; }
.section-tight { padding: clamp(40px, 6vw, 72px) 0; }
.section-head { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: clamp(32px, 4vw, 56px); align-items: end; }
@media (min-width: 900px) { .section-head { grid-template-columns: 1.1fr 1fr; gap: 3rem; } }
.section-head p { margin: 0; }
.grid-2 { display: grid; gap: 2.5rem; grid-template-columns: 1fr; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.stack > * + * { margin-top: 1rem; }

/* Facts row */
.facts { display: grid; gap: 1.5rem; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 2rem 0; }
@media (min-width: 760px) { .facts { grid-template-columns: repeat(4, 1fr); } }
.facts dt { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: .35rem; }
.facts dd { margin: 0; font-family: var(--serif); font-size: 1.4rem; line-height: 1.2; }

/* Part tiles */
.tiles { display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1020px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 250px;
  padding: 1.8rem; border-radius: var(--radius); background: var(--white); border: 1px solid var(--line);
  box-shadow: var(--shadow); overflow: hidden; transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s;
}
.tile:hover { transform: translateY(-6px); box-shadow: 0 2px 4px rgba(26,35,50,.04), 0 28px 48px -20px rgba(26,35,50,.25); border-color: var(--line-2); }
.tile .num { font-family: var(--serif); font-size: 2.9rem; line-height: 1; color: var(--line-2); font-weight: 300; transition: color .35s; }
.tile:hover .num { color: var(--amber); }
.tile h3 { margin: .9rem 0 .35rem; }
.tile p { margin: 0 0 1.2rem; color: var(--muted); font-size: .95rem; }
.tile .go { display: inline-flex; align-items: center; gap: .5em; font-weight: 600; font-size: .92rem; }
.tile .go svg { width: 18px; height: 18px; transition: transform .3s var(--ease); }
.tile:hover .go svg { transform: translateX(4px); }

/* Glowing "neural energy" tile border (amber impulse orbits on hover) */
@property --glow-angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.glow { position: relative; isolation: isolate; }
.glow::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 2px; z-index: 1; pointer-events: none;
  background: conic-gradient(from var(--glow-angle), transparent 0deg, transparent 250deg, rgba(233,185,73,.25) 290deg, #e9b949 330deg, #fff3c4 345deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .35s;
}
.glow::after {
  content: ""; position: absolute; inset: -2px; border-radius: inherit; z-index: 0; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(233,185,73,.35), 0 0 32px -6px rgba(233,185,73,.55); opacity: 0; transition: opacity .35s;
}
.glow:hover::before, .glow:focus-within::before { opacity: 1; animation: glow-run 1.7s linear infinite; }
.glow:hover::after, .glow:focus-within::after { opacity: 1; }
@keyframes glow-run { to { --glow-angle: 360deg; } }
@supports not (background: conic-gradient(from var(--glow-angle), red, blue)) {
  .glow:hover::before { animation: none; background: linear-gradient(120deg, transparent, #e9b949, transparent); }
}
@media (prefers-reduced-motion: reduce) { .glow:hover::before { animation: none; } }
.glow > * { position: relative; z-index: 2; }

/* Run-the-code strip */
.ways { display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
@media (min-width: 820px) { .ways { grid-template-columns: repeat(3, 1fr); } }
.way { padding: 1.6rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.way .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--amber-soft); color: var(--amber-deep); font-size: 1.3rem; margin-bottom: 1rem; }
.way h3 { font-family: var(--sans); font-weight: 600; font-size: 1.05rem; margin-bottom: .35rem; }
.way p { margin: 0; color: var(--muted); font-size: .95rem; }

/* Dark strip (the book) */
.bookstrip { background: var(--ink); color: #eef0f3; }
.bookstrip h2 { color: #fff; }
.bookstrip .muted { color: #a9b0ba; }
.bookstrip a.btn-amber { box-shadow: none; }

/* Scroll reveal */
.rv { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.rv.in { opacity: 1; transform: none; }
.rv-d1 { transition-delay: .1s; } .rv-d2 { transition-delay: .2s; } .rv-d3 { transition-delay: .3s; }
@media (prefers-reduced-motion: reduce) { .rv { opacity: 1; transform: none; transition: none; } .tile { transition: none; } }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 3rem 0 2.5rem; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .site-footer .wrap { grid-template-columns: 1.4fr 1fr 1fr; } }
.site-footer strong { color: var(--ink); font-weight: 600; display: block; margin-bottom: .4rem; }
.site-footer a { color: var(--ink-2); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: .3rem 0; }
::selection { background: var(--amber-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Book strip with cover */
.bookstrip-grid { display: grid; gap: 2.5rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 860px) { .bookstrip-grid { grid-template-columns: 220px 1fr; gap: 3.5rem; } }
.book-cover { display: block; max-width: 220px; margin: 0 auto; }
.book-cover img { border-radius: 6px; box-shadow: 0 18px 44px -16px rgba(0,0,0,.6); transition: transform .4s var(--ease); }
.book-cover:hover img { transform: translateY(-5px) rotate(-1deg); }
