/* ============================================================
   Haven — accessibility demo
   Hand-written, no framework. Tokens drive theming so dark/light,
   calm mode, text scaling and the dyslexia font are all one source.
   ============================================================ */

:root {
  --font-scale: 1;

  /* Light theme tokens (default) */
  --bg: #f6f8f9;
  --surface: #ffffff;
  --surface-2: #eef3f4;
  --text: #16242b;
  --text-soft: #46585f;
  --border: #d7e0e2;
  --accent: #2f7d72;        /* calm teal-green */
  --accent-text: #ffffff;
  --accent-soft: #e3f1ee;
  --ring: #1f6f63;
  --shadow: 0 6px 24px rgba(20, 40, 48, 0.08);

  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --radius: 14px;
  --maxw: 980px;
  --t: 220ms ease;
}

html[data-theme="dark"] {
  --bg: #0e1719;
  --surface: #16242a;
  --surface-2: #1d3138;
  --text: #eaf2f3;
  --text-soft: #aebfc4;
  --border: #2a4048;
  --accent: #5bc4b3;
  --accent-text: #06201c;
  --accent-soft: #163530;
  --ring: #7fd8c9;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

/* Calm mode: mute saturation, flatten shadows, quiet the accent */
html[data-calm="true"] {
  --accent: #5f7d78;
  --accent-soft: #e9eeed;
  --shadow: none;
  --bg: #f1f3f3;
  --surface: #fbfcfc;
}
html[data-calm="true"][data-theme="dark"] {
  --accent: #8aa8a2;
  --accent-soft: #1b2a2d;
  --bg: #121b1d;
  --surface: #18262a;
}

/* Dyslexia-friendly font swap */
html[data-dyslexia="true"] {
  --font-body: "OpenDyslexic", "Atkinson Hyperlegible", system-ui, sans-serif;
  letter-spacing: 0.02em;
  word-spacing: 0.08em;
}

/* Reduced motion: off when user (or system) asks for it */
html[data-motion="reduced"] *,
html[data-motion="reduced"] *::before,
html[data-motion="reduced"] *::after {
  animation-duration: 0.001ms !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  html[data-motion="auto"] * { transition: none !important; animation: none !important; }
}

* { box-sizing: border-box; }

html { font-size: calc(100% * var(--font-scale)); scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background var(--t), color var(--t);
}

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* Visible, generous focus for everyone */
:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--accent); color: var(--accent-text);
  padding: 10px 16px; border-radius: 8px; text-decoration: none; font-weight: 700;
  transition: top var(--t);
}
.skip-link:focus { top: 12px; }

.ribbon {
  background: var(--accent); color: var(--accent-text);
  text-align: center; font-size: 0.82rem; font-weight: 700;
  padding: 7px 16px; letter-spacing: 0.01em;
}

/* ---------- Header + toolbar ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(120%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; gap: 18px;
  flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); font-weight: 700; }
.brand-mark { color: var(--accent); font-size: 1.5rem; line-height: 1; }
.brand-name { font-size: 1.25rem; letter-spacing: -0.01em; }

.a11y-bar { display: flex; flex-wrap: wrap; gap: 14px; margin-left: auto; }
.a11y-group { display: inline-flex; gap: 6px; background: var(--surface-2); padding: 5px; border-radius: 999px; }

.chip {
  font: inherit; font-size: 0.85rem; font-weight: 700;
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid transparent; background: transparent; color: var(--text-soft);
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.chip:hover { color: var(--text); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

.progress { height: 4px; background: var(--surface-2); }
.progress-bar { display: block; height: 100%; width: 0%; background: var(--accent); transition: width 80ms linear; }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 36px; max-width: 760px; }
.eyebrow { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; margin: 0 0 14px; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.12; margin: 0 0 18px; letter-spacing: -0.02em; }
.lead { font-size: 1.18rem; color: var(--text-soft); margin: 0 0 28px; }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  padding: 13px 24px; border-radius: 999px; border: 2px solid transparent;
  transition: transform var(--t), background var(--t), color var(--t), border-color var(--t);
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Features ---------- */
.features { padding: 40px 0; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); margin: 0 0 26px; letter-spacing: -0.01em; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 1.18rem; }
.card p { margin: 0; color: var(--text-soft); }

/* ---------- FAQ / search / accordion ---------- */
.faq { padding: 40px 0; }
.search { display: block; max-width: 440px; margin: 0 0 18px; }
.search span { display: block; font-weight: 700; margin-bottom: 8px; }
.search input, .news-form input {
  font: inherit; width: 100%; padding: 12px 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
}
.search-empty { color: var(--text-soft); font-style: italic; }

.accordion { display: grid; gap: 10px; }
.acc-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.acc-item summary {
  cursor: pointer; padding: 16px 18px; font-weight: 700; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.acc-item summary::-webkit-details-marker { display: none; }
.acc-item summary::after { content: "+"; color: var(--accent); font-size: 1.4rem; line-height: 1; }
.acc-item[open] summary::after { content: "–"; }
.acc-body { padding: 0 18px 16px; }
.acc-body p { margin: 0; color: var(--text-soft); }
.acc-item[hidden] { display: none; }

/* ---------- Newsletter ---------- */
.newsletter { padding: 40px 0 64px; }
.newsletter p { color: var(--text-soft); max-width: 540px; }
.news-form { display: flex; flex-wrap: wrap; gap: 10px; max-width: 480px; margin-top: 14px; }
.news-form input { flex: 1 1 220px; }
.news-status { margin-top: 12px; font-weight: 700; min-height: 1.4em; }
.news-status.ok { color: var(--accent); }
.news-status.err { color: #c0432f; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 26px 0; background: var(--surface); }
.site-footer p { margin: 4px 0; color: var(--text-soft); font-size: 0.92rem; }
.footer-by { font-weight: 700; color: var(--text); }

@media (max-width: 760px) {
  .a11y-bar { margin-left: 0; width: 100%; }
  .hero { padding-top: 48px; }
}
