/* ============================================================
   Menu / landing UI — scoped to #app, plus the safety modal and the
   in-test "next test" affordance. Dark theme matching the design reference.
   Fonts are self-hosted (no CDN).

   NOTE: this stylesheet styles ONLY the menu/landing/modal/header chrome.
   The fullscreen test SURFACES live in test.css and are deliberately
   untouched — pure black / solid-colour, zero brand chrome (per SPEC). The
   #seq-next button below is host chrome (a sibling of the surface), styled
   here precisely so test.css needs no changes.
   ============================================================ */

/* ---- Self-hosted fonts (paths relative to /assets/) ---- */
/* Open Sans — all body text, section headings and card titles. */
@font-face {
  font-family: "Open Sans";
  src: url("fonts/open-sans-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
/* Bricolage Grotesque — ONLY the large "Display Test" hero title (subset to
   just those glyphs at weight 800 to keep the payload tiny). */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-title.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
/* JetBrains Mono — small technical labels and tags. */
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #07080b;
  --bg-1: #0c0e14;
  --bg-2: #11141d;
  --line: rgba(255, 255, 255, 0.08);
  --line-bright: rgba(255, 255, 255, 0.18);
  --ink: #eef0f6;
  --ink-dim: #bcc2cd; /* lifted floor for body readability */
  --ink-faint: #5c6273;
  --accent: #6ad3ff;
  --accent-deep: #2a93d8;
  --red: #ff2d55;
  --blue: #3d6bff;
  --amber: #ffb84d;
  --sans: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Bricolage Grotesque", var(--sans);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

html,
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
}

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 78% -8%, rgba(106, 211, 255, 0.1), transparent 60%),
    radial-gradient(720px 480px at 8% 12%, rgba(61, 107, 255, 0.07), transparent 55%),
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: auto, auto, 46px 46px, 46px 46px;
  background-attachment: fixed;
}
/* fine grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
}

#app[hidden] {
  display: none;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 26px clamp(18px, 4vw, 40px) 70px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(22px, 4vh, 36px);
}
.brand {
  display: inline-flex;
  align-items: center;
}
.brand-logo {
  height: 24px;
  width: auto;
  display: block;
}

/* ---------- hero (even, moderate vertical rhythm) ---------- */
.hero {
  margin-bottom: clamp(28px, 5vh, 44px);
  max-width: 760px;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 14px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.title {
  margin: 0;
  font-family: var(--display); /* Bricolage Grotesque, hero title only */
  font-size: clamp(48px, 9.5vw, 108px);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.035em;
  position: relative;
  text-shadow: -0.018em 0 rgba(255, 45, 85, 0.55), 0.018em 0 rgba(61, 107, 255, 0.55);
  animation: converge 7s ease-in-out infinite;
}
@keyframes converge {
  0%, 100% {
    text-shadow: -0.018em 0 rgba(255, 45, 85, 0.55), 0.018em 0 rgba(61, 107, 255, 0.55);
  }
  50% {
    text-shadow: -0.006em 0 rgba(255, 45, 85, 0.4), 0.006em 0 rgba(61, 107, 255, 0.4);
  }
}
.title em {
  font-style: normal;
  color: var(--accent);
  text-shadow: -0.018em 0 rgba(255, 45, 85, 0.35), 0.018em 0 rgba(61, 107, 255, 0.35);
}

.lede {
  margin: 16px 0 0;
  font-size: clamp(16px, 2.1vw, 20px);
  line-height: 1.55;
  color: #d6dbe3; /* slightly brighter than body floor */
  font-weight: 400;
  max-width: 56ch;
}
.lede b {
  color: var(--ink);
  font-weight: 600;
}

.meta {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-faint);
}
.meta span {
  display: flex;
  align-items: center;
  gap: 8px;
}
.meta i {
  font-style: normal;
  color: #27d17f;
  font-size: 9px;
}

/* ---------- action row ---------- */
.actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin: 22px 0 0;
}
.cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: #04121a;
  background: linear-gradient(180deg, #8ee0ff, var(--accent));
  border: none;
  border-radius: 13px;
  padding: 15px 26px;
  box-shadow: 0 0 0 1px rgba(106, 211, 255, 0.4), 0 14px 40px -12px rgba(106, 211, 255, 0.6);
  transition: transform 0.18s ease, box-shadow 0.25s ease;
}
.cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px rgba(106, 211, 255, 0.6), 0 22px 52px -12px rgba(106, 211, 255, 0.7);
}
.cta:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
.cta:disabled {
  cursor: not-allowed;
  filter: saturate(0.4) brightness(0.7);
  box-shadow: 0 0 0 1px var(--line);
}
.cta svg {
  width: 18px;
  height: 18px;
}
.hint {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-faint);
}

