/*
 * uVote public site — the only stylesheet.
 *
 * COLOURS ARE COPIED FROM artifacts/uVote/theme/tokens.ts, never invented.
 * Every colour below is a custom property declared on :root (light) or in the
 * dark-mode block, and each carries a comment naming the token it copies.
 * `pnpm --filter @workspace/scripts check:site` fails when a value drifts from
 * tokens.ts, when a colour lacks its token comment, or when a hex appears
 * anywhere outside these declarations. Change tokens.ts first, then here.
 */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/inter-latin-700-normal.woff2") format("woff2"); }

:root {
  --bg: #FAFAF7; /* palettes.light.bg */
  --card: #FFFFFF; /* palettes.light.card */
  --text: #2C2C2A; /* palettes.light.text */
  --muted: #6E6D67; /* palettes.light.textMuted */
  --line: #E8E6DF; /* palettes.light.line */
  --outline: #8B8A82; /* palettes.light.controlOutline */
  --primary: #534AB7; /* palettes.light.primary */
  --on-primary: #FFFFFF; /* palettes.light.onPrimary */
  --attention: #9A5B00; /* palettes.light.accentText */
  --approve: #15785A; /* palettes.light.voteApprove */
  --bar-1: #D85A30; /* markBars.0 */
  --bar-2: #EF9F27; /* markBars.1 */
  --bar-3: #1D9E75; /* markBars.2 */
  --bar-4: #378ADD; /* markBars.3 */
  --bar-5: #7F77DD; /* markBars.4 */

  --radius-card: 10px;
  --radius-control: 8px;
  --measure: 44rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191919; /* palettes.dark.bg */
    --card: #232323; /* palettes.dark.card */
    --text: #F1EFE8; /* palettes.dark.text */
    --muted: #B4B2A9; /* palettes.dark.textMuted */
    --line: #333330; /* palettes.dark.line */
    --outline: #7A7972; /* palettes.dark.controlOutline */
    --primary: #7F77DD; /* palettes.dark.primary */
    --on-primary: #15132A; /* palettes.dark.onPrimary */
    --attention: #EF9F27; /* palettes.dark.accentText */
    --approve: #1D9E75; /* palettes.dark.voteApprove */
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
}

.wrap { max-width: 64rem; margin: 0 auto; padding: 0 1rem; }

a { color: var(--primary); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

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

.skip {
  position: absolute; left: 1rem; top: -4rem;
  background: var(--card); color: var(--text);
  padding: 0.5rem 0.75rem; border: 1px solid var(--outline); border-radius: var(--radius-control);
  z-index: 10;
}
.skip:focus { top: 1rem; }

/* ── header ─────────────────────────────────────────────────────────────── */
.site-header { border-bottom: 1px solid var(--line); }
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 4rem; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  color: var(--text); text-decoration: none;
  font-weight: 700; font-size: 1.2rem; letter-spacing: -0.01em;
}
.top-nav { display: flex; gap: 1.25rem; }
.top-nav a { color: var(--text); text-decoration: none; font-weight: 500; font-size: 0.95rem; padding: 0.25rem 0; }
.top-nav a[aria-current="page"] { color: var(--primary); box-shadow: inset 0 -2px 0 var(--primary); }

/* ── type ───────────────────────────────────────────────────────────────── */
main.wrap { padding-top: 2.5rem; padding-bottom: 4rem; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.015em; }
h1 { font-size: clamp(1.75rem, 5vw, 2.6rem); font-weight: 700; margin: 0 0 1rem; }
h2 { font-size: clamp(1.3rem, 3.5vw, 1.65rem); font-weight: 700; margin: 3rem 0 1rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin: 1.75rem 0 0.5rem; }
p, li { margin: 0.5rem 0; }
ul, ol { padding-left: 1.4rem; }
strong { font-weight: 600; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: var(--measure); }
.muted { color: var(--muted); }
.prose { max-width: var(--measure); }
.small { font-size: 0.9rem; }

