/* ─────────────────────────────────────────────────────────────────────────────
   AudioPaper site — one stylesheet, no dependencies.
   Tokens follow the app icon: GlassPowerTools' screen red (#E7090A) on neutral
   surfaces. Dark first, light when the system asks for it.
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  --brand:          #e7090a;
  --link:           oklch(72% 0.17 27);
  --brand-soft:     oklch(60% 0.23 29 / 0.20);

  --void:           #0c0a0a;
  --surface:        #151212;
  --surface-raised: #1d1919;
  --border:         rgba(255, 255, 255, 0.08);
  --border-strong:  rgba(255, 255, 255, 0.16);

  --text:           oklch(96% 0.004 30);
  --text-muted:     oklch(74% 0.01 30);
  --text-dim:       oklch(58% 0.01 30);

  --pad-x:          clamp(16px, 5vw, 56px);
  --max:            1040px;
  --read:           720px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --link:           oklch(50% 0.2 28);
    --brand-soft:     oklch(62% 0.2 29 / 0.14);
    --void:           #f8f6f5;
    --surface:        #ffffff;
    --surface-raised: #f3f0ef;
    --border:         rgba(0, 0, 0, 0.08);
    --border-strong:  rgba(0, 0, 0, 0.16);
    --text:           oklch(20% 0.006 30);
    --text-muted:     oklch(44% 0.01 30);
    --text-dim:       oklch(50% 0.01 30);  /* ≥ 4.5:1 on the light background (WCAG 1.4.3) */
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--void);
  color: var(--text);
  font: 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
/* Links inside running text are underlined, so they don't rely on colour alone (WCAG 1.4.1). */
p a, li a, td a, figcaption a, .caption a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--link) 55%, transparent);
}
p a:hover, li a:hover, td a:hover, figcaption a:hover { text-decoration-color: currentColor; }
.toc a { text-decoration: none; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 16px;
  top: 12px;
  z-index: 10;
  background: var(--surface-raised);
  padding: 8px 12px;
  border-radius: 8px;
}

code, pre, kbd { font-family: var(--mono); font-size: 0.88em; }
code {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 5px;
  overflow-wrap: anywhere;
}
pre {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  padding: 14px 16px;
  border-radius: 10px;
  overflow-x: auto;
  line-height: 1.5;
}
pre code { background: none; border: 0; padding: 0; }

kbd {
  display: inline-block;
  min-width: 1.9em;
  padding: 2px 7px;
  text-align: center;
  font-family: var(--font);
  font-size: 0.9em;
  font-weight: 500;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  white-space: nowrap;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-size: clamp(24px, 3.4vw, 30px); margin: 0 0 16px; }
h3 { font-size: 19px; margin: 28px 0 8px; }
p, li { color: var(--text-muted); }
strong { color: var(--text); font-weight: 600; }

/* ──────────── Header & footer ──────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--void) 82%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--border);
}
.site-header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 10px var(--pad-x);
  display: flex;
  align-items: center;
  gap: 8px 24px;
  flex-wrap: wrap;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-weight: 650;
}
.wordmark:hover { text-decoration: none; }
.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
  margin-left: auto;
}
.site-header nav a {
  color: var(--text-muted);
  font-size: 15px;
  padding: 4px 10px;
  border-radius: 999px;
}
.site-header nav a:hover { color: var(--text); text-decoration: none; background: var(--surface-raised); }
.site-header nav a[aria-current="page"] { color: var(--text); background: var(--surface-raised); }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px var(--pad-x) 40px;
  text-align: center;
  font-size: 15px;
}
.site-footer p { margin: 6px 0; }
.fine { font-size: 13px; color: var(--text-dim); }

/* ──────────── Layout ──────────── */

.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 56px var(--pad-x);
}
.section + .section { border-top: 1px solid var(--border); }
.narrow { max-width: calc(var(--read) + 2 * var(--pad-x)); }
.lede { font-size: 19px; }

/* ──────────── Hero ──────────── */

