/* ==========================================================================
   Prefana — site-wide design system (master brief Part A)
   Tokens, typography, grain, nav/footer + homepage components.
   ========================================================================== */

:root {
  --ember-black: #0A0806;
  --ember-card: #1A1512;
  --ember-border: #2E2620;
  --bone: #F7F3EE;
  --warm-muted: #9A908A;
  --signal-coral: #FF7A45;
  --ember-amber: #FFB03A;

  /* data-viz ramp (cold → hot) */
  --ramp-1: #3A2E27;
  --ramp-2: #6B4232;
  --ramp-3: #A5502F;
  --ramp-4: #D85A30;
  --ramp-5: #FF7A45;
  --ramp-6: #FFB03A;

  --dot-dim: #4A4038;
  --dot-mid: #6B5A4C;
  --dot-faint: #3A322B;

  --pad-x: clamp(20px, 5vw, 64px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--ember-black);
  color: var(--bone);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--signal-coral); color: #2A0E04; }

img, svg, video { max-width: 100%; height: auto; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--signal-coral);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--signal-coral); color: #2A0E04;
  padding: 10px 18px; border-radius: 0 0 8px 0;
  font-size: 14px; text-decoration: none;
}
.skip-link:focus-visible { left: 0; }

/* ---- the Murmuration (Part B): fixed universe behind the homepage ---- */
#murmuration {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; display: block;
  opacity: 0; transition: opacity 1.2s ease;
}
#murmuration.in { opacity: 1; }
/* when the 3D universe is live: retire the 2D fallback field + static logo,
   and give text-heavy sections a subtle scrim for contrast (B1) */
.three-on .hero canvas.ambient { display: none; }
.three-on .final .logo-big { visibility: hidden; }
.three-on #why::before,
.three-on #validation::before,
.three-on #capability::before,
.three-on #ask::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(ellipse 92% 86% at 50% 50%, rgba(10, 8, 6, .62), transparent 78%);
}

/* ---- film grain (A2 anti-generic mandate) ---- */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 50;
  opacity: .045; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='128' height='128' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Type roles (A3)
   ========================================================================== */

h1 {
  font-size: clamp(44px, 8.4vw, 112px);
  font-weight: 500;
  letter-spacing: -.022em;
  line-height: 1.02;
}
h1 .c { color: var(--signal-coral); }

h2 {
  font-size: clamp(32px, 4.4vw, 56px);
  font-weight: 500;
  letter-spacing: -.018em;
  line-height: 1.1;
}

.eyebrow {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--signal-coral);
  margin-bottom: 22px;
}

/* ==========================================================================
   Announcement bar (C1)
   ========================================================================== */

.announce {
  position: relative; z-index: 5;
  text-align: center;
  font-size: 13px; letter-spacing: .4px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--ember-border);
  color: var(--warm-muted);
}
.announce a { color: var(--signal-coral); text-decoration: none; }
.announce a:hover { text-decoration: underline; }

/* ==========================================================================
   Nav (C2)
   ========================================================================== */

nav.site-nav {
  position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px var(--pad-x);
}

.brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--bone);
}
.brand svg { display: block; }
.brand span {
  font-size: 21px; font-weight: 500; letter-spacing: -.5px;
  text-transform: lowercase;
}

.navlinks { display: flex; gap: 32px; align-items: center; }
.navlinks a:not(.pill) {
  color: var(--warm-muted); text-decoration: none; font-size: 15px;
  position: relative; transition: color .25s;
}
.navlinks a:not(.pill):hover,
.navlinks a:not(.pill):focus-visible,
.navlinks a[aria-current="page"] { color: var(--bone); }
.navlinks a:not(.pill)::after {
  content: ""; position: absolute; left: 0; bottom: -4px;
  width: 0; height: 1px; background: var(--signal-coral);
  transition: width .25s;
}
.navlinks a:not(.pill):hover::after { width: 100%; }

/* pills */
.pill {
  display: inline-block;
  background: var(--signal-coral); color: #2A0E04;
  font-weight: 500; font-size: 14px;
  padding: 9px 20px; border-radius: 999px;
  text-decoration: none; border: 0; cursor: pointer;
  font-family: inherit;
  transition: transform .2s ease, box-shadow .2s ease;
}
.pill:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(255, 122, 69, .25); }
.pill.ghost { background: transparent; color: var(--bone); border: 1px solid var(--ember-border); }
.pill.ghost:hover { border-color: var(--dot-dim); box-shadow: none; }