/* A label the user sees in the app, quoted exactly. */
.ui {
  font-weight: 600;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.05rem 0.4rem;
  /* Long labels wrap at 360px; each line keeps its own chip edges. */
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ── landing ────────────────────────────────────────────────────────────── */
.hero { display: grid; gap: 2rem; align-items: center; padding: 1rem 0 1.5rem; }
.hero-mark { width: 9rem; height: auto; }
@media (min-width: 48rem) {
  .hero { grid-template-columns: 1fr auto; }
  .hero-mark { width: 13rem; }
}

.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin-top: 1.5rem; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3rem; padding: 0.6rem 1.25rem;
  background: var(--primary); color: var(--on-primary);
  border-radius: var(--radius-control);
  font-weight: 600; text-decoration: none;
}
.button:hover { text-decoration: underline; }
.button.ghost { background: transparent; color: var(--text); border: 1px solid var(--outline); }

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-card); padding: 1.1rem 1.2rem;
}
.card h3 { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.audiences { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.audiences li {
  margin: 0; padding: 0.35rem 0.8rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
}

.steps { list-style: none; padding: 0; counter-reset: step; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.steps > li {
  counter-increment: step; margin: 0;
  background: var(--card); border: 1px solid var(--line);
  border-top: 4px solid var(--bar-1);
  border-radius: var(--radius-card); padding: 1rem 1.1rem;
}
.steps > li:nth-child(2) { border-top-color: var(--bar-2); }
.steps > li:nth-child(3) { border-top-color: var(--bar-3); }
.steps > li:nth-child(4) { border-top-color: var(--bar-4); }
.steps > li:nth-child(5) { border-top-color: var(--bar-5); }
.steps > li::before {
  content: counter(step); display: block;
  font-weight: 700; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.25rem;
}
.steps h3 { margin: 0 0 0.35rem; }

/* A portrait phone recording: capped so it never fills a desktop screen. */
.demo { margin: 0; max-width: 20rem; }
.demo video {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: var(--radius-card);
  background: var(--card);
}
.demo figcaption { margin-top: 0.5rem; }

.callout {
  border: 1px solid var(--line); border-left: 4px solid var(--primary);
  background: var(--card); border-radius: var(--radius-card);
  padding: 1.1rem 1.25rem; max-width: var(--measure);
}
.callout.attention { border-left-color: var(--attention); }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }

.plans { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.plan h3 { margin: 0; }
.plan .price { font-size: 1.4rem; font-weight: 700; margin: 0.25rem 0 0.5rem; }
.badge {
  display: inline-block; font-size: 0.8rem; font-weight: 600;
  border: 1px solid var(--outline); border-radius: 999px; padding: 0.05rem 0.55rem;
  color: var(--muted); vertical-align: middle;
}
.badge.ok { border-color: var(--approve); color: var(--approve); }

/* ── tutorial ───────────────────────────────────────────────────────────── */
.toc { columns: 2 14rem; padding-left: 1.4rem; }
.tutorial section { max-width: var(--measure); }
.tutorial h2 { scroll-margin-top: 1rem; }
.tutorial ol > li { margin: 0.6rem 0; }

/* ── FAQ ────────────────────────────────────────────────────────────────── */
.faq { max-width: var(--measure); }
.faq details {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-card); margin: 0.75rem 0;
}
.faq summary {
  cursor: pointer; padding: 1rem 1.2rem; font-weight: 600; list-style-position: inside;
  border-radius: var(--radius-card);
}
.faq details[open] summary { border-bottom: 1px solid var(--line); }
.faq details > :not(summary) { margin: 0.75rem 1.2rem; }
.faq details > :last-child { margin-bottom: 1rem; }

/* ── legal ──────────────────────────────────────────────────────────────── */
.legal { max-width: var(--measure); }
.legal h2 { font-size: 1.25rem; margin-top: 2.25rem; }
.legal .meta { color: var(--muted); font-size: 0.95rem; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; vertical-align: top; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--line); }
th { font-weight: 600; }

/* ── footer ─────────────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); padding: 2rem 0 2.5rem; color: var(--muted); font-size: 0.95rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-bottom: 1rem; }
.footer-nav a { color: var(--text); }
.footer-nav a[aria-current="page"] { color: var(--primary); font-weight: 600; }
.site-footer p { margin: 0.25rem 0; }
