/* ═══════════════════════════════════════════
   epochly.io — the front door.

   One full-bleed scene, one centered claim, one rounded control. The
   scene is the product's chart world (graticule, decision boundary,
   sorted points). Type is Funnel Sans set clean and tight; the queue
   number keeps the product's instrument mono. Tokens are the app's,
   pared to what this page uses.
   ═══════════════════════════════════════════ */

:root {
  /* Ink world (dark) — matches app tokens. */
  --bg-deep: #0E1117;
  --text-primary: #F0EDE5;
  --text-secondary: rgba(240, 237, 229, 0.66);
  --text-tertiary: rgba(240, 237, 229, 0.42);
  --accent-light-rgb: 243 244 246;
  --negative: #f87171;
  --stud: #7eb6ff;
  --stud-glow: rgba(126, 182, 255, 0.45);

  /* The pill's frosted material and its solid action. */
  --pill-bg: rgba(14, 17, 23, 0.32);
  --pill-border: rgba(240, 237, 229, 0.16);
  --pill-border-focus: rgba(240, 237, 229, 0.34);
  --pill-ring: rgba(240, 237, 229, 0.1);
  --go-bg: #F0EDE5;
  --go-bg-hover: #FFFDF6;
  --go-fg: #1A1F2A;

  --font-sans: 'Funnel Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Recursive', 'SF Mono', ui-monospace, Menlo, monospace;

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 150ms var(--ease-out-expo);
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg-deep: #F6F3ED;
  --text-primary: #1A1F2A;
  --text-secondary: rgba(26, 31, 42, 0.7);
  --text-tertiary: rgba(26, 31, 42, 0.46);
  --accent-light-rgb: 20 20 20;
  --negative: #df1b41;
  --stud: #2563eb;
  --stud-glow: transparent;

  --pill-bg: rgba(255, 253, 249, 0.5);
  --pill-border: rgba(26, 31, 42, 0.12);
  --pill-border-focus: rgba(26, 31, 42, 0.3);
  --pill-ring: rgba(26, 31, 42, 0.07);
  --go-bg: #1A1F2A;
  --go-bg-hover: #2A3040;
  --go-fg: #F6F3ED;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
}

[hidden] {
  display: none !important;
}

.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;
}

/* ── The page ──────────────────────────────── */

.front {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg-deep);
}

/* One film of grain: dithers the sky's long gradients so they never
   band, and gives the drawn scene its material. */
.front::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  mix-blend-mode: overlay;
  opacity: 0.05;
}

:root[data-theme='light'] .front::after {
  opacity: 0.035;
}

/* ── The scene ─────────────────────────────── */

/* The scene is the product's chart world: a whisper of graticule over a
   deep wash, a decision boundary crossing low with its bloom, and the
   points it sorts. Not a landscape; the subject itself. */