/* mobile menu */
.menu-btn {
  display: none;
  background: transparent; border: 1px solid var(--ember-border);
  color: var(--bone); border-radius: 8px;
  width: 40px; height: 40px; cursor: pointer;
  align-items: center; justify-content: center;
}
.menu-btn svg { display: block; }

.mobile-menu {
  display: none;
  position: absolute; top: 100%; left: 0; right: 0; z-index: 40;
  background: var(--ember-card);
  border-top: 1px solid var(--ember-border);
  border-bottom: 1px solid var(--ember-border);
  padding: 10px var(--pad-x) 22px;
}
.mobile-menu.open { display: block; }
.mobile-menu a {
  display: block; padding: 12px 0;
  color: var(--bone); text-decoration: none; font-size: 17px;
  border-bottom: 1px solid var(--ember-border);
}
.mobile-menu a:last-child { border-bottom: 0; }
.mobile-menu a:hover { color: var(--signal-coral); }

@media (max-width: 760px) {
  .navlinks a:not(.pill) { display: none; }
  .menu-btn { display: flex; }
}
@media (min-width: 761px) {
  .mobile-menu { display: none !important; }
}
@media (max-width: 420px) {
  .navlinks .pill { display: none; }  /* hero + announce still carry the CTA */
}

/* ==========================================================================
   Hero (C3)
   ========================================================================== */

header.hero {
  position: relative;
  min-height: 92vh;
  display: flex; align-items: center;
  padding: 0 var(--pad-x);
}

canvas.ambient {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
}
canvas.ambient.in { opacity: 1; }

.hero-scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 60% at 38% 50%, rgba(10, 8, 6, .72), rgba(10, 8, 6, .15) 65%, transparent),
    linear-gradient(to bottom, transparent 70%, var(--ember-black));
}

.hero-inner { position: relative; z-index: 2; max-width: 1100px; }
.hero .sub {
  max-width: 52ch;
  color: var(--warm-muted);
  margin: 26px 0 36px;
  font-size: clamp(16px, 1.3vw, 19px);
}
.ctas { display: flex; gap: 14px; flex-wrap: wrap; }
.ctas .pill { font-size: 16px; padding: 13px 28px; }

.scrollcue {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 2; color: var(--warm-muted);
  font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  opacity: .7;
}

/* hero load-in (C3 sequence) */
.li { opacity: 0; transform: translateY(18px); animation: liUp .8s cubic-bezier(.22, .8, .3, 1) forwards; }
.d1 { animation-delay: .1s }
.d2 { animation-delay: .25s }
.d3 { animation-delay: .5s }
.d4 { animation-delay: .65s }
@keyframes liUp { to { opacity: 1; transform: none } }

/* ==========================================================================
   Sections, reveals, dot motif
   ========================================================================== */

main { display: block; }

section { position: relative; z-index: 2; padding: clamp(72px, 10vw, 140px) var(--pad-x); }
.wrap { max-width: 1180px; margin: 0 auto; }

/* scroll reveal (Part E: fade + 32px translate-up).
   Gated on html.js so content stays visible when JS is off. */
.js .rv { opacity: 0; transform: translateY(32px); transition: opacity .7s cubic-bezier(.22, .8, .3, 1), transform .7s cubic-bezier(.22, .8, .3, 1); }
.js .rv.on { opacity: 1; transform: none; }

/* dot divider (A4 motif: sparse scatter, one coral) */
.dotdiv {
  display: flex; gap: 14px; align-items: center; justify-content: center;
  padding: 0 0 clamp(48px, 6vw, 80px);
}
.dotdiv i { width: 4px; height: 4px; border-radius: 50%; background: var(--dot-dim); display: block; }
.dotdiv i:nth-child(odd) { transform: translateY(-3px); }
.dotdiv i.c { background: var(--signal-coral); width: 6px; height: 6px; transform: translateY(2px); }

/* ==========================================================================
   Demo widget — "Ask the population" (C4, Stage 1)
   ========================================================================== */

.widget {
  background: var(--ember-card);
  border: 1px solid var(--ember-border);
  border-radius: 16px;
  display: grid; grid-template-columns: 1.2fr 1fr;
  gap: clamp(24px, 4vw, 56px);
  padding: clamp(28px, 4vw, 52px);
  transition: border-color .25s;
}
.widget:hover { border-color: var(--dot-dim); }
@media (max-width: 860px) { .widget { grid-template-columns: 1fr; } }

