@import url("/css/fonts.css");

/* ============================================================
   FloType — flotype.app
   Design notes:
   - Body face is Atkinson Hyperlegible, designed by the Braille
     Institute specifically for low-vision readers. Unambiguous
     letterforms are the point, not decoration. Do not swap it.
   - Display face is Bricolage Grotesque (variable) — tight,
     contemporary, a bit odd in the good way.
   - Dark is the default, but BOTH themes are first-class and
     there is a manual toggle: some low-vision conditions need
     dark-on-light and some need the opposite.
   - Accent is a signal lime used as a FILL with near-black text
     on it, which keeps it high-contrast in both themes (16.70:1).
     A separate --accent-text token carries the readable version
     for links, because lime text on a light background fails
     (1.34:1) — the light theme uses #3F5C00 instead, at 7.39:1.
     NOTE when swapping the accent: replace this prose BEFORE the
     hex values, or the hexes inside it change first and this block
     silently stops matching.
   - Every colour pair is checked to at least WCAG AA; body text
     pairs clear AAA.
   ============================================================ */

:root {
  color-scheme: dark;

  --bg:         #0B0B0F;
  --bg-2:       #131318;
  --bg-3:       #1C1C23;
  --ink:        #F4F4F7;
  --ink-2:      #A9A9B8;
  --accent:     #C9FF3D;   /* fill */
  --accent-text:#C9FF3D;   /* readable on --bg */
  --accent-ink: #0B0B0F;   /* text ON the fill */
  --line:       #2A2A33;
  --line-2:     #3A3A46;
  --focus:      #8FD0FF;
  --glow-a:     rgba(201, 255, 61, 0.13);
  --glow-b:     rgba(124, 92, 255, 0.14);
  --dot-ring:   transparent;

  --font-display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Atkinson Hyperlegible", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --measure: 38rem;
  --shell: 76rem;
  --radius: 10px;
  --radius-lg: 18px;

  --step--1: clamp(0.95rem, 0.92rem + 0.15vw, 1.05rem);
  --step-0:  clamp(1.09rem, 1.03rem + 0.28vw, 1.28rem);
  --step-1:  clamp(1.32rem, 1.20rem + 0.55vw, 1.70rem);
  --step-2:  clamp(1.65rem, 1.42rem + 1.05vw, 2.40rem);
  --step-3:  clamp(2.10rem, 1.60rem + 2.30vw, 3.90rem);
  --step-4:  clamp(2.70rem, 1.70rem + 4.60vw, 6.60rem);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg:         #FBFBF9;
  --bg-2:       #F2F2EE;
  --bg-3:       #E7E7E1;
  --ink:        #101014;
  --ink-2:      #52525E;
  --accent:     #C9FF3D;
  --accent-text:#3F5C00;
  --accent-ink: #0B0B0F;
  --line:       #DEDED6;
  --line-2:     #C6C6BC;
  --focus:      #0B4F78;
  --glow-a:     rgba(154, 200, 40, 0.16);
  --glow-b:     rgba(124, 92, 255, 0.10);
  --dot-ring:   rgba(11, 11, 15, 0.78);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg:         #FBFBF9;
    --bg-2:       #F2F2EE;
    --bg-3:       #E7E7E1;
    --ink:        #101014;
    --ink-2:      #52525E;
    --accent:     #C9FF3D;
    --accent-text:#3F5C00;
    --accent-ink: #0B0B0F;
    --line:       #DEDED6;
    --line-2:     #C6C6BC;
    --focus:      #0B4F78;
    --glow-a:     rgba(154, 200, 40, 0.16);
    --glow-b:     rgba(124, 92, 255, 0.10);
    --dot-ring:   rgba(11, 11, 15, 0.78);
  }
}

