/* ============================================================
   Qwery legal pages — privacy.html, tos.html
   Built on the Qwery Design System (Claude Design, synced with
   qwery-webapp@0.1.0). Tokens verbatim from tokens/.
   Warm, calm, credible. No pure black, no hospital blue, no red.
   ============================================================ */

/* ---------------- Design-system tokens ---------------- */

:root {
  /* Canvas & surfaces (warm paper) */
  --paper: #FAF6EF;
  --surface: #FFFFFF;
  --surface-warm: #FFFDF9;
  --surface-sunken: #F1EBE0;

  /* Ink — warm, soft (never #000) */
  --ink-900: #23201B;
  --ink-700: #4C463D;
  --ink-500: #6B6458;
  --ink-400: #8C8475;
  --line: #E7DFD2;
  --line-strong: #D8CEBE;

  /* Primary — calm spruce teal */
  --primary: #0E6B5E;
  --primary-strong: #0A5046;
  --primary-soft: #DCECE8;
  --primary-softer: #ECF4F1;
  --on-primary: #FFFFFF;

  /* Attention — warm honey amber (never red) */
  --attention: #C9870B;
  --attention-strong: #8A5A02;
  --attention-soft: #FBEFD3;
  --attention-ink: #6B4A10;

  /* Focus */
  --focus-ring: #2E8E80;

  /* Type families */
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans: "Hanken Grotesk", system-ui, -apple-system, sans-serif;
  --font-logo: "Nunito", "Hanken Grotesk", Arial, sans-serif;

  /* Type scale */
  --text-xs: 13px;
  --text-sm: 15px;
  --text-base: 17px;
  --text-md: 19px;
  --text-lg: 22px;
  --text-xl: 27px;
  --text-2xl: 33px;

  --lh-tight: 1.18;
  --lh-snug: 1.4;
  --lh-body: 1.6;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  --ls-tight: -0.01em;
  --ls-wide: 0.04em;

  /* Radii */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-pill: 999px;

  /* Shadows — soft, warm-tinted, low */
  --shadow-xs: 0 1px 2px rgba(58, 47, 30, 0.06);
  --shadow-sm: 0 2px 6px rgba(58, 47, 30, 0.07);

  /* Layout */
  --content-max: 1160px;
  --reading-max: 760px;
  --gutter: 22px;

  /* Warm title color (from the DS display proposal) */
  --title-espresso: #3A2A1C;
}

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

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

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--lh-body);
  background: var(--paper);
  color: var(--ink-700);
  -webkit-font-smoothing: antialiased;
}

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

/* Skip link: visually hidden until keyboard-focused */
.skip-link {
  position: absolute;
  top: 0;
  left: -9999px;
  z-index: 40;
  background: var(--primary);
  color: var(--on-primary);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  text-decoration: none;
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus {
  left: 0;
}

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

header {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--paper) 88%, #ffffff 12%);
  border-bottom: 1px solid var(--line);
}

.nav {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0.7rem var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-logo svg {
  height: 38px;
  width: auto;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
}

.nav-links a {
  color: var(--ink-500);
  text-decoration: none;
  padding: 0.35rem 0;
}

.nav-links a:hover {
  color: var(--primary);
}

.nav-links a[aria-current="page"] {
  color: var(--primary-strong);
  font-weight: var(--fw-semibold);
  border-bottom: 2px solid var(--primary);
}

/* ---------------- Two-column layout ---------------- */

.layout {
  max-width: var(--content-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 2.75rem;
  align-items: start;
  padding: 2.75rem var(--gutter) 5rem;
}

/* ---------------- Section nav (left) ---------------- */

.toc {
  position: sticky;
  top: 82px;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.toc-box {
  background: var(--surface-warm);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  padding: 0.9rem 0.7rem 0.8rem;
}

.toc-box summary {
  list-style: none;
  cursor: default;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--ink-500);
  padding: 0 0.65rem 0.55rem;
  user-select: none;
}

.toc-box summary::-webkit-details-marker { display: none; }

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.toc-nav a {
  font-size: var(--text-sm);
  line-height: var(--lh-snug);
  color: var(--ink-500);
  text-decoration: none;
  padding: 0.32rem 0.65rem;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.toc-nav a:hover {
  color: var(--ink-900);
  background: var(--primary-softer);
}

.toc-nav a[aria-current] {
  color: var(--primary-strong);
  font-weight: var(--fw-medium);
  border-left-color: var(--primary);
  background: var(--primary-softer);
}

/* ---------------- Document ---------------- */

.doc {
  max-width: var(--reading-max);
  min-width: 0;
}

.doc h1 {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--title-espresso);
  margin-bottom: 0.8rem;
}

.doc-meta {
  font-size: var(--text-sm);
  color: var(--ink-500);
  margin-bottom: 2.4rem;
}

.doc h2 {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
  color: var(--title-espresso);
  margin: 2.6rem 0 0.9rem;
}

.doc h3 {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--ink-900);
  margin: 1.8rem 0 0.7rem;
}

.doc[id],
.doc [id] {
  scroll-margin-top: 96px;
}

.doc p {
  margin: 0 0 0.95rem;
}

.doc ul,
.doc ol {
  margin: 0 0 1rem 1.4rem;
}

.doc li {
  margin-bottom: 0.45rem;
}

.doc strong {
  font-weight: var(--fw-semibold);
  color: var(--ink-900);
}

.doc a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.doc a:hover {
  color: var(--primary-strong);
}

.doc .callout {
  background: var(--attention-soft);
  border: 1px solid color-mix(in srgb, var(--attention) 30%, transparent);
  border-left: 4px solid var(--attention);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  margin: 0 0 1rem;
  color: var(--attention-ink);
}

.doc .callout strong {
  color: var(--attention-ink);
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-warm);
  box-shadow: var(--shadow-xs);
}

.doc table {
  border-collapse: collapse;
  width: 100%;
  min-width: 520px;
  font-size: var(--text-sm);
  line-height: var(--lh-snug);
}

.doc th,
.doc td {
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0.85rem;
  text-align: left;
  vertical-align: top;
}

.doc th {
  background: var(--primary-softer);
  color: var(--primary-strong);
  font-weight: var(--fw-semibold);
}

.doc tr:last-child td {
  border-bottom: none;
}

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

footer {
  border-top: 1px solid var(--line);
  background: var(--surface-sunken);
  padding: 1.1rem var(--gutter) 1.3rem;
  font-size: var(--text-xs);
  color: var(--ink-500);
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-inner a {
  color: var(--ink-500);
  text-decoration: none;
}

.footer-inner a:hover {
  color: var(--primary);
}

/* ---------------- Mobile ---------------- */

@media (max-width: 920px) {
  .layout {
    display: block;
    padding-top: 1.4rem;
  }

  .toc {
    position: static;
    max-height: none;
    overflow: visible;
    margin-bottom: 1.6rem;
  }

  .toc-box {
    padding: 0.35rem 0.5rem;
  }

  .toc-box summary {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.65rem;
  }

  .toc-box summary::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--ink-400);
    border-bottom: 2px solid var(--ink-400);
    transform: rotate(45deg);
    transition: transform 160ms ease;
  }

  .toc-box[open] summary::after {
    transform: rotate(225deg);
  }

  .toc-nav {
    padding: 0.2rem 0 0.45rem;
  }
}

/* ---------------- Print ---------------- */

@media print {
  header,
  .toc,
  footer {
    display: none;
  }

  .layout {
    display: block;
    padding: 0;
  }

  body {
    background: #ffffff;
  }
}