.wq-label {
  font-size: 12px; font-weight: 500; letter-spacing: 3px; text-transform: uppercase;
  color: var(--warm-muted); margin-bottom: 18px;
}
#cycleQ {
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 500; letter-spacing: -.5px; line-height: 1.2;
  min-height: 3.6em;
  transition: opacity .4s;
}
.wq-cta {
  margin-top: 26px; display: inline-block;
  color: var(--signal-coral); text-decoration: none; font-size: 15px;
  position: relative;
}
.wq-cta::after {
  content: ""; position: absolute; left: 0; bottom: -3px;
  width: 0; height: 1px; background: var(--signal-coral); transition: width .25s;
}
.wq-cta:hover::after { width: 100%; }

.result {
  background: rgba(10, 8, 6, .5);
  border: 1px solid var(--ember-border);
  border-radius: 12px;
  padding: 22px 24px;
}
.result .cap { font-size: 12px; color: var(--warm-muted); margin-bottom: 16px; }
.bar-row { margin-bottom: 12px; }
.bar-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.bar-top b { font-weight: 500; }
.track { height: 6px; background: #241D18; border-radius: 3px; overflow: hidden; }
.fill { height: 100%; border-radius: 3px; width: 0; transition: width 1s cubic-bezier(.22, .8, .3, 1); }
.insight { font-size: 14px; color: var(--warm-muted); margin-top: 16px; line-height: 1.5; }
.insight .note { color: #837A70; }

/* ==========================================================================
   Pillars (C5)
   ========================================================================== */

.pillars {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: clamp(36px, 5vw, 72px);
  margin-top: clamp(48px, 6vw, 80px);
}
@media (max-width: 860px) { .pillars { grid-template-columns: 1fr; } }

.pillar h3 { font-size: clamp(20px, 2vw, 24px); font-weight: 500; letter-spacing: -.3px; margin-bottom: 12px; }
.pillar p { color: var(--warm-muted); font-size: 16px; }
.pillar .pd { display: flex; gap: 8px; margin-bottom: 18px; }
.pillar .pd i { width: 5px; height: 5px; border-radius: 50%; background: var(--dot-dim); }
.pillar .pd i:first-child { background: var(--signal-coral); }

/* ==========================================================================
   Validation (C6)
   ========================================================================== */

.validation .big {
  font-size: clamp(28px, 3.8vw, 50px);
  font-weight: 500; letter-spacing: -.015em; line-height: 1.18;
  max-width: 24ch;
}
.validation .big em { font-style: normal; color: var(--signal-coral); white-space: nowrap; }
.validation .small { color: var(--warm-muted); margin: 26px 0 30px; font-size: 18px; }

/* ==========================================================================
   Capability stats (C7)
   ========================================================================== */

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px;
  border-top: 1px solid var(--ember-border);
  border-bottom: 1px solid var(--ember-border);
  padding: clamp(36px, 4vw, 56px) 0;
}
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat b { display: block; font-size: clamp(30px, 3.4vw, 46px); font-weight: 500; letter-spacing: -1px; }
.stat span { color: var(--warm-muted); font-size: 14px; }

/* ==========================================================================
   Murmur teaser (C8)
   ========================================================================== */

.teaser {
  display: flex; align-items: center; justify-content: space-between; gap: 40px;
  background: var(--ember-card);
  border: 1px solid var(--ember-border);
  border-radius: 16px;
  padding: clamp(28px, 4vw, 52px);
  transition: border-color .25s, transform .25s;
}
.teaser:hover { border-color: var(--dot-dim); transform: translateY(-2px); }
@media (max-width: 860px) { .teaser { flex-direction: column; align-items: flex-start; } }
.teaser-copy { display: flex; gap: clamp(18px, 3vw, 30px); align-items: flex-start; }
.teaser-dots { flex: 0 0 auto; margin-top: 6px; }
.teaser h3 { font-size: clamp(24px, 2.4vw, 30px); font-weight: 500; letter-spacing: -.5px; margin-bottom: 8px; }
.teaser p { color: var(--warm-muted); }

/* ==========================================================================
   Final CTA (C9)
   ========================================================================== */

.final { text-align: center; padding-bottom: clamp(90px, 12vw, 160px); }
.final .logo-big { margin: 0 auto 34px; display: block; width: 88px; height: 88px; }
.final h2 { max-width: 16ch; margin: 0 auto 18px; }
.final p { color: var(--warm-muted); max-width: 52ch; margin: 0 auto 34px; }
.final .pill { font-size: 16px; padding: 13px 28px; }

/* ==========================================================================
   Footer (C10)
   ========================================================================== */

footer {
  border-top: 1px solid var(--ember-border);
  padding: 56px var(--pad-x);
  position: relative; z-index: 2;
}
.foot {
  max-width: 1180px; margin: 0 auto;
  display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap;
}
.foot .tag { color: var(--warm-muted); font-size: 14px; margin-top: 12px; max-width: 30ch; }
.foot h3 {
  font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--warm-muted); margin-bottom: 14px; font-weight: 500;
}
.foot ul { list-style: none; }
.foot li { margin-bottom: 9px; }
.foot a { color: var(--bone); opacity: .8; text-decoration: none; font-size: 15px; }
.foot a:hover { opacity: 1; color: var(--signal-coral); }
.legal {
  max-width: 1180px; margin: 44px auto 0;
  color: #837A70; font-size: 13px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}

/* ==========================================================================
   Reduced motion (Part E)
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .li, .rv { animation: none; transition: none; opacity: 1; transform: none; }
  .fill { transition: none; }
  .pill, .teaser, .widget { transition: none; }
  canvas.ambient { transition: none; opacity: 1; }
}

/* ==========================================================================
   Interior pages (Part D) — lightweight ambient hero, shared components
   ========================================================================== */

header.page-hero {
  position: relative;
  min-height: 52vh;
  display: flex; align-items: center;
  padding: clamp(48px, 7vw, 96px) var(--pad-x);
}
header.page-hero .hero-inner { max-width: 900px; }
header.page-hero h1 { font-size: clamp(40px, 6vw, 80px); }
header.page-hero .subline {
  font-size: clamp(20px, 2vw, 26px); font-weight: 500;
  letter-spacing: -.3px; margin-top: 10px;
}
header.page-hero .sub { max-width: 58ch; color: var(--warm-muted); margin: 22px 0 0; font-size: clamp(16px, 1.3vw, 19px); }
header.page-hero .ctas { margin-top: 34px; }

/* how it works — 01/02/03 joined by a dotted line */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 3vw, 36px); margin-top: clamp(44px, 5vw, 64px); position: relative; }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } }
.step {
  background: var(--ember-card); border: 1px solid var(--ember-border); border-radius: 16px;
  padding: clamp(24px, 3vw, 36px);
  transition: transform .25s, border-color .25s;
}
.step:hover { transform: translateY(-2px); border-color: var(--dot-dim); }
.step .num { font-size: 13px; letter-spacing: 2px; color: var(--signal-coral); margin-bottom: 14px; display: block; }
.step h3 { font-size: 22px; font-weight: 500; letter-spacing: -.3px; margin-bottom: 10px; }
.step p { color: var(--warm-muted); font-size: 15.5px; }
.steps::before {
  content: ""; position: absolute; top: 50%; left: 4%; right: 4%; z-index: -1;
  border-top: 1px dashed var(--ember-border);
}
@media (max-width: 860px) { .steps::before { display: none; } }

