/* Layout: one hairline instrument. Two column lines run unbroken from header to footer;
   horizontal hairlines only at section boundaries; "+" marks where they meet.
   LAYOUT-owned. Spacing is a strict 8px scale. */

:root {
  --l-center: clamp(736px, 56vw, var(--center-max)); /* desktop center column */
  --l-flap-row: 672px;                               /* 10 tiles x 60 + 9 gaps x 8 */
  --l-hair: 1px;
  --l-hair-color: var(--line-strong);
  --l-mark: var(--muted-2);
  --l-topbar-h: 56px;
}

/* ---------- Page frame + full-height column hairlines ---------- */
.page {
  --rail-w: calc((100% - var(--l-center)) / 2);
  position: relative;
  isolation: isolate;
  max-width: var(--page-max);
  margin-inline: auto;
  overflow-x: clip;
}
.page::before,
.page::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--l-hair);
  background: var(--l-hair-color);
  z-index: -1;
  pointer-events: none;
}
.page::before { left: calc(var(--rail-w) - 1px); }
.page::after { left: calc(100% - var(--rail-w)); }

@media (min-width: 1441px) {
  .page { border-inline: 1px solid var(--line); }
}

/* Registration mark: an 11px "+" centred on a hairline intersection. */
.topbar::before, .topbar::after,
.hero::before, .hero::after,
.site-footer::before, .site-footer::after,
.stats::before, .stats::after {
  content: '';
  position: absolute;
  width: 11px;
  height: 11px;
  background:
    linear-gradient(var(--l-mark), var(--l-mark)) center / 1px 100% no-repeat,
    linear-gradient(var(--l-mark), var(--l-mark)) center / 100% 1px no-repeat;
  pointer-events: none;
  z-index: 2;
}
/* full-width lines meet both column lines */
.topbar::before, .hero::before, .site-footer::before { left: calc(var(--rail-w) - 6px); }
.topbar::after, .hero::after, .site-footer::after { left: calc(100% - var(--rail-w) - 5px); }
.topbar::before, .topbar::after, .hero::before, .hero::after { bottom: -6px; }
.site-footer::before, .site-footer::after { top: -6px; }

/* ---------- Header ---------- */
.topbar {
  position: relative;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--rail-w);
  align-items: center;
  height: var(--l-topbar-h);
  border-bottom: var(--l-hair) solid var(--l-hair-color);
}
.topbar-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-width: 0;
  padding-inline: 16px;
}
.topbar-meta-left { flex-direction: column; gap: 0; }
.topbar-meta-left .micro { line-height: 14px; white-space: nowrap; }
.topbar-meta-right .micro { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }

.brand {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.01em;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--signal); /* the one colour means "verified": brand mark, favicon, ticks */
}
.brand-mark svg { width: 12px; height: 12px; fill: none; stroke: var(--white); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.brand-period { color: var(--muted-2); }

.live-dot {
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}
.live-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  opacity: 0;
  animation: live-ping 2.4s var(--ease-out) infinite;
}
@keyframes live-ping {
  0% { transform: scale(.6); opacity: .6; }
  70%, 100% { transform: scale(1.8); opacity: 0; }
}

.motion-control {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  transition: border-color var(--dur-fast) var(--ease-out);
}
.motion-control::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; } /* 44px hit area */
.motion-control:hover { border-color: var(--ink); }
.motion-control:focus-visible { border-radius: 50%; }
.motion-control svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.motion-control .motion-play { display: none; }
.motion-control[aria-pressed='true'] .motion-play { display: block; }
.motion-control[aria-pressed='true'] .motion-pause { display: none; }

/* ---------- Hero grid ---------- */
.hero {
  --rail-split: calc(var(--portrait-height, 840px) / 3);
  position: relative;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--rail-w);
  grid-template-rows: auto var(--rail-split) auto;
  grid-template-areas:
    "deco-l copy  deco-r"
    "deco-l scene deco-r"
    "stats-l scene stats-r";
  border-bottom: var(--l-hair) solid var(--l-hair-color);
}

.hero-copy {
  grid-area: copy;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 64px 32px 40px;
  text-align: center;
}

.headline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 100%;
  margin: 0 0 32px;
}
.headline-statement {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(34px, 4vw, 56px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.01em;
  color: var(--ink);
  text-wrap: balance;
}
.headline .split-flap { max-width: 100%; }

.subtitle {
  max-width: 60ch;
  margin: 0 auto 40px;
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--ink-2);
  text-wrap: balance;
}

.scene {
  grid-area: scene;
  min-width: 0;
  padding-inline: max(32px, calc((100% - var(--l-flap-row)) / 2));
  padding-bottom: 64px;
}

.grid-deco {
  position: relative;
  min-width: 0;
  pointer-events: none;
}
.grid-deco-left { grid-area: deco-l; }
.grid-deco-right { grid-area: deco-r; }

