/* Dust — dust.md landing site.
   One hand-written stylesheet: tokens harvested verbatim from the dust-design kit
   (tokens/colors.css, typography.css), self-hosted Bitter, no framework, no build.
   Theme keys off <html data-theme="paper|dusk">; the media query is the no-JS
   fallback so system dark mode still resolves without script. */

/* ---- Bitter (SIL OFL) — self-hosted latin subset; see assets/fonts/OFL.txt. ---- */
@font-face {
  font-family: "Bitter";
  font-style: normal;
  font-weight: 400 700;            /* variable file covers the whole weight axis */
  font-display: swap;
  src: url("assets/fonts/bitter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+2000-206F, U+2122, U+2212;
}
@font-face {
  font-family: "Bitter";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/bitter-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+2000-206F, U+2122, U+2212;
}

/* ---- Paper (default light) — harvested from dust-design tokens/colors.css. ---- */
:root {
  --ink: #262019;
  --cream: #f1e7d0;
  --ember: #bc5b3c;
  --ember-strong: #a54b2f;
  --ember-soft: rgba(188, 91, 60, 0.12);
  --ember-brown: #7e4a2c;
  --slate: #5b7089;

  --bg-app: #ece6da;
  --surface: #ece6da;
  --surface-raised: #f8f3ea;
  --surface-sunken: #ded6c6;
  --surface-code: rgba(40, 30, 15, 0.05);

  --text-primary: #2a231b;
  --text-secondary: #756a54;
  --text-tertiary: #a89c82;
  --text-on-accent: #ffffff;

  --accent: var(--ember);
  --accent-hover: var(--ember-strong);
  --accent-soft: var(--ember-soft);
  --focus: var(--slate);

  /* Filled-button pair. White on plain --accent measures 4.47:1 — an AA failure —
     so the fill steps one shade darker, and the hover darker again. */
  --cta-fill: var(--ember-strong);
  --cta-fill-hover: var(--ember-brown);
  --cta-ink: #ffffff;

  --border: #d9cdb5;
  --border-strong: #c8b994;
  --divider: rgba(40, 30, 15, 0.10);

  --shadow-float: 0 18px 50px -20px rgba(40, 30, 15, 0.35);

  /* Type — harvested from tokens/typography.css. */
  --font-brand: "Bitter", Georgia, "Times New Roman", serif;
  --font-ui: -apple-system, BlinkMacSystemFont, system-ui, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, monospace;
  --wordmark-tracking: -0.015em;

  --measure: 34rem;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: light;
}

/* ---- Dusk (dark / espresso) — from tokens/colors.css .theme-dusk. ---- */
:root[data-theme="dusk"] {
  --ink: #efe3cc;
  --ember: #d67e54;
  --ember-strong: #e0926a;
  --ember-soft: rgba(214, 126, 84, 0.16);
  --ember-brown: #d99b66;
  --slate: #7e9abb;

  --bg-app: #1a130c;
  --surface: #15100a;
  --surface-raised: #1e160d;
  --surface-sunken: #120d07;
  --surface-code: rgba(255, 255, 255, 0.05);

  --text-primary: #efe3cc;
  --text-secondary: #a99b80;
  --text-tertiary: #7d7058;

  --accent: var(--ember);
  --accent-hover: var(--ember-strong);
  --accent-soft: var(--ember-soft);
  --focus: var(--slate);

  /* Dusk's ember is light, so the fill keeps the accent and the ink goes dark;
     white here would be 3:1. */
  --cta-fill: var(--ember);
  --cta-fill-hover: var(--ember-strong);
  --cta-ink: var(--surface);

  --border: #362b20;
  --border-strong: #463829;
  --divider: rgba(241, 231, 208, 0.10);

  --shadow-float: 0 18px 50px -20px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* No-JS fallback: honor system dark unless the reader forced Paper. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="paper"]) {
    --ink: #efe3cc;
    --ember: #d67e54;
    --ember-strong: #e0926a;
    --ember-soft: rgba(214, 126, 84, 0.16);
    --ember-brown: #d99b66;
    --slate: #7e9abb;
    --bg-app: #1a130c;
    --surface: #15100a;
    --surface-raised: #1e160d;
    --surface-sunken: #120d07;
    --surface-code: rgba(255, 255, 255, 0.05);
    --text-primary: #efe3cc;
    --text-secondary: #a99b80;
    --text-tertiary: #7d7058;
    --cta-fill: var(--ember);
    --cta-fill-hover: var(--ember-strong);
    --cta-ink: var(--surface);
    --border: #362b20;
    --border-strong: #463829;
    --divider: rgba(241, 231, 208, 0.10);
    --shadow-float: 0 18px 50px -20px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

/* ---- Reset / base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

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

h1, h2, h3 {
  font-family: var(--font-brand);
  color: var(--ember-brown);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
}

p { margin: 0; }
strong { color: var(--text-primary); }

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--surface-code);
  padding: 0.1em 0.35em;
  border-radius: 5px;
}

/* ---- Layout scaffold ---- */
.wrap { width: 100%; max-width: 62rem; margin: 0 auto; padding: 0 1.5rem; }
.prose { max-width: var(--measure); }

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 0;
  background: color-mix(in srgb, var(--bg-app) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(12px);
  -webkit-backdrop-filter: saturate(1.2) blur(12px);
  border-bottom: 1px solid var(--divider);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; }

.brand { display: inline-flex; align-items: baseline; gap: 0.5rem; text-decoration: none; }
.brand .mark {
  font-family: var(--font-brand); font-weight: 700; font-size: 1.5rem;
  color: var(--text-primary); letter-spacing: var(--wordmark-tracking);
}
.brand .sub {
  font-family: var(--font-brand); font-style: italic; font-size: 0.9rem;
  color: var(--text-secondary);
}
@media (max-width: 520px) { .brand .sub { display: none; } }

/* ---- Theme toggle — mirrors the app's Paper/Dusk segmented control ---- */
.theme-toggle {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-sunken); border: 1px solid var(--border);
  border-radius: 999px;
}
.theme-toggle button {
  font: inherit; font-size: 0.8rem; line-height: 1;
  padding: 0.35rem 0.7rem; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-secondary);
  cursor: pointer; transition: color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.theme-toggle button[aria-pressed="true"] {
  background: var(--surface-raised); color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(40, 30, 15, 0.14);
}

