/* Shared styles for the legal pages and 404.
   Same warm palette as styles.css (ivory paper, espresso ink, copper and teal), in light and dark.
   Dark applies by choice (data-theme="dark", saved by theme.js) or by system preference. */
:root {
  color-scheme: light;
  --bg: #fbf6ef; --paper: #fffdf9; --tint: #f5ecdf; --ink: #2b1e17; --muted: #6b584b; --line: #e9dccb; --field: #8f7a69;
  --copper: #b4532a; --copper-ink: #8f3f1e; --teal: #276b5b; --teal-ink: #1d5246; --amber: #f0b26b;
  --on-accent: #fff; --pending: #8a4b00; --glow: rgba(240, 178, 107, .28);
  --card: rgba(255, 253, 249, .75); --hover-wash: rgba(255, 253, 249, .8);
  --shadow: 0 12px 32px -14px rgba(83, 46, 24, .22);
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15100c; --paper: #211913; --tint: #1c1611; --ink: #f4ebdf; --muted: #bba997; --line: #3a2e24; --field: #8a7663;
  --copper: #e58c5c; --copper-ink: #f0a477; --teal: #5cc2a6; --teal-ink: #7fd3ba;
  --on-accent: #1a130e; --pending: #f3c27a; --glow: rgba(229, 140, 92, .12);
  --card: rgba(33, 25, 19, .75); --hover-wash: rgba(255, 255, 255, .06);
  --shadow: 0 12px 32px -14px rgba(0, 0, 0, .7);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #15100c; --paper: #211913; --tint: #1c1611; --ink: #f4ebdf; --muted: #bba997; --line: #3a2e24; --field: #8a7663;
    --copper: #e58c5c; --copper-ink: #f0a477; --teal: #5cc2a6; --teal-ink: #7fd3ba;
    --on-accent: #1a130e; --pending: #f3c27a; --glow: rgba(229, 140, 92, .12);
    --card: rgba(33, 25, 19, .75); --hover-wash: rgba(255, 255, 255, .06);
    --shadow: 0 12px 32px -14px rgba(0, 0, 0, .7);
  }
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-font-smoothing: antialiased; }
body {
  background: radial-gradient(60rem 28rem at 90% -10%, var(--glow), transparent 70%), var(--bg);
  color: var(--ink); font: 16px/1.7 "Manrope", system-ui, sans-serif;
}
a { color: var(--copper-ink); text-underline-offset: .2em; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--copper); outline-offset: 3px; border-radius: 6px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; max-width: 820px; margin: 0 auto; padding: 1.4rem 1rem; border-bottom: 1px solid var(--line); }
.top-actions { display: flex; align-items: center; gap: 1rem; }
.brand { font-weight: 600; font-size: 1.1rem; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; }
.brand em { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 1.3em; color: var(--teal); font-weight: 600; }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; margin-right: .55rem; background: conic-gradient(from 210deg, var(--copper), var(--amber), var(--teal), var(--copper)); box-shadow: 0 0 12px rgba(240, 178, 107, .8); }
.brand-logo { display: inline-flex; align-items: baseline; gap: .42rem; }
.brand-text { font-family: "JetBrains Mono", monospace; font-size: .62em; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.brand-bam { display: inline-flex; font-size: 1.22em; font-weight: 600; letter-spacing: -0.045em; line-height: 1; }
.brand-bam i { display: inline-block; font-style: normal; background: linear-gradient(100deg, var(--copper-ink), var(--copper) 45%, var(--teal)); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.brand-bam i:nth-child(2) { background-position: 50% 0; }
.brand-bam i:nth-child(3) { background-position: 100% 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.back { display: inline-flex; align-items: center; min-height: 24px; font-family: "JetBrains Mono", monospace; font-size: .8rem; text-decoration: none; color: var(--muted); }

/* Theme toggle: shows the current theme's icon; aria-pressed says whether dark is on. */
.theme-toggle {
  display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0;
  border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer;
  transition: background-color 200ms, border-color 200ms;
}
.theme-toggle:hover { background: var(--tint); border-color: var(--field); }
.theme-toggle svg {
  grid-area: 1 / 1; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  transition: opacity 350ms, rotate 350ms, scale 350ms;
}
.theme-toggle .i-moon, [data-theme="dark"] .theme-toggle .i-sun { opacity: 0; rotate: -45deg; scale: .6; }
[data-theme="dark"] .theme-toggle .i-moon { opacity: 1; rotate: 0deg; scale: 1; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { opacity: 0; rotate: -45deg; scale: .6; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { opacity: 1; rotate: 0deg; scale: 1; }
}

main { max-width: 820px; margin: 0 auto; padding: 3rem 1rem 5rem; }
main > * { max-width: 46rem; }
main > .table-wrap { max-width: none; }
h1 { font-family: "Cormorant Garamond", serif; font-style: italic; font-weight: 500; font-size: clamp(2.4rem, 6vw, 3.4rem); line-height: 1.05; letter-spacing: -0.01em; margin-bottom: .8rem; }
h2 { font-weight: 500; font-size: 1.5rem; letter-spacing: -0.02em; margin: 2.6rem 0 .8rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
h3 { font-size: 1rem; margin: 1.6rem 0 .4rem; }
p, li, td { color: var(--muted); }
strong { color: var(--ink); }
main > p + p { margin-top: .9rem; }
.updated + p { margin-top: 1.2rem; }
ul, ol { padding-left: 1.2rem; margin: .4rem 0 1rem; }
.updated { font-family: "JetBrains Mono", monospace; font-size: .78rem; color: var(--muted); }
.pending { color: var(--pending); font-family: "JetBrains Mono", monospace; font-size: .85rem; }
.table-wrap { overflow-x: auto; }
.table-wrap:focus-visible { outline: 2px solid var(--copper); outline-offset: 3px; border-radius: 6px; }
table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .92rem; min-width: 560px; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink); font-weight: 600; }
.foot { max-width: 820px; margin: 0 auto; padding: 1.4rem 1rem 3rem; border-top: 1px solid var(--line); font-family: "JetBrains Mono", monospace; font-size: .8rem; color: var(--muted); display: flex; gap: 1.2rem; flex-wrap: wrap; }
.foot a { color: var(--muted); display: inline-flex; align-items: center; min-height: 24px; }
code { font-family: "JetBrains Mono", monospace; font-size: .85em; color: var(--ink); }
.code { position: relative; margin: 1rem 0; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.code pre { margin: 0; padding: 1.1rem 1rem 3.2rem; white-space: pre-wrap; word-break: break-all; }
.copy { position: absolute; right: .6rem; bottom: .6rem; min-height: 36px; padding: 0 1rem; border: 0; border-radius: 999px; background: var(--ink); color: var(--bg); font: 600 .8rem "Manrope", sans-serif; cursor: pointer; }
.lead { font-size: 1.12rem; color: var(--ink); }
.cta { margin: 2.4rem 0 0; padding: 1.4rem 1.2rem 1.6rem; border: 1px solid var(--line); border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.cta p { margin: 0; }
.cta .btn { margin: 1.1rem .8rem 0 0; }
.lang { display: inline-flex; align-items: center; min-height: 24px; font-family: "JetBrains Mono", monospace; font-size: .78rem; }
.btn { display: inline-flex; align-items: center; min-height: 48px; padding: 0 1.5rem; border-radius: 999px; background: var(--teal); color: var(--on-accent); font-weight: 600; text-decoration: none; margin-top: 1.6rem; border: 1px solid var(--teal); }
.btn:hover { background: var(--teal-ink); }
.btn.btn-ghost { background: transparent; color: var(--teal-ink); border: 1px solid var(--teal); }
.btn.btn-ghost:hover { background: var(--hover-wash); }
.btn-row { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; }
.btn-row .btn { margin-top: 0; }

@media (prefers-reduced-motion: reduce) { .theme-toggle, .theme-toggle svg { transition: none; } }