.deco-readout {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 24px;
  display: flex;
  justify-content: center;
  gap: .6em;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out);
}
.deco-readout.is-live { opacity: 1; }
.deco-readout [data-readout-current] { color: var(--ink-2); }

/* ---------- Stats ---------- */
.stats {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 64px;
  min-width: 0;
  padding: 64px 24px;
  border-top: var(--l-hair) solid var(--l-hair-color);
}
.stats-left { grid-area: stats-l; }
.stats-right { grid-area: stats-r; }
/* rail split meets the column line */
.stats::before { top: -6px; }
.stats-left::before { right: -5px; }
.stats-right::before { left: -5px; }
.stats::after { display: none; }

.stat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 248px;
  text-align: center;
}
.stat-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  color: var(--ink);
}
.stat-eyebrow {
  position: relative;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color var(--dur) var(--ease-out);
}
.stat-eyebrow::before {
  content: '';
  position: absolute;
  top: 5px;
  left: -14px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0;
  transform: scale(.4);
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.stat-figure {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: .28em;
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: clamp(32px, 2.6vw, 40px);
  font-weight: 400;
  line-height: 48px;
  letter-spacing: -.01em;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  transition: color var(--dur) var(--ease-out);
}
.stat-num { display: inline-block; text-align: right; }
.stat-sep { color: var(--muted-2); font-weight: 400; }
.stat-copy {
  max-width: 24ch;
  margin-top: 8px;
  font-size: 13px;
  line-height: 20px;
  color: var(--muted);
  text-wrap: balance;
}

/* Active: the scanner is checking this threat right now. */
.stat.is-active .stat-eyebrow,
.stat.is-active .stat-figure { color: var(--ink); }
.stat.is-active .stat-eyebrow::before { opacity: 1; transform: none; }
.stat::after {
  content: '';
  position: absolute;
  left: -16px;
  right: -16px;
  top: -24px;
  height: 100%;
  background: linear-gradient(to bottom, transparent 0, rgba(25, 25, 25, .05) 23px, var(--ink) 23px 24px, transparent 24px);
  -webkit-mask: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent);
  mask: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent);
  opacity: 0;
  pointer-events: none;
}
.stat.is-active.is-sweeping::after { animation: stat-scan 1.6s var(--ease-in-out) 1 both; }
@keyframes stat-scan {
  0% { transform: translateY(0); opacity: 0; }
  12% { opacity: .55; }
  85% { opacity: .55; }
  100% { transform: translateY(100%); opacity: 0; }
}

/* ---------- Launch placement (internals are LAUNCH's) ---------- */
:where(main) > .launch {
  margin-inline: var(--rail-w);
  padding: 96px 32px;
  text-align: center;
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px calc(var(--rail-w) + 24px) 56px;
  border-top: var(--l-hair) solid var(--l-hair-color);
  text-align: center;
}
.footer-contact {
  font-size: 15px;
  line-height: 24px;
  color: var(--ink-2);
}
.footer-contact a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  overflow-wrap: anywhere;
  transition: text-decoration-color var(--dur-fast) var(--ease-out);
}
.footer-contact a:hover { text-decoration-color: var(--ink); }

/* ---------- Desktop narrow (1100-1279): tighter rails ---------- */
@media (min-width: 1100px) and (max-width: 1279px) {
  .stats { padding-inline: 16px; }
  .stat-copy { font-size: 12.5px; }
  .topbar-meta-left .micro { letter-spacing: .08em; font-size: 9.5px; }
}

/* ---------- Tablet + mobile: rails fold, stats move under the scene ---------- */
@media (max-width: 1099px) {
  .page { --rail-w: clamp(16px, 4vw, 48px); }
  .topbar { grid-template-columns: var(--rail-w) minmax(0, 1fr) auto minmax(0, 1fr) var(--rail-w); }
  .topbar-meta-left { grid-column: 2; align-items: flex-start; justify-self: start; }
  .brand { grid-column: 3; }
  .topbar-meta-right { grid-column: 4; justify-self: end; padding-inline: 16px; }

  .hero {
    grid-template-columns: var(--rail-w) minmax(0, 1fr) minmax(0, 1fr) var(--rail-w);
    grid-template-rows: auto;
    grid-template-areas:
      ". copy copy ."
      ". scene scene ."
      ". stats-l stats-r .";
  }
  .grid-deco { display: none; }

  .stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 0;
    padding: 0;
  }
  .stat {
    max-width: none;
    padding: 48px 16px;
  }
  .stat + .stat,
  .stats-right { border-left: var(--l-hair) solid var(--l-hair-color); }
  .stat::after { left: 0; right: 0; top: calc(48px - 24px); height: calc(100% - 96px); }
  .stats-left::before { right: auto; left: -6px; }
  .stats-right::before { left: auto; right: -6px; }
}

@media (max-width: 899px) {
  .hero {
    grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--rail-w);
    grid-template-areas:
      ". copy ."
      ". scene ."
      ". stats-l ."
      ". stats-r .";
  }
  .stats-right { border-left: 0; }
  /* matrix centre: the row divider meets the column divider */
  .stats-right::before { left: calc(50% - 5px); right: auto; }
  .stats-left::after { display: block; top: -6px; right: -6px; }
}