/* ---- Hero ---- */
.hero { padding: clamp(3rem, 8vw, 6rem) 0 2.5rem; text-align: center; }
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin: 0 auto 1.1rem;
  max-width: 18ch;
}
.hero .lede {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--text-secondary);
  max-width: 40rem; margin: 0 auto 2rem; line-height: 1.55;
}
.eyebrow {
  display: inline-block; font-size: 0.8rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-tertiary);
  margin-bottom: 1.25rem;
}

/* ---- Call to action — roles mirror the kit's Button (filled primary, bordered
   secondary), scaled up for the hero and to a 48px touch target. ---- */
.cta {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  justify-content: center; margin: 0 0 1rem;
}

/* The topbar is sticky, so any fragment jump would otherwise tuck its target underneath it. */
[id] { scroll-margin-top: 5rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0.7rem 1.6rem;
  border: 1px solid transparent; border-radius: 6px;
  font-family: var(--font-ui); font-size: 1.02rem; font-weight: 500;
  text-decoration: none;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease);
}
/* Each :hover sets color explicitly because the global `a:hover` outranks the
   resting `.btn-*` rule — without it the label repaints to --accent-hover on hover. */
.btn-primary { background: var(--cta-fill); color: var(--cta-ink); }
.btn-primary:hover { background: var(--cta-fill-hover); color: var(--cta-ink); }

/* Outlined, not a surface wash: --border against --bg-app is a 1.3:1 hairline, too
   faint to read as a control, so the accent carries the edge at 4.6:1. */
.btn-secondary {
  background: transparent; border-color: var(--cta-fill);
  color: var(--cta-fill);
}
.btn-secondary:hover {
  background: var(--accent-soft); border-color: var(--cta-fill-hover);
  color: var(--cta-fill-hover);
}

.cta-note {
  color: var(--text-secondary); font-size: 0.92rem; line-height: 1.5;
  max-width: 32rem; margin: 0 auto 2.5rem;
}

/* Stacks until the pair genuinely fits side by side; between ~400 and 470 they wrap
   to two ragged, mismatched widths. */
@media (max-width: 480px) { .btn { width: 100%; } }

/* Screenshot */
.shot { position: relative; margin: 0 auto; max-width: 58rem; }
.shot img {
  width: 100%; height: auto; display: block; border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-float);
}
.shot .img-dusk { display: none; }
:root[data-theme="dusk"] .shot .img-paper { display: none; }
:root[data-theme="dusk"] .shot .img-dusk { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="paper"]) .shot .img-paper { display: none; }
  :root:not([data-theme="paper"]) .shot .img-dusk { display: block; }
}

