/* Mesopic landing page.
 *
 * Tokens are mirrored from the canonical HUD system in the engine repository
 * (mesopic/api/static/hud.css) so the local dashboard, the hosted dashboard and this page
 * read as one product. Values here are a copy, not an invention — change hud.css first,
 * then bring the change across. A test asserts this file still carries them (P5.7).
 *
 * The direction is that system's, not a new one: a darkroom. A camera product that
 * deliberately shows no picture, in the one room where images exist and are never
 * displayed. Surfaces are fibre-base paper under a lightbox. Safelight amber is reserved
 * and means one thing only — this engine is live — which on this page is spent in exactly
 * one place: the counting line in the hero.
 *
 * Two constraints, both deliberate. The CSP is `default-src 'self'` with no style-src or
 * font-src exception, so there are no webfonts, no CDN and no inline styles anywhere;
 * every rule lives in this file. And `-apple-system` resolves to San Francisco on Apple
 * hardware, which is a better face than anything we could fetch and costs no request.
 */

:root {
  color-scheme: light;

  /* Surfaces: fibre-base paper under a lightbox, not cream. */
  --ground: #e5e0d6;
  --panel: #f5f2ec;
  --panel-2: #ece7dd;
  --ink: #1e1a16;
  --muted: #6a6058;
  --line: #d6cfc3;
  --line-strong: #a99f92;
  --exposed: #7d7268;

  /* Reserved. Safelight = live. */
  --safelight: #9a5b02;
  --safelight-soft: rgba(154, 91, 2, 0.12);
  --fault: #a8341a;

  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;

  --lift: 0 1px 2px rgba(30, 26, 22, 0.05), 0 10px 30px rgba(30, 26, 22, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --ground: #17151a;
    --panel: #1f1c22;
    --panel-2: #272329;
    --ink: #f0eae0;
    --muted: #9c9289;
    --line: #2e2932;
    --line-strong: #4a434f;
    --exposed: #b3a89c;

    --safelight: #e9a23f;
    --safelight-soft: rgba(233, 162, 63, 0.14);
    --fault: #f0644e;

    --lift: 0 1px 2px rgba(0, 0, 0, 0.45), 0 10px 30px rgba(0, 0, 0, 0.4);
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* One container width, one gutter, everywhere. */
.masthead,
.hero,
.section-inner,
footer > p {
  max-width: 64rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--safelight);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- masthead ---------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.5rem;
}

.wordmark {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-decoration: none;
}

.masthead nav a { font-size: 0.9375rem; color: var(--muted); text-decoration: none; }
.masthead nav a:hover { color: var(--ink); }

/* ---------- hero ---------- */

.hero {
  padding-block: clamp(3.5rem, 9vw, 7rem) clamp(2.5rem, 5vw, 4rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
}

.hero.narrow { padding-block: clamp(4rem, 11vw, 8rem) 5rem; }

.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero h1 {
  margin: 0;
  /* The one place the type is allowed to be loud. Tight tracking at display sizes is what
     separates a headline from a large paragraph. */
  font-size: clamp(2.5rem, 6.4vw, 4.5rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 600;
  text-wrap: balance;
  max-width: 18ch;
}

.lede {
  margin: 0;
  max-width: 46ch;
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
  line-height: 1.55;
  color: var(--exposed);
}

.lede strong { color: var(--ink); font-weight: 600; }

.cta-row {
  margin: 0.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

/* Ink, not safelight. Safelight is reserved for "live", and a button is not that. */
.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.875rem;
  padding: 0 1.375rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--panel);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.cta:hover {
  color: var(--panel);
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: var(--lift);
}

.cta:active { transform: translateY(0); }

.cta-quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

.cta-quiet:hover { background: var(--panel); color: var(--ink); border-color: var(--ink); }

/* ---------- the instrument ----------
 *
 * The signature element. A plan view of a doorway: a zone, a counting line, and anonymous
 * points drifting across it. It is the product, and it argues the privacy claim without
 * saying anything — what you watch is dots, because dots are all the engine ever has.
 * Deliberately carries no numbers: a counter on a landing page is a claim, and this one
 * would be invented.
 */

.instrument {
  width: 100%;
  max-width: 46rem;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  align-items: center;
}

.instrument-frame {
  width: 100%;
  padding: 1.5rem 1.25rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--lift);
  overflow: hidden;
}

.instrument svg { display: block; width: 100%; height: auto; }

.zone { fill: none; stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 4 5; }
.wall { stroke: var(--line-strong); stroke-width: 1.5; stroke-linecap: round; }

/* The only saturated colour on the page, and it is doing the job the token reserves it
   for: the line is live, and it pulses because the engine is running. */
.countline {
  stroke: var(--safelight);
  stroke-width: 1.5;
  stroke-linecap: round;
  animation: breathe 5.2s ease-in-out infinite;
}

.zone-label {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.pt { fill: var(--exposed); }

/* Four lanes, staggered, at slightly different speeds so the pattern never reads as a
   loop. Two travel each way: a doorway counts in and out. */
.pt-a { animation: cross-r 9s linear infinite; }
.pt-b { animation: cross-r 11s linear infinite; animation-delay: -3.5s; }
.pt-c { animation: cross-l 10.5s linear infinite; animation-delay: -6s; }
.pt-d { animation: cross-l 12.5s linear infinite; animation-delay: -1.5s; }

@keyframes cross-r {
  0%   { transform: translateX(0);     opacity: 0; }
  8%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { transform: translateX(560px); opacity: 0; }
}

@keyframes cross-l {
  0%   { transform: translateX(0);      opacity: 0; }
  8%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { transform: translateX(-560px); opacity: 0; }
}

@keyframes breathe {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

.instrument-caption {
  margin: 0;
  max-width: 44ch;
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- sections ---------- */

.section { padding-block: clamp(3.5rem, 7vw, 5.5rem); }
.section + .section { padding-top: 0; }

.section-sunk {
  background: var(--panel);
  border-block: 1px solid var(--line);
  padding-block: clamp(3.5rem, 7vw, 5.5rem);
}

.section + .section-sunk { padding-top: clamp(3.5rem, 7vw, 5.5rem); }

.section-inner { display: flex; flex-direction: column; gap: 2rem; }

.section h2 {
  margin: 0;
  font-size: clamp(1.625rem, 3.2vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.026em;
  font-weight: 600;
  text-wrap: balance;
}

.section-lead { margin: -1rem 0 0; max-width: 52ch; color: var(--exposed); }

/* ---------- what it measures ---------- */

/* A hairline grid rather than six floating cards: these are six readings off one
   instrument, not six unrelated features. */
.metrics {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.metrics li {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.5rem 1.375rem;
  background: var(--panel);
}

.metrics b { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.012em; }
.metrics span { font-size: 0.9375rem; color: var(--muted); line-height: 1.5; }

/* ---------- why it is different ---------- */

.claims {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(21rem, 1fr));
  gap: 1.75rem 2.5rem;
}

.claims p { margin: 0; max-width: 46ch; color: var(--exposed); }

.claims b {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--ink);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.012em;
}

/* ---------- waitlist ---------- */

.quiet { color: var(--muted); }
.section-sunk p.quiet { max-width: 52ch; }

.signup {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 28rem;
  padding: 1.75rem;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.signup label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--exposed);
}

.signup label + * { margin-bottom: 0.75rem; }

.signup input,
.signup select {
  width: 100%;
  min-height: 2.875rem;
  padding: 0 0.875rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.signup input::placeholder { color: var(--muted); }

.signup input:focus-visible,
.signup select:focus-visible {
  outline: none;
  border-color: var(--safelight);
  box-shadow: 0 0 0 3px var(--safelight-soft);
}

.signup button {
  min-height: 2.875rem;
  margin-top: 0.25rem;
  padding: 0 1.375rem;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--panel);
  background: var(--ink);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: opacity 140ms ease, transform 140ms ease;
}

.signup button:hover { opacity: 0.9; transform: translateY(-1px); }
.signup button:active { transform: translateY(0); }

.fineprint { margin: 0.875rem 0 0; font-size: 0.8125rem; line-height: 1.5; color: var(--muted); }

/* ---------- footer ---------- */

footer {
  margin-top: clamp(3.5rem, 7vw, 5.5rem);
  padding-block: 2.5rem 3.5rem;
  border-top: 1px solid var(--line);
}

footer p { margin: 0; font-size: 0.9375rem; line-height: 1.6; color: var(--muted); }
footer strong { color: var(--exposed); }

/* ---------- accessibility ---------- */

@media (prefers-reduced-motion: reduce) {
  /* The points stop travelling and simply sit in the zone. The diagram still reads; it
     just stops moving. */
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .pt { opacity: 1; }
}

@media (max-width: 34rem) {
  body { font-size: 16px; }
  .hero { gap: 1.25rem; }
  .signup { padding: 1.375rem; }
}
