/* SkimMail public site — plain CSS, no build step, no framework, no CDN.
   Colour tokens are lifted from the app's design system
   (web/apps/web/src/index.css): "Day Light" for light, "Ink Dark" for dark.
   The app flips themes on a `.dark` class; a static site has no toggle, so
   here the same two token sets hang off prefers-color-scheme instead.

   ONE token deliberately differs from the app, and it is not drift: the app's
   dark `--primary-ink` is #ffffff, which on the dark `--primary` (#8b92ff)
   measures 2.6:1 and fails WCAG AA for the primary button's label. This site
   uses #0c0e14 there instead (7.6:1). If the app's dark primary button is ever
   fixed, take its value back and delete this paragraph. Everything else must
   stay in step with index.css.
   Fonts are the system stack only. The app self-hosts Plus Jakarta Sans /
   Inter / JetBrains Mono via @fontsource; shipping woff2 binaries for three
   static pages is not worth it, and loading them from a CDN is forbidden on
   a site whose whole argument is that it does not phone home. */

/* ---- Day Light (light) ---- */
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --surface-hi: #eef0f6;
  --sel: #e6e7ff;
  --ink: #1a1d26;
  --muted: #5a6172;
  --line: #e2e6ed;
  --primary: #5358e6;
  --primary-ink: #ffffff;
  --success: #12a878;
  --warn: #c77a12;
  --danger: #dc3d43;
  --accent-teal: #1fae9f;
  --accent-violet: #8a5cf6;
  --accent-amber: #c77a12;

  --font-display: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 14px;
  --maxw: 68rem;
  --gutter: 16px;

  color-scheme: light;
}

/* ---- Ink Dark ---- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e14;
    --surface: #12151d;
    --surface-2: #161a23;
    --surface-hi: #232936;
    --sel: #1b2140;
    --ink: #e6e9f2;
    --muted: #9aa3b7;
    --line: #222734;
    --primary: #8b92ff;
    --primary-ink: #0c0e14;
    --success: #20c590;
    --warn: #fdb252;
    --danger: #ec7c8a;
    --accent-teal: #20c590;
    --accent-violet: #b98bff;
    --accent-amber: #fdb252;
    color-scheme: dark;
  }
}

*, *::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;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

/* The app's Ink-Dark hero glow: a faint indigo radial, fixed. */
@media (prefers-color-scheme: dark) {
  body {
    background:
      radial-gradient(1100px 620px at 86% -12%, rgba(139, 146, 255, 0.07), transparent 60%),
      var(--bg);
    background-attachment: fixed;
  }
}

/* ---- Layout ---- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.prose { max-width: 46rem; }

/* ---- Skip link + focus ---- */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary);
  color: var(--primary-ink);
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius) 0;
  z-index: 50;
}
.skip:focus { left: 0; }

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

/* ---- Header ---- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding-block: 0.75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.brand svg { flex: none; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; align-items: center; }
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.3rem 0;
}
.site-nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.site-nav a[aria-current="page"] { color: var(--primary); }

/* ---- Hero ---- */
.hero { padding-block: clamp(2.5rem, 7vw, 5rem) clamp(1.5rem, 4vw, 3rem); }
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  font-weight: 800;
}
.hero .lede { font-size: clamp(1.05rem, 2.6vw, 1.3rem); color: var(--muted); margin: 0 0 1.75rem; max-width: 44rem; }

/* The label text is --ink, not --primary: #5358e6 on the light --sel (#e6e7ff)
   measures 4.4:1, and at 0.75rem this is not "large text", so it would miss
   WCAG AA. The pill keeps the brand tint; the letters stay readable. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--sel);
  border: 1px solid var(--line);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
}

/* ---- Hero fact strip ---- */
.facts {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.facts li { margin: 0; display: inline-flex; align-items: baseline; gap: 0.5rem; }
.facts li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-teal);
  flex: none;
  transform: translateY(-2px);
}

/* ---- Buttons ---- */
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.15rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.97rem;
  text-decoration: none;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
}
.btn:hover { background: var(--surface-hi); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { filter: brightness(1.08); background: var(--primary); }

/* ---- Sections ---- */
main section { padding-block: clamp(2rem, 5vw, 3.25rem); }
main section + section { border-top: 1px solid var(--line); }

h2 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.6vw, 1.9rem);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0 0 0.85rem;
  font-weight: 800;
}
h3 {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.6vw, 1.25rem);
  letter-spacing: -0.01em;
  margin: 2rem 0 0.6rem;
  font-weight: 700;
}
p { margin: 0 0 1rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.3rem; }
li { margin-bottom: 0.45rem; }
li::marker { color: var(--muted); }

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

strong { font-weight: 700; }
code, .mono {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface-hi);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1em 0.35em;
  /* Scope names and URLs are long, unbroken and inline. Without this, one of
     them pushes the whole page sideways on a 375px screen. */
  overflow-wrap: anywhere;
}

/* Command blocks. They scroll inside their own box rather than widening the
   page — a 375px screen must never scroll sideways. */
pre {
  margin: 0 0 1rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 0.85rem;
  line-height: 1.6;
  tab-size: 2;
}
pre code {
  font-family: var(--font-mono);
  font-size: inherit;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  white-space: pre;
}

/* Accessible names for the tables, without a visible caption. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- Cards ---- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.card h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.card .ico { display: block; margin-bottom: 0.75rem; color: var(--primary); }

/* ---- Callout ---- */
.note {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin: 1.5rem 0;
}
.note :last-child { margin-bottom: 0; }
.note-warn { border-left-color: var(--warn); }
.note-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

/* ---- Tables ---- */
.table-scroll { overflow-x: auto; margin: 1.25rem 0; }
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 34rem;
  font-size: 0.95rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
th, td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--surface-hi); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.02em; }
tbody tr:last-child td { border-bottom: 0; }

/* ---- Doc meta ---- */
.doc-meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
  margin-bottom: 1.75rem;
}
.doc-meta span { display: inline-block; margin-right: 1.25rem; }

/* ---- Table of contents ---- */
.toc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}
.toc h2 { font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.6rem; }
.toc ol { margin: 0; padding-left: 1.2rem; font-size: 0.95rem; }
.toc li { margin-bottom: 0.25rem; }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  margin-top: 3rem;
  padding-block: 2rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--ink); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-content: start; }
.site-footer p { margin: 0; }
.site-footer p + p { margin-top: 0.35rem; }
.site-footer .fine { font-size: 0.85rem; max-width: 34rem; }

/* Anchor jumps must clear the sticky header. */
:target,
main section[id],
main h2[id],
main h3[id] { scroll-margin-top: 90px; }

/* On a phone the primary nav wraps to two or three rows, and a sticky header
   that tall eats a third of the viewport. Let it scroll away instead — every
   link in it (privacy and terms included) is also in the footer and in the
   body text, so nothing becomes unreachable. */
@media (max-width: 640px) {
  .site-header { position: static; }
  :target,
  main section[id],
  main h2[id],
  main h3[id] { scroll-margin-top: 1rem; }
}

/* Print: the legal pages are the ones people print. Drop the chrome. */
@media print {
  .site-header, .site-footer, .toc, .skip { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .prose { max-width: none; }
  a { color: #000; text-decoration: underline; }
  .note { border: 1px solid #999; }
  table { border: 1px solid #999; min-width: 0; }
  pre { border: 1px solid #999; white-space: pre-wrap; overflow: visible; }
}