/* ---------- grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.card {
  position: relative;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font-family: var(--sans);
  background: linear-gradient(180deg, var(--bg-1), #0a0c11);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 20px 18px;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  opacity: 0;
  transform: translateY(14px);
  animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}
.card:nth-child(1) { animation-delay: 0.04s; }
.card:nth-child(2) { animation-delay: 0.08s; }
.card:nth-child(3) { animation-delay: 0.12s; }
.card:nth-child(4) { animation-delay: 0.16s; }
.card:nth-child(5) { animation-delay: 0.20s; }
.card:nth-child(6) { animation-delay: 0.24s; }
.card:nth-child(7) { animation-delay: 0.28s; }
.card:nth-child(8) { animation-delay: 0.32s; }
.card:nth-child(9) { animation-delay: 0.36s; }
.card:nth-child(10) { animation-delay: 0.40s; }
.card:nth-child(11) { animation-delay: 0.44s; }

/* colored glow that follows the top edge on hover (tinted to the card hue) */
.card {
  --h: #3a8ffd; /* default accent if a card sets none */
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(420px 180px at 50% -40%, color-mix(in srgb, var(--h) 22%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.card:not(:disabled):hover {
  transform: translateY(-4px);
  border-color: var(--line-bright);
  background: linear-gradient(180deg, var(--bg-2), #0c0e14);
  box-shadow: 0 20px 54px -18px color-mix(in srgb, var(--h) 55%, transparent);
}
.card:not(:disabled):hover::after {
  opacity: 1;
}
.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.card.is-soon {
  cursor: not-allowed;
  opacity: 0.55;
}

/* Style C vibrant tile: bold gradient, white icon, soft colored shadow. */
.card .icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 15px;
  color: #fff;
  border: none;
  background: var(--h); /* solid fallback if color-mix/gradient unsupported */
  background: linear-gradient(140deg, var(--h), color-mix(in srgb, var(--h) 55%, #1a1d27));
  box-shadow: 0 8px 22px -8px color-mix(in srgb, var(--h) 70%, transparent);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card .icon svg {
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}
.card:not(:disabled):hover .icon {
  transform: translateY(-1px) scale(1.04);
}

/* Special tiles: Color = full spectrum, HDR = warm radial gold (dark icon for contrast). */
.card.spectrum .icon {
  background: linear-gradient(135deg, #ff5a78, #ffce6a 30%, #5fd0a8 60%, #67d3ff 82%, #9b8cff);
  color: #0b0d12;
  box-shadow: 0 8px 22px -8px rgba(150, 180, 255, 0.5);
}
.card.warm .icon {
  background: radial-gradient(circle at 35% 30%, #ffe39a, #ff8c3c);
  color: #5a2a00;
  box-shadow: 0 8px 22px -8px rgba(255, 140, 60, 0.55);
}

.card h3 {
  font-size: 17.5px;
  font-weight: 700;
  letter-spacing: -0.012em;
  margin: 0 0 7px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.card p {
  margin: 0;
  font-size: 13.2px;
  line-height: 1.5;
  color: var(--ink-dim);
  font-weight: 400;
  min-height: 40px;
}

.tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  border-radius: 6px;
  padding: 4px 8px;
  text-transform: uppercase;
  display: inline-block;
  margin-top: 14px;
  /* tinted to the card hue (Style C); solid-color fallback first */
  color: var(--h);
  color: color-mix(in srgb, var(--h) 78%, #cfd3dc);
  border: 1px solid var(--line);
  border: 1px solid color-mix(in srgb, var(--h) 26%, transparent);
}
/* the spectrum (Color) card keeps a neutral tag */
.card.spectrum .tag {
  color: #cfd3dc;
  border-color: var(--line);
}

.flash {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: var(--amber);
  border: 1px solid rgba(255, 184, 77, 0.35);
  background: rgba(255, 184, 77, 0.08);
  border-radius: 6px;
  padding: 3px 7px;
  text-transform: uppercase;
}

.corner {
  position: absolute;
  top: 16px;
  right: 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  opacity: 0.6;
}

/* ---------- footer ---------- */
.foot {
  margin-top: 46px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-faint);
}
.foot .spectrum {
  height: 3px;
  width: 120px;
  border-radius: 2px;
  align-self: center;
  background: linear-gradient(90deg, var(--red), #ffb84d 25%, #27d17f 55%, var(--accent) 80%, var(--blue));
}
.foot-link {
  color: var(--ink-faint);
}
.foot-link:hover {
  color: var(--ink);
  text-decoration: none;
}
.privacy-line {
  margin: 14px 0 0;
  max-width: 72ch;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-faint);
  scroll-margin-top: 80px;
}

/* ---------- Landing content / SEO ---------- */
.content {
  max-width: 760px;
  margin: clamp(44px, 8vh, 76px) 0 0;
}
.content h2 {
  font-family: var(--sans);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: clamp(34px, 5vh, 52px) 0 14px;
}
.content > h2:first-child {
  margin-top: 0;
}
.content p {
  color: var(--ink-dim);
  font-weight: 300;
  line-height: 1.65;
  font-size: 15.5px;
  margin: 0 0 14px;
}
.content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(106, 211, 255, 0.4);
}
.content a:hover {
  text-decoration-color: var(--accent);
}

.checklist {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 11px;
}
.checklist li {
  position: relative;
  padding-left: 24px;
  color: var(--ink-dim);
  font-weight: 300;
  line-height: 1.6;
  font-size: 15px;
}
.checklist li::before {
  content: "▸";
  position: absolute;
  left: 4px;
  color: var(--accent);
}
.checklist b {
  color: var(--ink);
  font-weight: 600;
}
.kbd {
  font-family: var(--mono);
  font-size: 0.82em;
  border: 1px solid var(--line-bright);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}

/* Accordions: "What each test checks" + FAQ (native details/summary) */
.explain,
.faq {
  margin: 0 0 8px;
}
.ac-item {
  border-top: 1px solid var(--line);
}
.ac-item:last-child {
  border-bottom: 1px solid var(--line);
}
.ac-item > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 2px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.ac-item > summary::-webkit-details-marker {
  display: none;
}
.ac-item > summary::after {
  content: "+";
  font-family: var(--mono);
  font-size: 18px;
  line-height: 1;
  color: var(--accent);
  flex: 0 0 auto;
}
.ac-item[open] > summary::after {
  content: "–";
}
.ac-item > summary:hover {
  color: var(--accent);
}
.ac-item > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.ac-item > p {
  margin: 0;
  padding: 0 2px 16px;
  max-width: 72ch;
  color: var(--ink-dim);
  font-weight: 300;
  line-height: 1.65;
  font-size: 14.5px;
}

/* ---------- "Next test" affordance (host chrome; styled here so test.css is untouched) ---------- */
.seq-next {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(68px, calc(env(safe-area-inset-bottom) + 56px));
  display: none;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: #04121a;
  background: linear-gradient(180deg, #8ee0ff, var(--accent));
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(106, 211, 255, 0.4), 0 10px 28px -10px rgba(106, 211, 255, 0.7);
  opacity: 1;
  transition: opacity 0.4s ease, transform 0.18s ease;
  z-index: 11;
}
.seq-next:hover {
  transform: translateY(-1px);
}
#test-host.seq .seq-next {
  display: inline-flex;
}
#test-host.idle .seq-next {
  opacity: 0;
  pointer-events: none;
}

/* ---------- Safety gate (photosensitive-epilepsy warning) ---------- */
.gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483600; /* above the test host too */
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 5, 8, 0.74);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.gate-modal {
  width: min(520px, 100%);
  background: var(--bg-1);
  border: 1px solid var(--line-bright);
  border-radius: 16px;
  padding: 26px 26px 22px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
}
.gate-title {
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--amber);
}
.gate-icon {
  font-size: 1.3rem;
}
.gate-body {
  margin: 0 0 22px;
  color: var(--ink-dim);
  font-size: 0.98rem;
  line-height: 1.55;
  font-weight: 300;
}
.gate-body strong {
  color: var(--ink);
  font-weight: 600;
}
.gate-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.btn-primary {
  color: #04121a;
  background: linear-gradient(180deg, #8ee0ff, var(--accent));
  box-shadow: 0 0 0 1px rgba(106, 211, 255, 0.4);
}
.btn-primary:hover {
  transform: translateY(-1px);
}
.gate-cancel {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-bright);
}
.gate-cancel:hover {
  background: rgba(255, 255, 255, 0.04);
}
.gate-modal .btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .title {
    animation: none;
  }
  .card {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .cta,
  .btn,
  .seq-next,
  .card,
  .card .icon,
  .back {
    transition: none;
  }
}
