/* Shared styling for the static legal pages (privacy, terms). These are plain
   HTML rather than x-dc templates — no runtime, nothing to break, and the text
   is in the source where crawlers and OAuth reviewers can read it. */

:root {
  --bg: #030E18;
  --panel: #0A1B2E;
  --card: #0F2947;
  --line: #1D3D60;
  --text: #FFFFFF;
  --body: #D4DCE9;
  --muted: #A9B7CC;
  --dim: #5B6472;
  --accent: #2FD3A6;
  --accent-hover: #1FBA8E;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  /* Keeps the footer at the bottom on short pages like the 404, instead of
     leaving it floating mid-screen. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
.site-footer { flex: none; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* --- Header ---------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(3, 14, 24, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.lockup { display: flex; align-items: center; gap: 14px; }
.lockup img { width: 42px; height: 42px; display: block; }
.lockup span {
  font-weight: 500;
  font-size: clamp(18px, 4.2vw, 26px);
  letter-spacing: 0.16em;
  color: var(--text);
}
.lockup:hover { text-decoration: none; }
.cta {
  background: var(--accent);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
}
.cta:hover { background: var(--accent-hover); color: var(--bg); text-decoration: none; }

/* --- Document ------------------------------------------------------------- */
main {
  max-width: 780px;
  margin: 0 auto;
  padding: clamp(40px, 6vw, 72px) clamp(20px, 5vw, 32px) clamp(56px, 7vw, 88px);
}

.eyebrow {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}

h1 {
  font-size: clamp(30px, 5.4vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 16px;
  text-wrap: balance;
}

.meta {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 13px;
  color: var(--dim);
  margin: 0 0 8px;
}

.lede {
  font-size: 17px;
  color: var(--muted);
  margin: 24px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  text-wrap: pretty;
}

h2 {
  font-size: 21px;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 52px 0 14px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 90px;
}

h3 {
  font-size: 16px;
  color: var(--text);
  margin: 28px 0 10px;
}

p { margin: 0 0 16px; }
ul, ol { margin: 0 0 16px; padding-left: 22px; }
li { margin-bottom: 9px; }
li::marker { color: var(--accent); }
strong { color: var(--text); font-weight: 600; }

/* Pulls the mandatory Google disclosure out of the body copy, since reviewers
   look for it specifically. */
.callout {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 20px 24px;
  margin: 0 0 20px;
}
.callout p:last-child { margin-bottom: 0; }

/* Anything still needing a real value before this goes live. */
.tbd {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.88em;
  background: rgba(255, 107, 107, 0.12);
  border-bottom: 1px dashed #FF6B6B;
  color: #FF9F9F;
  padding: 1px 5px;
  border-radius: 3px;
}

.toc {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px 26px;
  margin: 36px 0 0;
}
.toc p {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}
.toc ol { margin: 0; padding-left: 20px; font-size: 15px; }
.toc li { margin-bottom: 5px; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 20px;
  font-size: 14.5px;
}
th, td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
}
td { color: var(--body); }
.table-wrap { overflow-x: auto; }

/* --- Footer --------------------------------------------------------------- */
.site-footer {
  padding: 32px clamp(20px, 5vw, 48px);
  background: var(--panel);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 20px;
  text-align: center;
}
.site-footer img { height: 22px; width: 22px; display: block; }
.site-footer .copy { font-size: 12px; color: var(--dim); }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.site-footer nav a { font-size: 12px; color: var(--muted); }
.site-footer nav a:hover { color: var(--accent); }

/* --- Two-column document layout ------------------------------------------- */
/* Sticky contents rail on the left, prose scrolling on the right. Collapses to
   a single column below 1000px, where the rail becomes a card above the text. */

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

main.doc {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(32px, 4vw, 56px) clamp(20px, 4vw, 40px) clamp(56px, 7vw, 96px);
}

.doc-grid {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  column-gap: clamp(32px, 4.5vw, 64px);
  align-items: start;
}
.doc-head    { grid-column: 2; grid-row: 1; }
/* Spans both rows so the rail starts level with the title rather than below it,
   while still having a tall enough grid area for sticky to travel in. */
.doc-nav     { grid-column: 1; grid-row: 1 / span 2; }
.doc-content { grid-column: 2; grid-row: 2; min-width: 0; max-width: 760px; }

/* Clears the sticky site header when a heading is scrolled to. */
h2, h3 { scroll-margin-top: 96px; }

.doc-nav {
  position: sticky;
  top: 95px;
  max-height: calc(100vh - 119px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.doc-nav::-webkit-scrollbar { width: 6px; }
.doc-nav::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.doc-nav-title {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
  padding-left: 15px;
}
.doc-nav ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
  border-left: 1px solid var(--line);
}
.doc-nav li { margin: 0; counter-increment: toc; }
.doc-nav a {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-left: -1px;
  padding: 7px 10px 7px 13px;
  border-left: 2px solid transparent;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--muted);
  transition: color 0.12s, background-color 0.12s, border-color 0.12s;
}
.doc-nav a::before {
  content: counter(toc);
  flex: none;
  min-width: 14px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--dim);
}
.doc-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  text-decoration: none;
}
.doc-nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(47, 211, 166, 0.07);
}
.doc-nav a.active::before { color: var(--accent); }