.front__scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    radial-gradient(56% 30% at 50% 64%, rgba(126, 182, 255, 0.13), rgba(126, 182, 255, 0.04) 55%, transparent 78%),
    repeating-linear-gradient(0deg, rgba(240, 237, 229, 0.02) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(90deg, rgba(240, 237, 229, 0.02) 0 1px, transparent 1px 56px),
    linear-gradient(180deg, #090B10 0%, #0D1119 38%, #111828 64%, #0B0E14 100%);
  animation: front-fade 1200ms var(--ease-out-expo) both;
}

:root[data-theme='light'] .front__scene {
  background-image:
    radial-gradient(56% 30% at 50% 64%, rgba(93, 147, 240, 0.1), rgba(93, 147, 240, 0.03) 55%, transparent 78%),
    repeating-linear-gradient(0deg, rgba(26, 31, 42, 0.028) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(90deg, rgba(26, 31, 42, 0.028) 0 1px, transparent 1px 56px),
    linear-gradient(180deg, #FCFAF5 0%, #F6F3ED 46%, #EFEAE0 100%);
}

/* The chart: boundary and points, drifting slowly. */
.front__chart {
  position: absolute;
  inset: 0;
  animation: front-fade 1600ms var(--ease-out-expo) both;
}

.front__boundary {
  position: absolute;
  left: -5%;
  top: 66%;
  width: 110%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgb(200 220 255 / 0.5) 30%,
    rgb(200 220 255 / 0.5) 70%,
    transparent
  );
  box-shadow: 0 0 18px rgb(200 220 255 / 0.32);
  transform: rotate(-6deg);
  animation: front-boundary-drift 26s ease-in-out 1600ms infinite alternate;
}

:root[data-theme='light'] .front__boundary {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(75, 85, 105, 0.42) 30%,
    rgba(75, 85, 105, 0.42) 70%,
    transparent
  );
  box-shadow: none;
}

.front__points {
  position: absolute;
  inset: 0;
}

/* The points the boundary sorts: input blue above, mauve below. */
.front__point {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(126, 182, 255, 0.72);
  box-shadow: 0 0 10px rgba(126, 182, 255, 0.45);
  animation: front-point-float 16s ease-in-out infinite alternate;
}

.front__point--m {
  background: rgba(192, 132, 252, 0.6);
  box-shadow: 0 0 9px rgba(192, 132, 252, 0.35);
}

:root[data-theme='light'] .front__point {
  background: rgba(93, 147, 240, 0.6);
  box-shadow: none;
}

:root[data-theme='light'] .front__point--m {
  background: rgba(168, 85, 247, 0.5);
  box-shadow: none;
}

.front__point:nth-child(1) { left: 8%; top: 20%; }
.front__point:nth-child(2) { left: 15%; top: 44%; width: 2px; height: 2px; animation-duration: 20s; }
.front__point:nth-child(3) { left: 27%; top: 12%; }
.front__point:nth-child(4) { left: 38%; top: 30%; animation-duration: 19s; }
.front__point:nth-child(5) { left: 55%; top: 10%; }
.front__point:nth-child(6) { left: 68%; top: 26%; animation-duration: 22s; }
.front__point:nth-child(7) { left: 82%; top: 16%; }
.front__point:nth-child(8) { left: 91%; top: 38%; width: 2px; height: 2px; }
.front__point:nth-child(9) { left: 47%; top: 22%; animation-duration: 18s; }
.front__point:nth-child(10) { left: 12%; top: 84%; }
.front__point:nth-child(11) { left: 25%; top: 92%; width: 2px; height: 2px; animation-duration: 21s; }
.front__point:nth-child(12) { left: 44%; top: 86%; }
.front__point:nth-child(13) { left: 63%; top: 90%; animation-duration: 19s; }
.front__point:nth-child(14) { left: 78%; top: 80%; }
.front__point:nth-child(15) { left: 90%; top: 88%; width: 2px; height: 2px; }

/* The scrim: a quiet grade so the chrome at the top edge and the note
   near the ground stay legible over the scene. */
.front__scene::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(9, 11, 16, 0.26) 0%,
    rgba(9, 11, 16, 0.05) 24%,
    transparent 44% 78%,
    rgba(9, 11, 16, 0.18) 100%
  );
}

:root[data-theme='light'] .front__scene::after {
  background: linear-gradient(
    180deg,
    rgba(252, 250, 245, 0.42) 0%,
    rgba(252, 250, 245, 0.1) 24%,
    transparent 44% 80%,
    rgba(252, 250, 245, 0.24) 100%
  );
}

/* ── Chrome ────────────────────────────────── */

.front__chrome {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(20px, 3vh, 32px) clamp(24px, 4vw, 48px) clamp(24px, 4vh, 44px);
}

.front__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: front-rise 700ms var(--ease-out-expo) 750ms both;
}

.front__wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--text-primary);
}

/* The mark: the strata E, drawn in the page's ink. */
.front__mark {
  width: 19px;
  height: 19px;
}

/* The theme toggle: the app's header control, rounded to this page. */
.front__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  border-radius: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition:
    color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.front__toggle:hover {
  color: var(--text-primary);
  border-color: var(--pill-border-focus);
}

.front__toggle:active {
  transform: scale(0.94);
}

.front__toggle:focus-visible {
  outline: 2px solid rgb(var(--accent-light-rgb) / 0.8);
  outline-offset: 2px;
}

/* Dark shows the sun (the way out), light shows the moon. */
:root[data-theme='light'] .front__toggle-sun { display: none; }
:root[data-theme='dark'] .front__toggle-moon { display: none; }