/* study type cards */
.studies { display: grid; grid-template-columns: repeat(6, 1fr); gap: clamp(16px, 2vw, 24px); margin-top: clamp(44px, 5vw, 64px); }
.study {
  grid-column: span 2;
  background: var(--ember-card); border: 1px solid var(--ember-border); border-radius: 16px;
  padding: clamp(22px, 2.6vw, 32px);
  transition: transform .25s, border-color .25s;
}
.study:hover { transform: translateY(-2px); border-color: var(--dot-dim); }
.study:nth-child(1), .study:nth-child(2) { grid-column: span 3; }
@media (max-width: 860px) { .studies { grid-template-columns: 1fr; } .study, .study:nth-child(1), .study:nth-child(2) { grid-column: span 1; } }
.study .sdot { display: flex; gap: 7px; margin-bottom: 16px; }
.study .sdot i { width: 5px; height: 5px; border-radius: 50%; background: var(--dot-dim); }
.study .sdot i:first-child { background: var(--signal-coral); }
.study h3 { font-size: 21px; font-weight: 500; letter-spacing: -.3px; margin-bottom: 8px; }
.study p { color: var(--signal-coral); font-style: italic; font-size: 15px; line-height: 1.5; }

/* comparison strip */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(20px, 3vw, 36px); margin-top: clamp(44px, 5vw, 64px); }
@media (max-width: 860px) { .compare { grid-template-columns: 1fr; } }
.compare .col { border: 1px solid var(--ember-border); border-radius: 16px; padding: clamp(24px, 3vw, 40px); }
.compare .col.hot { background: var(--ember-card); border-color: var(--dot-dim); }
.compare .col h3 { font-size: 20px; font-weight: 500; margin-bottom: 18px; letter-spacing: -.3px; }
.compare .col.hot h3 { color: var(--signal-coral); }
.compare ul { list-style: none; }
.compare li { color: var(--warm-muted); padding: 9px 0; border-top: 1px solid var(--ember-border); font-size: 16px; }
.compare li:first-child { border-top: 0; }
.compare .col.hot li { color: var(--bone); }