/* The first section heading sits directly under the title, so it does not need
   its own rule and top padding. */
/* The first heading follows the lede directly, so it drops the section rule but
   still needs air above it. */
.doc-content > h2:first-child { margin-top: 40px; padding-top: 0; border-top: none; }

@media (max-width: 1000px) {
  /* Falls back to document order: title, contents card, then the text. */
  .doc-grid { display: block; }
  .doc-content { max-width: none; }
  .doc-nav {
    position: static;
    max-height: none;
    overflow: visible;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px 24px;
    margin: 0 0 44px;
  }
  .doc-nav-title { padding-left: 0; }
  .doc-nav ol { border-left: none; }
  .doc-nav a { padding: 6px 0; border-left: none; margin-left: 0; }
  .doc-nav a:hover, .doc-nav a.active { background: none; }
}

/* On narrow screens the lockup and the CTA together overflowed the header,
   wrapping it onto two rows — 15% of a phone viewport, permanently, for a
   sticky element. Scaling the lockup down keeps it to one row. */
@media (max-width: 460px) {
  .site-header { gap: 10px; }
  .lockup { gap: 10px; }
  .lockup img { width: 32px; height: 32px; }
  .lockup span { font-size: 15px; letter-spacing: 0.1em; }
  .cta { padding: 9px 14px; font-size: 13.5px; }
}

/* --- 404 ------------------------------------------------------------------ */
/* Deliberately a real 404 with navigation rather than an automatic redirect to
   home: auto-redirecting every unknown URL is a soft-404, which search engines
   penalise and which hides typos from the person who made them. */
main.notfound {
  max-width: 620px;
  margin: 0 auto;
  padding: clamp(56px, 12vh, 128px) clamp(20px, 5vw, 32px) clamp(64px, 10vh, 112px);
  text-align: center;
}
.nf-code {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: clamp(56px, 14vw, 92px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin: 0 0 20px;
}
main.notfound h1 {
  font-size: clamp(26px, 5.6vw, 38px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 16px;
  text-wrap: balance;
}
.nf-body {
  font-size: 16px;
  color: var(--muted);
  margin: 0 0 36px;
  text-wrap: pretty;
}
.nf-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 40px;
}
.nf-primary, .nf-secondary {
  padding: 13px 26px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 15px;
}
.nf-primary { background: var(--accent); color: var(--bg); }
.nf-primary:hover { background: var(--accent-hover); color: var(--bg); text-decoration: none; }
.nf-secondary { background: var(--card); border: 1px solid var(--line); color: var(--text); }
.nf-secondary:hover { background: #142E47; color: var(--text); text-decoration: none; }
.nf-links {
  display: flex;
  gap: 22px;
  justify-content: center;
  flex-wrap: wrap;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.nf-links a { font-size: 14px; color: var(--muted); }
.nf-links a:hover { color: var(--accent); }