@media (prefers-contrast: more) {
  :root { --ink-2: var(--ink); --line: var(--ink); --line-2: var(--ink); }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Fine grain over the whole page — stops flat dark areas looking dead.
   Decorative only, and cheap: one inline SVG, no image request. */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Skip link ---------- */
.skip {
  position: absolute; left: 0.5rem; top: -100vh;
  z-index: 999;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700;
  padding: 0.85rem 1.25rem;
  border-radius: 0 0 var(--radius) var(--radius);
  text-decoration: none;
}
.skip:focus { top: 0; }

/* ---------- Focus ---------- */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Layout ---------- */
.shell { width: min(100% - 2.5rem, var(--shell)); margin-inline: auto; position: relative; z-index: 2; }
.prose { max-width: var(--measure); }
main { display: block; }
section { padding-block: clamp(3.25rem, 7vw, 6.5rem); position: relative; }
section + section { border-top: 1px solid var(--line); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 0 0 0.55em;
  text-wrap: balance;
}
h1 { font-size: var(--step-4); font-weight: 800; letter-spacing: -0.045em; }
h2 { font-size: var(--step-3); margin-top: 0; }
h3 { font-size: var(--step-1); letter-spacing: -0.02em; }
h4 { font-size: var(--step-0); font-family: var(--font-body); font-weight: 700; letter-spacing: 0; }

p, li { text-wrap: pretty; }
p { margin: 0 0 1.15em; }
.lede { font-size: var(--step-1); line-height: 1.5; color: var(--ink-2); letter-spacing: -0.011em; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin: 0 0 1.4rem;
  padding: 0.4rem 0.85rem 0.4rem 0.7rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
}
.eyebrow::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

a { color: var(--accent-text); text-underline-offset: 0.22em; text-decoration-thickness: 2px; }
a:hover { text-decoration-thickness: 3px; }

strong { font-weight: 700; color: var(--ink); }
code, kbd {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1em 0.42em;
}

hr { border: 0; border-top: 1px solid var(--line); margin: 3rem 0; }

/* ---------- Header / nav ---------- */
.masthead {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.masthead-inner {
  display: flex; align-items: center; gap: 1rem;
  flex-wrap: wrap;
  padding-block: 0.7rem;
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.75rem, 1.45rem + 1.1vw, 2.4rem);
  letter-spacing: -0.05em;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
  padding: 0.3rem 0.1rem;
}
.wordmark span { color: var(--accent-text); }

.nav ul {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.15rem;
  list-style: none; margin: 0; padding: 0;
}
.nav a {
  position: relative;
  padding: 0.7rem 0.85rem;
  min-height: 48px;
  display: flex; align-items: center;
  color: var(--ink-2);
  text-decoration: none;
  font-size: var(--step--1);
  font-weight: 700;
  border-radius: 8px;
}
.nav a:hover { color: var(--ink); background: var(--bg-2); }
.nav a[aria-current="page"] { color: var(--ink); }
/* Straight bar via a pseudo-element — an inset box-shadow follows the
   border-radius and bows upward at the ends. */
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0.85rem; right: 0.85rem; bottom: 0.5rem;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.theme-toggle {
  min-height: 48px; min-width: 48px;
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1rem;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-2); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.6rem;
  min-height: 56px;
  padding: 0.9rem 1.6rem;
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  border-radius: var(--radius);
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); background: var(--bg-2); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-top: 2.25rem; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(3.5rem, 9vw, 8.5rem); overflow: hidden; }
.hero::before {
  /* Soft off-centre glow. Purely atmospheric. */
  content: "";
  position: absolute; inset: -30% -10% auto -10%;
  height: 130%;
  pointer-events: none;
  background:
    radial-gradient(52% 46% at 22% 30%, var(--glow-a), transparent 70%),
    radial-gradient(46% 40% at 82% 18%, var(--glow-b), transparent 72%);
}
.hero h1 { margin-bottom: 0.3em; }
.hero .lede { max-width: 34rem; }
.hero-grid { display: grid; gap: 3rem; align-items: center; }
@media (min-width: 62rem) {
  .hero-grid { grid-template-columns: 1.1fr 0.9fr; gap: 4rem; }
}

/* Decorative tap-field: imprecise taps resolving into a word.
   Ornamental -> aria-hidden in the markup. */
.tapfield {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, var(--bg-3), var(--bg-2) 65%);
  overflow: hidden;
}
.tapfield::before {
  /* faint key grid */
  content: "";
  position: absolute; inset: 0;
  opacity: 0.5;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 10% 25%;
  mask-image: radial-gradient(70% 60% at 50% 40%, #000 30%, transparent 78%);
}
.tapfield .dot {
  position: absolute;
  width: 10%; aspect-ratio: 1;
  border-radius: 50%;
  background: var(--accent);
  /* Lime at low opacity over near-black turns olive, so keep the floor
     high and use a glow for the "soft tap" feel instead of transparency. */
  opacity: 0.55;
  /* Ring is transparent on dark and dark on light, where the lime falls to
     1.34:1 against the near-white ground and the dots all but disappear. */
  box-shadow: 0 0 0 2px var(--dot-ring), 0 0 22px 6px var(--glow-a);
  filter: blur(3px);
  transform: translate(-50%, -50%);
  animation: settle 5.5s ease-in-out infinite;
}
.tapfield .word {
  position: absolute; inset: auto 0 11% 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.2rem, 6.5vw, 3.8rem);
  letter-spacing: -0.05em;
  color: var(--ink);
}
@keyframes settle {
  0%, 100% { opacity: 0.42; filter: blur(6px); }
  50%      { opacity: 0.95; filter: blur(0.5px); }
}
@media (prefers-reduced-motion: reduce) {
  .tapfield .dot { animation: none; opacity: 0.8; filter: blur(1.5px); }
}