/* principles / prose blocks */
.principles { display: grid; gap: clamp(28px, 4vw, 44px); margin-top: clamp(44px, 5vw, 64px); max-width: 780px; }
.principle h3 { font-size: 22px; font-weight: 500; letter-spacing: -.3px; margin-bottom: 10px; }
.principle p { color: var(--warm-muted); }
.principle a { color: var(--signal-coral); text-decoration: underline; text-underline-offset: 3px; }

.prose { max-width: 720px; }
.prose h2 { font-size: clamp(24px, 2.6vw, 32px); margin: clamp(36px, 5vw, 56px) 0 14px; }
.prose p, .prose li { color: var(--warm-muted); margin-bottom: 14px; }
.prose ul { padding-left: 20px; margin-bottom: 14px; }
.prose a { color: var(--signal-coral); text-decoration: underline; text-underline-offset: 3px; }
.prose .lead { font-size: clamp(18px, 1.6vw, 22px); color: var(--bone); }

/* hard questions */
.hardq { margin-top: clamp(44px, 5vw, 64px); max-width: 820px; }
.hardq details { border-top: 1px solid var(--ember-border); }
.hardq details:last-child { border-bottom: 1px solid var(--ember-border); }
.hardq summary {
  cursor: pointer; list-style: none; position: relative;
  padding: 22px 44px 22px 0;
  font-size: clamp(18px, 1.8vw, 22px); font-weight: 500; letter-spacing: -.3px;
}
.hardq summary::-webkit-details-marker { display: none; }
.hardq summary::after {
  content: "+"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  color: var(--signal-coral); font-size: 24px; font-weight: 400; transition: transform .25s;
}
.hardq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.hardq .a { padding: 0 0 24px; color: var(--warm-muted); max-width: 66ch; }
.hardq .a p { margin-bottom: 12px; }
.hardq .a p:last-child { margin-bottom: 0; }

/* contact */
.contact-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(32px, 5vw, 72px); margin-top: clamp(36px, 4vw, 56px); }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }
.cform label { display: block; font-size: 14px; color: var(--warm-muted); margin-bottom: 18px; }
.cform input, .cform textarea {
  display: block; width: 100%; margin-top: 7px;
  background: var(--ember-card); border: 1px solid var(--ember-border); border-radius: 10px;
  color: var(--bone); font-family: inherit; font-size: 16px;
  padding: 12px 14px;
}
.cform input:focus-visible, .cform textarea:focus-visible { outline: 2px solid var(--signal-coral); outline-offset: 1px; }
.cform textarea { resize: vertical; min-height: 150px; }
.cform .form-note { font-size: 14px; margin-top: 12px; color: var(--warm-muted); }
.cform .alt { font-size: 14px; color: var(--warm-muted); margin-top: 16px; }
.cform .alt a { color: var(--signal-coral); text-decoration: underline; text-underline-offset: 3px; }
.aside-block { background: var(--ember-card); border: 1px solid var(--ember-border); border-radius: 16px; padding: clamp(22px, 3vw, 32px); margin-bottom: 20px; }
.aside-block h2 { font-size: 18px; font-weight: 500; margin-bottom: 8px; }
.aside-block p { color: var(--warm-muted); font-size: 15px; }
.aside-block a { color: var(--signal-coral); text-decoration: underline; text-underline-offset: 3px; }

/* 404 */
.nf { min-height: 70vh; display: flex; align-items: center; justify-content: center; text-align: center; position: relative; padding: 0 var(--pad-x); }
.nf .inner { position: relative; z-index: 2; }
.nf h1 { font-size: clamp(32px, 4.5vw, 56px); margin: 26px 0 10px; }
.nf p { color: var(--warm-muted); margin-bottom: 30px; }
