/*
 * Try Flop's home page (/). Flop's navy in both colour modes: the page is the brand's own ground, and its
 * glows only read on dark. The app (/app) keeps its own sheet, styles.css, which follows the system's
 * light or dark setting. Every text colour here is measured against the ground it sits on (WCAG 2.x),
 * and e2e/gallery.mjs re-checks the page at every width from 320 to 1440 px.
 */

/* Atkinson Hyperlegible Next (Braille Institute; SIL Open Font License 1.1, fonts/OFL.txt): the same two
   variable files as the app. They cover weights 200 to 800; the headline uses 800. */
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-next-latin.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: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-next-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: dark;
  --navy: #0a1128;
  --panel: #0e1834;
  --panel-deep: #0b142c;
  --ink: #f5f7fa;
  --ink-2: #aab6cc;
  --line: rgba(245, 247, 250, 0.1);
  --line-strong: rgba(245, 247, 250, 0.2);
  --control: #7b8aa6;
  --cyan: #00b4d8;
  --cyan-soft: #7fdcef;
  --font: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ── Base ─────────────────────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--navy);
  color: var(--ink);
  font-family: var(--font);
  /* 17px, not 16: this page is read on phones, at arm's length, by people who are not developers. */
  font-size: 1.0625rem;
  line-height: 1.55;
}
h1, h2, h3, h4, p, li, dt, dd { overflow-wrap: anywhere; }
p { margin: 0.5rem 0; }
a { color: var(--cyan-soft); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.center { text-align: center; }

/* ── Buttons: one primary (white) per page; everything else outlined ──────────────────────── */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 1.5rem; border-radius: 999px;
  border: 1px solid transparent; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.button.primary { background: var(--ink); color: var(--navy); }
.button.primary:hover { background: #ffffff; }
.button.outline { color: var(--ink); border-color: var(--control); background: rgba(10, 17, 40, 0.72); }
.button.outline:hover { border-color: var(--cyan); }
.button.compact { min-height: 44px; padding: 0 1.25rem; }

/* ── The nav: a floating pill over the hero ───────────────────────────────────────────────── */
.nav-wrap { position: absolute; top: 0; left: 0; right: 0; z-index: 2; padding: 1rem 1rem 0; }
.nav {
  max-width: 58rem; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 1rem;
  padding: 0.375rem 0.375rem 0.375rem 1rem; border-radius: 999px;
  border: 1px solid var(--line-strong); background: rgba(13, 22, 48, 0.88);
}
.brand { display: inline-flex; align-items: center; gap: 0.625rem; min-height: 44px; color: var(--ink); font-weight: 700; font-size: 1.125rem; text-decoration: none; }
.brand img { display: block; width: 28px; height: 28px; border-radius: 6px; }
.nav-links { display: flex; gap: 0.25rem; margin: 0; padding: 0; list-style: none; }
.nav-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.875rem; border-radius: 999px; color: var(--ink-2); text-decoration: none; }
.nav-links a:hover { color: var(--ink); background: rgba(245, 247, 250, 0.06); }
@media (max-width: 639px) { .nav-links { display: none; } }

/* ── The hero: the picture's navy ground, two glows and a faint grid ──────────────────────── */
.hero {
  position: relative; isolation: isolate;
  display: flex; flex-direction: column;
  min-height: max(600px, 100svh);
  padding-top: 5.5rem;
  background:
    radial-gradient(30rem 26rem at 96% 2%, rgba(80, 228, 246, 0.92), rgba(0, 180, 216, 0.26) 45%, rgba(0, 180, 216, 0) 72%),
    radial-gradient(24rem 26rem at 0% 66%, rgba(48, 206, 236, 0.78), rgba(0, 180, 216, 0.18) 50%, rgba(0, 180, 216, 0) 74%),
    var(--navy);
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(rgba(127, 220, 239, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(127, 220, 239, 0.07) 1px, transparent 1px);
  background-size: 64px 64px; background-position: center top;
  -webkit-mask-image: radial-gradient(60% 50% at 50% 28%, #000 25%, transparent 75%);
  mask-image: radial-gradient(60% 50% at 50% 28%, #000 25%, transparent 75%);
}
@media (max-width: 639px) {
  .hero {
    padding-top: 5rem;
    background:
      radial-gradient(18rem 16rem at 100% 0%, rgba(64, 214, 236, 0.3), rgba(0, 180, 216, 0) 72%),
      radial-gradient(18rem 16rem at 0% 92%, rgba(0, 180, 216, 0.3), rgba(0, 180, 216, 0) 74%),
      var(--navy);
  }
}
.hero-text { position: relative; z-index: 1; padding: 1.5rem 1rem 0; text-align: center; }

.pill {
  display: inline-flex; align-items: center; gap: 0.5rem; margin: 0;
  padding: 0.3rem 0.9rem; border-radius: 999px;
  border: 1px solid rgba(0, 180, 216, 0.4); background: rgba(9, 28, 50, 0.9);
  color: var(--cyan-soft); font-family: var(--mono); font-size: 0.875rem; font-variant-numeric: tabular-nums;
}
.pill-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #5b6b86; flex: none; }
.pill.is-live .pill-dot { background: var(--cyan); }
/* The live pulse is a ring that grows and fades: transform and opacity only, which the browser animates off
   the main thread (a shadow animation repainted every frame, even with nothing else moving). */
.pill.is-live .pill-dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid rgba(0, 180, 216, 0.55); opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .pill.is-live .pill-dot::after { animation: pill-ring 2.4s ease-out infinite; }
}
@keyframes pill-ring { from { transform: scale(0.5); opacity: 0.9; } to { transform: scale(1.6); opacity: 0; } }

/* The headline's white-to-silver fill. `color` is the gradient's darkest stop, so a contrast check that
   reads `color` measures the worst part of the fill. */
.display {
  margin: 1.25rem auto 0; max-width: 16ch;
  font-size: clamp(2.25rem, 1.2rem + 5.2vw, 5.5rem); font-weight: 800; line-height: 1.04; letter-spacing: -0.03em;
  color: #b9c3d6;
  background: linear-gradient(180deg, #ffffff 15%, #b9c3d6 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.display .line { display: block; }
.underline { position: relative; display: inline-block; }
.underline::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -0.12em; height: 0.24em;
  background: url("home-underline.svg") center / 100% 100% no-repeat; pointer-events: none;
}
/* Under the headline, one line: what you get. The rule, the status and the independence line are in the
   sections below and the footer, where a reader goes next rather than being stopped at the door. */
.subline { max-width: 44rem; margin: 0.75rem auto 0; color: var(--ink-2); font-size: 1.1875rem; }
.actions { display: flex; flex-direction: column; align-items: center; gap: 0.875rem; margin-top: 2rem; }
/* The browser route under the agent one: a link, not a second button (one primary per screen). */
.text-link { font-size: 1rem; color: var(--ink-2); }
.text-link:hover { color: var(--ink); }
@media (max-width: 479px) {
  .actions { flex-direction: column; align-items: stretch; max-width: 22rem; margin-inline: auto; }
}

/* The picture: two canvases (a base layer and a motion layer) filling the hero's lower part. Before
   they draw, or without JavaScript, a CSS horizon stands in: the dark Earth's edge with its glow. */
.globe { position: relative; flex: 1 1 auto; min-height: clamp(240px, 44vh, 560px); margin-top: 1.5rem; }
.globe canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.globe::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(160% 150% at 50% 168%,
    #0c1630 62%, rgba(127, 220, 239, 0.8) 62.25%, rgba(0, 180, 216, 0.28) 63%, rgba(0, 180, 216, 0.08) 66%, rgba(0, 180, 216, 0) 70%);
  transition: opacity 0.6s ease;
}
.globe[data-motion]:not([data-motion="fallback"])::before { opacity: 0; }

/* ── Sections ─────────────────────────────────────────────────────────────────────────────── */
.section { padding: 4.5rem 1.25rem; }
@media (max-width: 639px) { .section { padding: 3rem 1rem; } }
.inner { max-width: 64rem; margin: 0 auto; }
.section h2 {
  margin: 0 0 1rem; text-align: center;
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em;
}
.lead { max-width: 38rem; margin: 0 auto 2rem; color: var(--ink-2); font-size: 1.0625rem; text-align: center; }
.note { max-width: 42rem; margin: 2rem auto 0; color: var(--ink-2); text-align: center; }

/* The agent route, first thing under the hero: the link in a box big enough to read from across a desk,
   a Copy button, one line on what the agent does. Everything that is not that link stays quiet. */
.agent-section { padding-top: 3rem; }
.agent-section .inner { max-width: 44rem; }
.copy-box {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.75rem;
  margin: 1.5rem auto 0; padding: 0.875rem 0.875rem 0.875rem 1.375rem;
  border: 1px solid rgba(0, 180, 216, 0.45); border-radius: 1rem; background: var(--panel-deep);
  box-shadow: 0 0 0 1px rgba(0, 180, 216, 0.08), 0 24px 70px -40px rgba(0, 180, 216, 0.7);
}
.copy-box-url {
  flex: 1 1 16rem; min-width: 0; color: var(--ink);
  font-family: var(--mono); font-size: clamp(1.125rem, 0.85rem + 1.2vw, 1.625rem); letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.copy-box .button { min-height: 48px; }
.copy-box .button.outline { border-color: rgba(0, 180, 216, 0.8); color: var(--cyan-soft); }
.copy-box .button.outline:hover { border-color: var(--cyan); color: var(--ink); }
@media (max-width: 479px) { .copy-box { padding: 1rem; } .copy-box-url { flex-basis: 100%; text-align: center; } .copy-box .button { width: 100%; } }
.agent-line { margin: 1.125rem auto 0; max-width: 38rem; color: var(--ink-2); text-align: center; }

/* How it works: three scenes in a row, joined by a line through their numbers. */
.story { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin: 2.5rem 0 0; padding: 0; list-style: none; }
.story::before {
  content: ""; position: absolute; left: 1rem; right: 1rem; top: 0.875rem; height: 1px; z-index: 0;
  background: linear-gradient(90deg, rgba(0, 180, 216, 0), rgba(0, 180, 216, 0.7) 15%, rgba(0, 180, 216, 0.7) 85%, rgba(0, 180, 216, 0));
  transform-origin: left center;
}
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .story::before { animation: story-line linear both; animation-timeline: view(); animation-range: entry 10% cover 45%; }
  }
}
@keyframes story-line { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.story-step { position: relative; z-index: 1; }
.step-num {
  display: inline-block; margin: 0 0 1rem; padding: 0 0.5rem 0 0; background: var(--navy);
  color: var(--cyan-soft); font-family: var(--mono); font-size: 0.875rem; line-height: 1.75rem;
}
.story-frame {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 1rem; border: 1px solid var(--line);
  background:
    radial-gradient(rgba(127, 220, 239, 0.16) 1px, transparent 1.5px) 0 0 / 14px 14px,
    radial-gradient(70% 60% at 50% 100%, rgba(0, 180, 216, 0.16), rgba(0, 180, 216, 0)),
    var(--panel-deep);
}
.story-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.story-step h3 { margin: 1.25rem 0 0.25rem; font-size: 1.25rem; }
.story-step p:last-child { color: var(--ink-2); }
@media (max-width: 859px) {
  .story { grid-template-columns: 1fr; max-width: 30rem; margin-inline: auto; }
  .story::before { display: none; }
}

/* Two ways in: a switch, then one door at a time (both, one under the other, without JavaScript). */
.switch {
  display: flex; width: fit-content; margin: 0 auto 2rem; padding: 0.25rem; gap: 0.25rem;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel-deep);
}
.switch button {
  min-height: 44px; min-width: 7.5rem; padding: 0 1.25rem; border-radius: 999px;
  border: 2px solid transparent; background: transparent; color: var(--ink-2); font: inherit; font-weight: 700; cursor: pointer;
}
.switch button[aria-pressed="true"] { border-color: var(--cyan); background: rgba(0, 180, 216, 0.16); color: var(--ink); }
.door {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 2rem; align-items: start;
  padding: 2rem; border-radius: 1.25rem; border: 1px solid var(--line); background: var(--panel);
}
.door + .door { margin-top: 1.5rem; }
@media (max-width: 859px) { .door { grid-template-columns: 1fr; padding: 1.5rem; } }
.door h3 { margin: 0 0 0.75rem; font-size: 1.375rem; }
.door-main > p { color: var(--ink-2); }
.steps-label { margin-top: 1.25rem; color: var(--ink-2); }
.steps { margin: 1rem 0 1.5rem; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; counter-increment: step; min-height: 2rem; margin: 0 0 1rem; padding: 0.2rem 0 0 3rem; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
  border: 1px solid rgba(0, 180, 216, 0.55); color: var(--cyan-soft); font-family: var(--mono); font-size: 0.875rem;
}
.card { padding: 1.5rem; border-radius: 1rem; border: 1px solid var(--line-strong); background: var(--panel-deep); }
.card h4 { margin: 0 0 0.75rem; font-size: 1.125rem; }
.card p { color: var(--ink-2); }
.card .button { margin-top: 1rem; }
.checks { margin: 0; padding: 0; list-style: none; }
.checks li { position: relative; margin: 0 0 0.75rem; padding-left: 1.75rem; }
.checks li::before {
  content: ""; position: absolute; left: 0.2rem; top: 0.45rem; width: 0.65rem; height: 0.35rem;
  border-left: 2px solid var(--cyan); border-bottom: 2px solid var(--cyan); transform: rotate(-45deg);
}
/* The three steps and the safety list: one readable column, centred under their headings. */
.steps-wide { max-width: 44rem; margin: 2.5rem auto 0; font-size: 1.0625rem; }
.steps-wide li { margin-bottom: 1.5rem; }
.safe { max-width: 44rem; margin: 2.5rem auto 0; font-size: 1.0625rem; }
/* The safety list: one readable column on a phone, two on a wide screen so it does not run the page long. */
.safe li { margin-bottom: 1rem; break-inside: avoid; }
@media (min-width: 900px) { .safe { max-width: 64rem; columns: 2; column-gap: 3rem; } }

/* Questions: one closed row per question, the answer opening under it. Native <details>, so it works with the
   script off and keeps the keyboard and screen-reader behaviour the browser already gives it. */
.faq { max-width: 48rem; margin: 2.5rem auto 0; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  min-height: 44px; padding: 1.125rem 0; cursor: pointer; list-style: none;
  font-size: 1.0625rem; font-weight: 700;
}
.faq summary::-webkit-details-marker { display: none; }
/* Drawn, not typed: a text "+" would become part of the question's accessible name and change on every
   toggle. Two gradients make the plus; one makes the minus. */
.faq summary::after {
  content: ""; flex: none; width: 1rem; height: 1rem; align-self: center;
  background:
    linear-gradient(var(--cyan-soft), var(--cyan-soft)) center / 100% 2px no-repeat,
    linear-gradient(var(--cyan-soft), var(--cyan-soft)) center / 2px 100% no-repeat;
}
.faq details[open] summary::after {
  background: linear-gradient(var(--cyan-soft), var(--cyan-soft)) center / 100% 2px no-repeat;
}
.faq summary:hover { color: var(--cyan-soft); }
.faq p { margin: 0 0 1.5rem; max-width: 42rem; color: var(--ink-2); }
.card-bar { display: flex; align-items: center; gap: 0.75rem; margin: -0.25rem 0 1rem; color: var(--ink-2); font-family: var(--mono); font-size: 0.875rem; }
.card-bar-dots { width: 2.25rem; height: 0.5rem; background: radial-gradient(circle, #3b4a68 0.2rem, transparent 0.21rem) 0 50% / 0.75rem 0.5rem repeat-x; }

/* Public numbers: filled from the stats API once the section is near; until then only the link shows. */
.numbers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 0 0 1rem; }
.numbers > div { padding: 1.25rem; border-radius: 1rem; border: 1px solid var(--line); background: var(--panel); }
.numbers dt { color: var(--ink-2); font-size: 0.875rem; }
.numbers dd { margin: 0.5rem 0 0; font-family: var(--mono); font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2rem); font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 759px) { .numbers { grid-template-columns: repeat(2, 1fr); } }
.when { margin: 0 0 2rem; color: var(--ink-2); text-align: center; }

/* ── Footer ───────────────────────────────────────────────────────────────────────────────── */
.site-footer {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1.5rem;
  max-width: 72rem; margin: 0 auto; padding: 2rem 1.25rem 3rem;
  border-top: 1px solid var(--line); color: var(--ink-2);
}
.site-footer .brand { font-size: 1rem; }
.site-footer .brand img { width: 22px; height: 22px; border-radius: 4px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 1rem; margin: 0; padding: 0; list-style: none; }
.footer-links a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; }
.site-footer p { margin: 0; flex-basis: 100%; }

/* ── Reveals: only after the script has marked what is already on screen (no blink), and never with
   reduced motion. Without the script nothing is ever hidden. ─────────────────────────────────── */
html.reveal-ready [data-reveal] { transition: opacity 0.5s ease, transform 0.5s ease; }
html.reveal-ready [data-reveal]:not(.is-shown) { opacity: 0; transform: translateY(16px); }
@media (prefers-reduced-motion: reduce) {
  html.reveal-ready [data-reveal] { transition: none; }
  html.reveal-ready [data-reveal]:not(.is-shown) { opacity: 1; transform: none; }
}
