/* Colors come from design/tokens.json (Default and Dusk). WebPagesTests
   fails when a value here drifts from the tokens. Pages use var(--…) only. */
:root {
  --ground: #F3F6F1;
  --surface: #FFFFFF;
  --surface-private: #E3EBE1;
  --surface-muted: #E8EEE6;
  --ink: #1F2A24;
  --ink-muted: #4F5A53;
  --on-ink: #F3F6F1;
  --line: #DDE4DB;
  --outline-empty: #7E8A81;
  --bar-muted: #8FA58C;
  --mood-great: #F5C04A;
  --mood-good: #A6D48B;
  --mood-okay: #8DBCE3;
  --mood-low: #B9A8DE;
  --mood-rough: #EE9A86;
  --on-accent: #1F2A24;
  --blankie-face: #1F2A24;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #1A211D;
    --surface: #242D28;
    --surface-private: #2C3A31;
    --surface-muted: #2F3832;
    --ink: #EEF3EC;
    --ink-muted: #A9B5AC;
    --on-ink: #1A211D;
    --line: #3A453E;
    --outline-empty: #8A968D;
    --bar-muted: #5E7A5B;
  }
}

/* The app's own font files, served from here so the pages call no font CDN. */
@font-face {
  font-family: "Fredoka";
  src: url("/fonts/Fredoka-Variable.ttf") format("truetype");
  font-weight: 300 700;
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  src: url("/fonts/Nunito-Variable.ttf") format("truetype");
  font-weight: 200 1000;
  font-display: swap;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 600;
  font-size: 17px;
  line-height: 1.55;
}

h1, h2, h3, .display {
  font-family: "Fredoka", "Nunito", system-ui, sans-serif;
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
}

p { margin: 0; }
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--ink-muted); }
strong { font-weight: 800; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; }

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

/* Layout */
.wrap { max-width: 1200px; margin: 0 auto; padding-inline: 24px; }
.section { padding-block: 80px; }
.section.tight { padding-block: 48px; }
.band { background: var(--surface); border-block: 1px solid var(--line); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 24px; }
.muted { color: var(--ink-muted); }

/* Header and footer (same markup on every page) */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-block: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; color: var(--ink); }
.brand-name { font-family: "Fredoka", "Nunito", system-ui, sans-serif; font-weight: 600; font-size: 26px; letter-spacing: -0.2px; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; font-size: 15px; font-weight: 700; text-decoration: none; border-bottom: 2px solid transparent; }
.site-nav a[aria-current="page"] { border-bottom-color: var(--ink); }
.site-nav a.pill { margin-left: 8px; border-radius: 999px; background: var(--ink); color: var(--on-ink); border: 0; padding: 0 20px; }
.site-footer { border-top: 1px solid var(--line); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; padding-block: 40px 24px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.site-footer nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; font-size: 15px; font-weight: 700; }
.site-footer .legal { padding-block: 0 40px; font-size: 13px; color: var(--ink-muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 24px; border-radius: 14px; font-size: 16px; font-weight: 800; text-decoration: none; background: var(--ink); color: var(--on-ink); border: 2px solid var(--ink); }
.btn:hover { color: var(--on-ink); opacity: 0.9; }
.btn.ghost { background: transparent; color: var(--ink); }
.store { display: inline-flex; flex-direction: column; justify-content: center; height: 56px; padding: 0 24px; border-radius: 14px; background: var(--ink); color: var(--on-ink); text-decoration: none; line-height: 1.15; }
.store:hover { color: var(--on-ink); opacity: 0.9; }
.store small { font-size: 12px; font-weight: 700; }
.store b { font-size: 20px; font-weight: 800; }
.store.soon { background: transparent; color: var(--ink-muted); border: 2px dashed var(--outline-empty); }
.chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 15px; font-weight: 700; text-decoration: none; }
.tag { display: inline-flex; align-self: flex-start; padding: 4px 10px; border-radius: 999px; background: var(--mood-great); color: var(--on-accent); font-size: 13px; font-weight: 800; }

/* Cards: white = shared or neutral, tint = private (brand rule) */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; }
.card.shared { border: 2px solid var(--ink); }
.card.hero { border-radius: 24px; }
.card.private { background: var(--surface-private); border-color: transparent; }
.card.ink { background: var(--ink); color: var(--on-ink); border-color: var(--ink); border-radius: 28px; }
.card.ink a { color: var(--on-ink); }
.lock { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; color: var(--ink-muted); }
.lock svg { width: 16px; height: 16px; stroke: var(--ink); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Page titles */
.page-head { padding-block: 56px 32px; }
.page-title { font-size: clamp(40px, 5vw, 60px); line-height: 1.05; }
.lede { font-size: 19px; line-height: 1.5; color: var(--ink-muted); max-width: 34em; }
.meta { font-size: 14px; font-weight: 700; color: var(--ink-muted); }

/* Long documents: contents list beside a reading column (stacks on phones) */
.doc-layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 48px; padding-bottom: 80px; }
.toc { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.toc .label { font-size: 13px; font-weight: 800; color: var(--ink-muted); padding: 0 12px 8px; }
.toc a { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 10px; font-size: 15px; font-weight: 700; text-decoration: none; }
.toc a:hover { background: var(--surface-muted); color: var(--ink); }
.doc { flex: 999 1 560px; min-width: 0; max-width: 720px; display: flex; flex-direction: column; gap: 40px; }
.doc section { display: flex; flex-direction: column; gap: 14px; scroll-margin-top: 24px; }
.doc h2 { font-size: 30px; line-height: 1.2; }
.doc h3 { font-family: "Nunito", system-ui, sans-serif; font-size: 19px; font-weight: 800; margin-top: 8px; }
.doc ul { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }

/* FAQ accordion */
.faq { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.faq details + details { border-top: 1px solid var(--line); }
.faq summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 44px; padding: 18px 22px; font-size: 17px; font-weight: 800; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary svg { flex: none; width: 20px; height: 20px; stroke: var(--ink); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s ease; }
.faq details[open] summary svg { transform: rotate(180deg); }
.faq details p { padding: 0 22px 20px; color: var(--ink-muted); max-width: 44em; font-size: 16px; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
table { width: 100%; border-collapse: collapse; font-size: 16px; line-height: 1.45; }
th, td { text-align: left; vertical-align: top; padding: 14px 20px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { font-size: 13px; font-weight: 800; color: var(--ink-muted); }
td:first-child { font-weight: 800; white-space: nowrap; }

/* Blankie: inline SVG, colors from mood tokens (fixed in every theme) */
.blankie { display: block; flex: none; }
.blankie .face { fill: var(--blankie-face); }
.blankie .line { fill: none; stroke: var(--blankie-face); stroke-width: 1.8; stroke-linecap: round; }
.blankie .great { fill: var(--mood-great); }
.blankie .good { fill: var(--mood-good); }
.blankie .okay { fill: var(--mood-okay); }
.blankie .low { fill: var(--mood-low); }
.blankie .rough { fill: var(--mood-rough); }
.blankie .empty { fill: none; stroke: var(--outline-empty); stroke-width: 2; }

.placeholder {
  background: var(--mood-great);
  color: var(--on-accent);
  border-radius: 6px;
  padding: 0 4px;
}
