/* Ambient Analytics — site styles.
   No build step, no web fonts, no scripts: the CSP in public/_headers allows
   same-origin styles and images only. Colour tokens live on :root and are
   redefined once for dark mode. */

:root {
  --paper: #f6f5f1;
  --paper-2: #edebe4;
  --ink: #15191f;
  --ink-2: #434a55;
  --ink-3: #5d6470;
  --rule: #d9d6cc;
  --accent: #0f6e66;
  --accent-ink: #ffffff;
  --glow-1: rgb(31 158 143 / 0.30);
  --glow-2: rgb(230 168 80 / 0.24);
  --glow-3: rgb(96 122 214 / 0.18);
  --dots: rgb(21 25 31 / 0.10);
  --todo-bg: #fff3bf;
  --todo-ink: #5c4300;
  --todo-rule: #c99700;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wrap: 72rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --radius: 14px;
  --header-h: 4rem;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1216;
    --paper-2: #151a20;
    --ink: #ecebe6;
    --ink-2: #c3c8d0;
    --ink-3: #8f97a3;
    --rule: #28303a;
    --accent: #5fd3c4;
    --accent-ink: #06201d;
    --glow-1: rgb(31 158 143 / 0.28);
    --glow-2: rgb(214 150 64 / 0.16);
    --glow-3: rgb(96 122 214 / 0.20);
    --dots: rgb(236 235 230 / 0.08);
    --todo-bg: #3a3112;
    --todo-ink: #ffe28a;
    --todo-rule: #a88413;

    color-scheme: dark;
  }
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--accent); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { margin: 0; line-height: 1.12; letter-spacing: -0.02em; font-weight: 650; text-wrap: balance; }
h1 { font-size: clamp(2.25rem, 5.5vw + 0.5rem, 4.25rem); letter-spacing: -0.035em; }
h2 { font-size: clamp(1.75rem, 2.6vw + 0.75rem, 2.625rem); letter-spacing: -0.028em; }
h3 { font-size: 1.1875rem; letter-spacing: -0.01em; }
p { margin: 0; text-wrap: pretty; }

address { font-style: normal; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px));
}

.eyebrow {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  padding: 0.5rem 0.875rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 8px;
  text-decoration: none;
}
.skip:focus { top: calc(env(safe-area-inset-top, 0px) + 0.75rem); }

/* Draft placeholders: visible in the page so a preview shows what is still
   missing. scripts/check.mjs fails the deploy while any remain. */
.todo {
  background: var(--todo-bg);
  color: var(--todo-ink);
  outline: 1px dashed var(--todo-rule);
  outline-offset: 1px;
  border-radius: 4px;
  padding-inline: 0.2em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 70%, transparent);
}

.site-header .wrap {
  min-height: var(--header-h);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-block: 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--ink);
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand .mark { width: 28px; height: 28px; }

.site-header nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.site-header nav a {
  color: var(--ink-2);
  font-size: 0.9375rem;
  text-decoration: none;
  padding-block: 0.25rem;
}
.site-header nav a:hover { color: var(--ink); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(4.5rem, 12vw, 9.5rem) clamp(4rem, 9vw, 7rem);
  border-bottom: 1px solid var(--rule);
}

/* The "ambient" field: three soft light sources drifting slowly. */
.field {
  position: absolute;
  inset: -25%;
  z-index: -2;
  background:
    radial-gradient(38% 46% at 22% 34%, var(--glow-1), transparent 70%),
    radial-gradient(32% 40% at 78% 22%, var(--glow-2), transparent 70%),
    radial-gradient(44% 52% at 62% 82%, var(--glow-3), transparent 70%);
  filter: blur(24px);
  animation: drift 36s ease-in-out infinite alternate;
}

/* A fine measurement grid over the field, fading out towards the bottom. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(var(--dots) 1px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  to   { transform: translate3d(4%, -3%, 0) rotate(10deg) scale(1.08); }
}

.hero h1 { margin-top: 1rem; max-width: 18ch; }
.hero .lede {
  margin-top: 1.5rem;
  max-width: 40rem;
  font-size: clamp(1.125rem, 0.6vw + 1rem, 1.3125rem);
  color: var(--ink-2);
}

.actions {
  margin-top: 2.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 2.875rem;
  padding: 0 1.375rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent);
}

.text-link { font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* ---------- Sections ---------- */

.section {
  padding-block: clamp(4rem, 9vw, 7rem);
  scroll-margin-top: var(--header-h);
}
.section-alt {
  background: var(--paper-2);
  border-block: 1px solid var(--rule);
}

.section-head { max-width: 44rem; }
.section-head h2 { margin-top: 0.875rem; }
.section-head p:not(.eyebrow) { margin-top: 1.25rem; color: var(--ink-2); font-size: 1.125rem; }