@media (max-width: 759px) {
  .topbar-meta-left { display: none; }
  .topbar-meta-right .micro { display: none; }
  .topbar-meta-right { padding-inline: 8px; }

  .hero-copy { padding: 48px 8px 32px; }
  .headline { gap: 16px; margin-bottom: 24px; }
  .headline-statement { font-size: clamp(26px, 7.6vw, 34px); }
  .subtitle { font-size: 16px; margin-bottom: 32px; }
  .scene { padding-inline: 8px; padding-bottom: 48px; }

  .stat { padding: 32px 8px; }
  .stat::after { top: 8px; height: calc(100% - 64px); }
  .stat-icon { width: 56px; height: 56px; margin-bottom: 12px; }
  .stat-figure { font-size: 28px; line-height: 40px; }
  .stat-copy { font-size: 12px; line-height: 18px; }
  .stat-eyebrow { font-size: 9.5px; letter-spacing: .12em; }

  :where(main) > .launch { padding: 64px 16px; }
  .site-footer { padding: 40px calc(var(--rail-w) + 8px) 48px; }
  .footer-contact { font-size: 14px; }
}

/* Supervisor: the wireframe labels each rail once ("In a recent test"), not every stat.
   Only in the rail layout; stacked/mobile layouts keep a label per card. */
@media (min-width: 1100px) {
  .stats .stat + .stat .stat-eyebrow { display: none; }
}

/* Supervisor: the header is the logo only (user request). The pause control moved to the
   portrait caption row, next to the motion it controls. */
.topbar,
.topbar:where(*) { grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--rail-w); }
.topbar .brand { grid-column: 2; justify-self: center; }

/* Supervisor: short desktop screens (1366x768, 1536x864 laptops). Tighten the hero's
   vertical rhythm so the head and eyes land above the fold. Width stays untouched. */



/* Supervisor: two-part subtitle. The lead line carries the promise, the second the mechanism. */
.subtitle { max-width: 62ch; }
.subtitle-lead { display: block; color: var(--ink); font-weight: 500; }

/* Supervisor: more air in the hero copy (user: "feels too cramped"). The lead line gets
   its own breath; generous block spacing wherever the screen is tall enough. */
.subtitle { line-height: 1.75; }
.subtitle-lead { margin-bottom: 18px; }
@media (min-height: 821px) {
  .headline { gap: 52px; margin-bottom: 60px; }
  .subtitle { margin-bottom: 56px; }
}
@media (min-height: 821px) and (max-width: 759px) {
  .headline { gap: 28px; margin-bottom: 36px; }
  .subtitle { margin-bottom: 40px; }
  .subtitle-lead { margin-bottom: 12px; }
}



/* Supervisor: breathing room between the CTA and the portrait. js/hero-fold.js sizes it
   per window so the fold lands across the candidate's eyes; the rail split moves with it
   so the stat hairline keeps its place relative to the face. */
.hero { --rail-split: calc(var(--portrait-height, 840px) / 3 + var(--scene-offset, 48px)); }
.scene { padding-top: var(--scene-offset, 48px); }
@media (max-width: 759px) { .scene { padding-top: var(--scene-offset, 28px); } }

/* Supervisor: short desktop screens (e.g. 1536x696 on a 125%-scaled 1080p laptop). One
   comfortable tier instead of progressively tighter ones: the hero copy breathes, and
   js/hero-fold.js lets the fold fall across the candidate's eyes below it. */
@media (min-width: 1100px) and (max-height: 820px) {
  .hero-copy { padding-top: 40px; padding-bottom: 20px; }
  .headline { gap: 30px; margin-bottom: 32px; }
  .headline-statement { font-size: clamp(34px, 3.4vw, 50px); }
  .subtitle { margin-bottom: 28px; font-size: 16px; line-height: 1.7; }
  .subtitle-lead { margin-bottom: 12px; }
  /* Stats start level with the portrait's top edge, so the rails end with the stage. */
  .hero { --rail-split: calc(var(--scene-offset, 32px) + var(--portrait-height, 640px) / 5); }
}

/* Privacy link beside the copyright (deploy agent). */
.site-footer .micro a {
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-fast) var(--ease-out);
}
.site-footer .micro a:hover { text-decoration-color: var(--ink); }

/* Supervisor: stat cards size their type to their own width, so "120 / 120" never
   overflows a narrow 2x2 card. Desktop rails still hit the 40px cap. */
.stat { container-type: inline-size; }
.stat-figure { font-size: min(clamp(32px, 2.6vw, 40px), 18.5cqi); line-height: 1.2; }
.stat-eyebrow { font-size: min(10.5px, 7cqi); letter-spacing: min(.14em, .9cqi); }
.stat-copy { font-size: min(13px, 8.6cqi); line-height: 1.55; }