/* ---------- Cards ---------- */
/* 22rem min lands this at 3 columns inside the 76rem shell, so a six-card
   set reads as 3+3 rather than a lopsided 4+2. Sets of 2 or 3 still fill
   the row, because auto-fit collapses the empty tracks. */
.cards {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  margin: 2.75rem 0 0;
  padding: 0; list-style: none;
}
.card {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.7rem;
}
.card::before {
  /* hairline highlight along the top edge */
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(to right, transparent, var(--line-2), transparent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.card h3 { margin-bottom: 0.4em; }
.card p:last-child { margin-bottom: 0; }
.card p { color: var(--ink-2); font-size: var(--step--1); }

/* ---------- Numbered steps ---------- */
.steps { counter-reset: step; list-style: none; margin: 2.75rem 0 0; padding: 0; display: grid; gap: 1.75rem; }
@media (min-width: 52rem) { .steps { grid-template-columns: repeat(4, 1fr); } }
.steps li { counter-increment: step; padding-top: 1.1rem; border-top: 2px solid var(--line-2); }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  margin-bottom: 0.7rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.4rem;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--accent-text);
}
.steps h3 { font-size: var(--step-0); font-family: var(--font-body); font-weight: 700; letter-spacing: 0; margin-bottom: 0.3em; }
.steps p { color: var(--ink-2); font-size: var(--step--1); margin: 0; }

/* ---------- Gesture list ---------- */
.gestures { list-style: none; margin: 1.75rem 0 0; padding: 0; }
.gestures > li,
.gestures > div {
  display: grid; gap: 0.15rem 1.75rem;
  padding: 1.05rem 0;
  border-top: 1px solid var(--line);
}
.gestures > li:last-child,
.gestures > div:last-child { border-bottom: 1px solid var(--line); }
@media (min-width: 46rem) {
  .gestures > li,
  .gestures > div { grid-template-columns: 16rem 1fr; align-items: baseline; }
}
.gestures dt, .gesture-name { font-weight: 700; color: var(--ink); }
.gestures dd, .gesture-desc { margin: 0; color: var(--ink-2); }

/* ---------- Callout ---------- */
.callout {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.5rem 1.7rem;
  margin: 2rem 0;
}
.callout > :last-child { margin-bottom: 0; }
.callout h3 { font-size: var(--step-0); font-family: var(--font-body); font-weight: 700; letter-spacing: 0; margin-bottom: 0.45em; }

/* ---------- CTA band ---------- */
.band { background: var(--bg-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.band h2 { margin-bottom: 0.35em; }

/* ---------- Prose lists ---------- */
.prose ul, .prose ol { padding-left: 1.35em; }
.prose li { margin-bottom: 0.55em; }
.prose li::marker { color: var(--accent-text); }

/* ---------- Footer ---------- */
.foot {
  border-top: 1px solid var(--line);
  padding-block: 3.25rem;
  font-size: var(--step--1);
  color: var(--ink-2);
}
.foot-grid { display: grid; gap: 2rem; }
@media (min-width: 46rem) { .foot-grid { grid-template-columns: 2fr 1fr 1fr; } }
.foot h2 { font-size: 0.78rem; font-family: var(--font-body); font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); margin-bottom: 1em; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin-bottom: 0.55em; }
.foot a { color: var(--ink-2); }
.foot a:hover { color: var(--accent-text); }
.fineprint { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); color: var(--ink-2); }
.fineprint p { margin-bottom: 0.6em; }

/* ---------- Utility ---------- */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.center { text-align: center; margin-inline: auto; }
.stack-lg > * + * { margin-top: 2.5rem; }

/* Page-load reveal — one orchestrated moment, disabled for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: rise 0.75s cubic-bezier(0.22, 1, 0.36, 1) backwards; }
  .reveal:nth-child(1) { animation-delay: 0.04s; }
  .reveal:nth-child(2) { animation-delay: 0.12s; }
  .reveal:nth-child(3) { animation-delay: 0.2s; }
  .reveal:nth-child(4) { animation-delay: 0.28s; }
  @keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
}

@media print {
  .masthead, .theme-toggle, .tapfield, .btn-row { display: none; }
  body { background: #fff; color: #000; }
  body::after { display: none; }
}