.split {
  display: grid;
  gap: 2.5rem clamp(2rem, 6vw, 5rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  align-items: start;
}

.prose { display: grid; gap: 1.125rem; color: var(--ink-2); font-size: 1.125rem; max-width: 40rem; }

/* How it works: the four layers as a connected loop. One row on wide screens,
   a vertical sequence on narrow ones; the return line closes the loop. */
.loop {
  --node: 3rem;
  --line: color-mix(in srgb, var(--accent) 35%, var(--rule));
  list-style: none;
  margin: clamp(2.5rem, 5vw, 3.5rem) 0 0;
  padding: 0;
  display: grid;
  gap: 1.75rem;
  counter-reset: layer;
}
.loop li {
  counter-increment: layer;
  position: relative;
  min-height: var(--node);
  padding-left: calc(var(--node) + 1.25rem);
}
.loop li::before {
  content: counter(layer, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: var(--node);
  height: var(--node);
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--paper);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.loop li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(var(--node) / 2 - 1px);
  top: calc(var(--node) + 0.375rem);
  bottom: calc(-1.75rem + 0.375rem);
  width: 2px;
  background: var(--line);
}
.loop .layer {
  padding-top: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.loop h3 { margin-top: 0.375rem; }
.loop p:not(.layer) { margin-top: 0.5rem; color: var(--ink-2); }

.loop-return {
  margin-top: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--accent);
  font-size: 0.9375rem;
  font-weight: 600;
}
.loop-return::before,
.loop-return::after { content: ""; flex: 1; height: 2px; background: color-mix(in srgb, var(--accent) 35%, var(--rule)); }
.loop-return::before { flex: 0 0 1.5rem; }

@media (min-width: 56rem) {
  .loop { grid-template-columns: repeat(5, 1fr); gap: 2rem; }
  .loop li { padding: calc(var(--node) + 1.25rem) 0 0; }
  .loop .layer { padding-top: 0; }
  .loop li:not(:last-child)::after {
    left: calc(var(--node) + 0.5rem);
    right: calc(-2rem + 0.5rem);
    top: calc(var(--node) / 2 - 1px);
    bottom: auto;
    width: auto;
    height: 2px;
  }
}

/* What sets us apart: plain-language events, set like quoted instructions. */
.events {
  list-style: none;
  margin: clamp(2rem, 4vw, 2.75rem) 0 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}
.events li {
  position: relative;
  padding: 1.25rem 1.25rem 1.25rem 2.75rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font-size: 1.0625rem;
  line-height: 1.5;
}
.events li::before {
  content: "\201C";
  position: absolute;
  left: 1rem;
  top: 0.75rem;
  font-size: 2rem;
  line-height: 1;
  font-weight: 650;
  color: var(--accent);
}
.events-note { margin-top: 1.5rem; max-width: 44rem; color: var(--ink-2); }
#difference h2 { margin-top: 0.875rem; }

/* Contact. */
#contact h2 { margin-top: 0.875rem; }
.contact-line { margin-top: 1rem; max-width: 40rem; color: var(--ink-2); font-size: 1.125rem; }
.contact-email { margin-top: 1.5rem; font-size: clamp(1.25rem, 1.5vw + 0.75rem, 1.75rem); font-weight: 600; }
#what h2, #trust h2 { margin-top: 0.875rem; }
.section-intro { margin-top: 1rem; max-width: 44rem; color: var(--ink-2); font-size: 1.125rem; }

/* Privacy and control: three statements in a row, stacked when narrow. */
.trust {
  list-style: none;
  margin: clamp(2rem, 4vw, 3rem) 0 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}
.trust li {
  padding: 1.5rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--paper-2) 55%, var(--paper));
}
.trust p { margin-top: 0.5rem; color: var(--ink-2); }
.trust-link { margin-top: 1.75rem; }

/* Numbered, ruled lists (constitution priorities and limits). */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding: 1rem 0 1rem 2.75rem;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-2);
}
.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1.1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.steps strong { display: block; color: var(--ink); font-weight: 600; }

/* Constitution principles, as a ruled list. */
.principles {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
  border-top: 1px solid var(--rule);
  font-size: 1.0625rem;
}
.principles li { padding-block: 0.875rem; border-bottom: 1px solid var(--rule); }
.principles strong { display: block; margin-bottom: 0.125rem; color: var(--ink); font-weight: 600; }

/* ---------- Plain pages (privacy, 404) ---------- */

.page { padding-block: clamp(3.5rem, 8vw, 6rem); }
.page .prose { max-width: 42rem; }
.page h1 { font-size: clamp(2rem, 3.5vw + 0.75rem, 3rem); margin-bottom: 0.5rem; }
.page h2 { font-size: 1.25rem; letter-spacing: -0.01em; margin-top: 1.5rem; color: var(--ink); }
.page .muted { color: var(--ink-3); font-size: 0.9375rem; }

/* ---------- Constitution ---------- */

.site-header nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-underline-offset: 0.35em; }

.doc { max-width: 44rem; }
.doc h1, .doc h2 { color: var(--ink); }
.doc > p { color: var(--ink-2); }
.doc h2 {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  font-size: clamp(1.5rem, 1.4vw + 1rem, 1.875rem);
  letter-spacing: -0.02em;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}
.doc h2 span {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.doc .steps { margin-block: 0.25rem; }

.principles .reason {
  display: block;
  margin-top: 0.375rem;
  color: var(--ink-3);
  font-size: 0.9375rem;
}
.principles .reason::before { content: "Why: "; font-weight: 600; color: var(--accent); }

/* ---------- Footer ---------- */

.site-footer {
  padding-block: 2rem calc(2rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--rule);
  color: var(--ink-3);
  font-size: 0.9375rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.site-footer a { color: var(--ink-2); }
.site-footer .legal { flex-basis: 100%; font-size: 0.8125rem; max-width: 52rem; }

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .field { animation: none; }
  .button { transition: none; }
  .button:hover { transform: none; }
}