/* ── The claim ─────────────────────────────── */

.front__stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  /* The claim sits a breath above true center, the way a horizon line
     wants company in the upper half. */
  padding-bottom: 9vh;
}

.front__title {
  max-width: 24ch;
  font-size: clamp(2.1rem, 4.6vw, 3.4rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.08;
  color: var(--text-primary);
  animation: front-rise 900ms var(--ease-out-expo) 150ms both;
}

.front__sub {
  margin-top: 18px;
  max-width: 44ch;
  font-size: clamp(0.98rem, 1.3vw, 1.08rem);
  font-weight: 400;
  color: var(--text-secondary);
  animation: front-rise 900ms var(--ease-out-expo) 300ms both;
}

/* ── The one control ───────────────────────── */

/* The act: form and end state share one reserved band, so the claim
   holds still when one replaces the other. */
.front__act {
  margin-top: clamp(26px, 4.5vh, 42px);
  min-height: 118px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* One frosted pill: the blank and the verb in a single rounded body. */
.front__pill {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(100%, 420px);
  padding: 5px 5px 5px 22px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  backdrop-filter: blur(14px) saturate(1.15);
  transition:
    border-color 220ms var(--ease-out-expo),
    box-shadow 220ms var(--ease-out-expo);
  animation: front-rise 900ms var(--ease-out-expo) 450ms both;
}

.front__pill:focus-within {
  border-color: var(--pill-border-focus);
  box-shadow: 0 0 0 4px var(--pill-ring);
}

.front__input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  border: none;
  background: none;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-primary);
  caret-color: var(--text-primary);
}

/* Secondary, not tertiary: the scene's horizon band sits behind this
   text, and tertiary drops under the 4.5:1 floor there. */
.front__input::placeholder {
  color: var(--text-secondary);
}

.front__input:focus {
  outline: none;
}

.front__go {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 22px;
  border: none;
  border-radius: 999px;
  background: var(--go-bg);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--go-fg);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    transform var(--transition-fast);
}

.front__go:hover {
  background: var(--go-bg-hover);
}

.front__go:active {
  transform: scale(0.97);
}

.front__go:focus-visible {
  outline: 2px solid rgb(var(--accent-light-rgb) / 0.8);
  outline-offset: 2px;
}

.front__go[disabled] {
  opacity: 0.55;
  cursor: default;
}

/* The honeypot: parked far offscreen, invisible to people. */
.front__hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.front__error {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--negative);
}

.front__note {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  animation: front-rise 900ms var(--ease-out-expo) 600ms both;
}

/* ── In line ───────────────────────────────── */

.front__done {
  outline: none;
}

.front__done-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--text-secondary);
  animation: front-rise 600ms var(--ease-out-expo) 80ms both;
}

/* The stud: joined state, lit in the earned blue. */
.front__stud {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--stud);
  box-shadow: 0 0 8px var(--stud-glow);
}

.front__done-number {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: clamp(2.2rem, 4.6vw, 3rem);
  font-weight: 600;
  line-height: 1.1;
  color: var(--text-primary);
  animation: front-rise 700ms var(--ease-out-expo) 180ms both;
}

.front__done-note {
  animation: front-rise 700ms var(--ease-out-expo) 320ms both;
}

/* ═══════════════════════════════════════════
   Motion
   ═══════════════════════════════════════════ */

@keyframes front-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes front-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes front-boundary-drift {
  from { transform: rotate(-5.2deg); }
  to { transform: rotate(-6.8deg); }
}

@keyframes front-point-float {
  from { translate: 0 0; }
  to { translate: 5px -7px; }
}

/* ── Narrow ────────────────────────────────── */

@media (max-width: 480px) {
  .front__stack {
    padding-bottom: 7vh;
  }

  .front__act {
    min-height: 124px;
  }

  .front__go {
    padding: 0 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .front__scene,
  .front__chart,
  .front__boundary,
  .front__point,
  .front__bar,
  .front__title,
  .front__sub,
  .front__pill,
  .front__note,
  .front__done-label,
  .front__done-number,
  .front__done-note {
    animation: none;
  }

  .front__toggle:active,
  .front__go:active {
    transform: none;
  }
}