.hero {
  padding: 56px var(--pad-x) 40px;
  text-align: center;
  background: radial-gradient(ellipse 760px 420px at 50% 0%, var(--brand-soft), transparent 70%);
}
.hero-icon {
  width: 144px;
  height: 144px;
  display: block;
  margin: 0 auto 20px;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.45));
}
.hero h1 {
  font-size: clamp(40px, 7vw, 60px);
  margin: 0;
  letter-spacing: -0.025em;
}
.tagline {
  font-size: clamp(20px, 2.6vw, 24px);
  color: var(--text);
  margin: 8px 0 18px;
}
.hero .sub { max-width: 620px; margin: 0 auto; }
.actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 26px 0 14px;
}
.button {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 16px;
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: var(--surface-raised);
}
.button:hover { text-decoration: none; border-color: var(--text-dim); }
.button.primary { background: var(--brand); border-color: transparent; color: #fff; }
.button.primary:hover { filter: brightness(1.08); }
.facts { font-size: 14px; color: var(--text-dim); margin: 0; }

/* ──────────── The desktop illustration ──────────── */

.demo {
  max-width: 820px;
  margin: 8px auto 0;
  padding: 0 var(--pad-x);
}
.desktop {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  background: #221;
}
.desktop .menubar {
  position: absolute;
  inset: 0 0 auto;
  height: 4.2%;
  background: rgba(0, 0, 0, 0.18);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  z-index: 3;
}
.desktop.real { background: #000; }
.desktop.real img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin: 0 0 28px;
}
.gallery figure { margin: 0; }
.gallery img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
}
.gallery figcaption, .caption { font-size: 14px; color: var(--text-dim); margin-top: 10px; }
.gallery figcaption strong { color: var(--text-muted); }
.minis {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.minis img { width: min(300px, 100%); height: auto; }
.caption { text-align: center; max-width: 640px; margin: 8px auto 0; }

.demo figcaption {
  font-size: 14px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 14px;
}

/* ──────────── Content blocks ──────────── */

.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.steps li {
  counter-increment: step;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}
.steps li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
}
.steps h3 { margin: 0 0 6px; font-size: 17px; }
.steps p { margin: 0; font-size: 15.5px; }

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px 40px;
}
.split h3:first-child { margin-top: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
}
.card h3 { margin-top: 0; }

ul.plain { padding-left: 1.1em; }
ul.plain li { margin: 6px 0; }

.handback {
  font-size: 19px;
  color: var(--text);
}

.callout {
  border-left: 3px solid var(--brand);
  background: var(--surface);
  padding: 14px 18px;
  border-radius: 0 10px 10px 0;
  margin: 18px 0;
}
.callout p { margin: 0; }

/* ──────────── Docs pages ──────────── */

.doc {
  max-width: calc(var(--read) + 2 * var(--pad-x));
  margin: 0 auto;
  padding: 44px var(--pad-x) 64px;
}
.doc h1 { font-size: clamp(32px, 5vw, 44px); margin: 0 0 12px; letter-spacing: -0.02em; }
.doc h2 { margin-top: 48px; padding-top: 8px; }
.doc h2:first-of-type { margin-top: 36px; }
.doc .intro { font-size: 19px; }
.doc-source { font-size: 14px; color: var(--text-dim); margin-top: 0; }
.doc li { margin: 5px 0; }
.doc section[id], .doc h2[id], .doc h3[id] { scroll-margin-top: 72px; }

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 20px;
  margin: 24px 0 8px;
  font-size: 15px;
}
.toc ol { margin: 6px 0 0; padding-left: 1.2em; columns: 2 220px; }
.toc li { margin: 3px 0; }

.table-wrap { overflow-x: auto; margin: 16px 0; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}
th { color: var(--text); font-weight: 600; background: var(--surface); }
td { color: var(--text-muted); }
td:first-child { color: var(--text); }
.keys td:first-child { white-space: nowrap; width: 1%; }

figure.shot { margin: 24px 0; }
figure.shot img {
  display: block;
  margin: 0 auto;
  border-radius: 12px;
}
figure.shot figcaption { font-size: 14px; color: var(--text-dim); text-align: center; margin-top: 10px; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  /* One row that scrolls sideways, so the sticky header stays short. */
  .site-header nav {
    margin: 0 -10px;
    width: calc(100% + 20px);
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .site-header nav a { flex: none; }
  .hero-icon { width: 112px; height: 112px; }
  .section { padding: 40px var(--pad-x); }
}