/* ---- Sections ---- */
section { padding: clamp(3rem, 7vw, 5rem) 0; }
section + section { border-top: 1px solid var(--divider); }
.section-head { text-align: center; margin: 0 auto 2.5rem; max-width: 40rem; }
.section-head h2 { font-size: clamp(1.7rem, 4vw, 2.3rem); margin-bottom: 0.75rem; }
.section-head p { color: var(--text-secondary); font-size: 1.1rem; }

.lead-num {
  font-family: var(--font-brand); font-weight: 700;
  color: var(--accent); font-variant-numeric: tabular-nums;
}

/* Feature grid */
.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 720px) { .grid { grid-template-columns: 1fr; } }
.card {
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: 10px; padding: 1.5rem;
}
.card h3 { font-size: 1.15rem; color: var(--ember-brown); margin-bottom: 0.5rem; }
.card p { color: var(--text-secondary); font-size: 0.98rem; line-height: 1.55; }

/* NOT-list */
.notlist { list-style: none; margin: 0 auto; padding: 0; max-width: 40rem; }
.notlist li {
  display: flex; gap: 0.85rem; align-items: baseline;
  padding: 0.7rem 0; border-bottom: 1px solid var(--divider);
  color: var(--text-secondary);
}
.notlist li:last-child { border-bottom: 0; }
.notlist .no {
  color: var(--text-tertiary); font-family: var(--font-mono);
  font-size: 0.85rem; flex: none; padding-top: 0.1rem;
}
.notlist strong { color: var(--text-primary); font-weight: 600; }

/* Trust note — the emotional close, first-class not fine print */
.trust {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: clamp(1.75rem, 4vw, 2.75rem);
  max-width: 44rem; margin: 0 auto;
}
.trust h2 { font-size: clamp(1.6rem, 3.5vw, 2.1rem); margin-bottom: 1.1rem; text-align: left; }
.trust p { color: var(--text-secondary); margin-bottom: 1rem; font-size: 1.06rem; line-height: 1.6; }
.trust p:last-child { margin-bottom: 0; }
.trust .kicker { color: var(--text-primary); font-weight: 600; }

/* ---- Footer ---- */
footer {
  border-top: 1px solid var(--divider);
  padding: 2.5rem 0 3rem; margin-top: 1rem;
  color: var(--text-tertiary); font-size: 0.9rem;
}
footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: center; justify-content: space-between; }
footer nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
footer nav a { color: var(--text-secondary); text-decoration: none; }
footer nav a:hover { color: var(--accent); text-decoration: underline; }
footer .fine { color: var(--text-tertiary); }

/* ---- Legal / support document pages ---- */
.doc { padding: clamp(2.5rem, 6vw, 4rem) 0 4rem; }
.doc .prose { margin: 0 auto; }
.doc h1 { font-size: clamp(2rem, 5vw, 2.8rem); color: var(--text-primary); margin-bottom: 0.5rem; }
.doc .updated { color: var(--text-tertiary); font-size: 0.9rem; margin-bottom: 2rem; }
.doc h2 { font-size: 1.4rem; color: var(--ember-brown); margin: 2.5rem 0 0.75rem; }
.doc h3 { font-size: 1.1rem; color: var(--ember-brown); margin: 1.75rem 0 0.5rem; }
.doc p, .doc li { color: var(--text-secondary); line-height: 1.65; }
.doc p { margin: 0 0 1rem; }
.doc ul { margin: 0 0 1rem; padding-left: 1.25rem; }
.doc li { margin-bottom: 0.4rem; }
.doc a { font-weight: 500; }

/* Placeholder banner — unmistakable that legal copy is not final */
.placeholder-banner {
  display: flex; gap: 0.75rem; align-items: flex-start;
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: 10px; padding: 1rem 1.15rem; margin-bottom: 2.5rem;
  color: var(--text-primary); font-size: 0.95rem; line-height: 1.5;
}
.placeholder-banner strong { color: var(--accent-hover); }
.placeholder-banner .tag {
  flex: none; font-family: var(--font-mono); font-size: 0.72rem;
  letter-spacing: 0.05em; text-transform: uppercase;
  background: var(--accent); color: var(--text-on-accent);
  padding: 0.2rem 0.5rem; border-radius: 5px; margin-top: 0.1rem;
}

/* Query flag — the ~3-4 things only AJ can answer, marked inline for the draft */
.owner-q {
  background: var(--surface-sunken); border-left: 3px solid var(--slate);
  border-radius: 6px; padding: 0.6rem 0.85rem; margin: 0 0 1rem;
  font-size: 0.9rem; color: var(--text-secondary);
}
.owner-q b { color: var(--slate); font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.04em; }

.back { display: inline-block; margin-top: 2.5rem; font-weight: 500; text-decoration: none; }
.back:hover { text-decoration: underline; }
