/* Trust pages (docs/ARCHITECTURE.md §12.1): Privacy, Terms and the parents' guide (src/site/pages/legal.ts), the
   recovery codes sheet, /forgot and the settings section (src/site/pages/recovery.ts), and the sign-up age screen
   (src/site/pages/auth.ts). Builds on retro.css tokens and classes. */

/* ── Legal pages ────────────────────────────────────────────────────────── */

.legal { display: grid; gap: 18px; }
.legal > * + * { margin-top: 0; }

.legal-hero .page-hero-title { font-size: 24px; }
.legal-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 12px 0 0;
  font-size: 13px;
  color: #dfe7ff;
}
.legal-chip {
  display: inline-block;
  padding: 6px 10px;
  border: 2px solid #ffd400;
  border-radius: 999px;
  background: rgba(10, 17, 80, 0.55);
  color: #ffd400;
  font-size: 10px;
  line-height: 1.3;
}
.legal-hero-mail { color: #ffe27a; font-weight: 700; }
.legal-hero-mail:hover { color: #fff; }

/* "In short": a sticky note at the top of every page. */
.legal-short {
  position: relative;
  padding: 18px 20px 16px;
  border: 3px solid var(--rr-navy);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #fff7b8 0%, #ffe970 100%);
  box-shadow: var(--shadow-chunky);
}
.legal-short-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font: 700 16px/1.2 var(--font-pixel);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.legal-short-badge {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border: 2px solid var(--rr-navy);
  border-radius: 50%;
  background: var(--rr-red);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 2px 0 var(--rr-navy);
}
.legal-short-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.legal-short-list li {
  position: relative;
  padding-left: 30px;
  font-size: 15px;
  line-height: 1.5;
  max-width: 80ch;
}
.legal-short-list li::before {
  content: "★";
  position: absolute;
  left: 2px;
  top: -1px;
  color: var(--rr-orange);
  text-shadow: 0 1px 0 var(--rr-navy);
  font-size: 18px;
}
.legal-short-more { margin: 12px 0 0; color: var(--rr-muted); }

.legal-layout {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.legal-toc {
  position: sticky;
  top: 12px;
  padding: 14px 14px 12px;
  border: 3px solid var(--rr-navy);
  border-radius: var(--radius-lg);
  background: var(--rr-soft);
  box-shadow: var(--shadow-chunky);
}
.legal-toc-title { margin: 0 0 8px; font-size: 11px; color: var(--rr-navy); }
.legal-toc ol { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; counter-reset: toc; }
.legal-toc li { counter-increment: toc; }
.legal-toc a {
  display: flex;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 8px;
  color: var(--rr-navy);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.legal-toc a::before { content: counter(toc); min-width: 1.4em; color: var(--rr-muted); font-variant-numeric: tabular-nums; }
.legal-toc a:hover, .legal-toc a:focus-visible { background: #fff; color: var(--rr-link-hover); text-decoration: underline; }

.legal-article .panel-body { padding: 6px 22px 22px; }
.legal-prose { font-size: 14.5px; line-height: 1.6; }
.legal-prose p, .legal-prose li, .legal-prose dd { max-width: 78ch; }
.legal-section { scroll-margin-top: 16px; padding-top: 18px; }
.legal-section + .legal-section { margin-top: 18px; border-top: 2px dashed var(--rr-line); }
.legal-section > h2 { margin: 0 0 10px; font-size: 19px; }
.legal-section:target > h2 { text-decoration: underline wavy var(--rr-gold) 2px; text-underline-offset: 5px; }
.legal-subhead {
  margin: 20px 0 10px;
  padding: 6px 10px;
  border-left: 6px solid var(--rr-blue);
  border-radius: 4px;
  background: var(--rr-soft);
  font-size: 15px;
}
.legal-prose .rules-list { margin-bottom: 0.8em; }
.legal-never { margin-top: 14px; }

/* The privacy inventory: what / why / how long. */
.data-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
}
.data-card {
  padding: 12px 14px;
  border: 2px solid var(--rr-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 0 rgba(20, 32, 107, 0.1);
}
.data-card-title { margin: 0 0 8px; color: var(--rr-navy); font-size: 14.5px; }
.data-card dl { display: grid; gap: 2px; margin: 0; }
.data-card dt {
  margin-top: 6px;
  color: var(--rr-muted);
  font: 700 10.5px/1.2 var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.data-card dt:first-child { margin-top: 0; }
.data-card dd { margin: 0; font-size: 13.5px; line-height: 1.5; }

.legal-table th[scope="row"] { white-space: nowrap; }

.legal-who { display: grid; gap: 4px; margin: 0 0 0.8em; }
.legal-who dt { margin-top: 10px; color: var(--rr-navy); font-size: 15px; }
.legal-who dt:first-child { margin-top: 0; }
.legal-who dd { margin: 0; padding-left: 14px; border-left: 3px solid var(--rr-line); }

.legal-more {
  padding: 12px 16px;
  border: 2px dashed var(--rr-line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.85);
  text-align: center;
}
.legal-more ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin: 0 0 6px; padding: 0; list-style: none; }
.legal-more a, .legal-more [aria-current] { font-weight: 700; }
.legal-more [aria-current] { color: var(--rr-navy); }
.legal-more p { margin: 0; color: var(--rr-muted); }

/* ── Sign-up age screen ─────────────────────────────────────────────────── */

.birth-fieldset { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.birth-fieldset > legend { margin: 0 0 6px; padding: 0; color: var(--rr-navy); font-weight: 700; }
.birth-fieldset > .form-hint { margin: 0; }
.birth-fields { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; max-width: 380px; }
.birth-fields .form-row > label { color: var(--rr-muted); font-size: 12.5px; font-weight: 700; }
.birth-fields select { width: 100%; min-height: 40px; }
.birth-fieldset .form-error { margin: 0; }

.signup-hold { max-width: 760px; margin: 12px auto; }
.signup-hold .empty { border: 3px solid var(--rr-navy); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-chunky); padding: 22px; }

/* ── Recovery codes ─────────────────────────────────────────────────────── */

.recovery-page { max-width: 820px; margin: 0 auto; }
.recovery-intro { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.recovery-art { flex: none; width: 88px; filter: drop-shadow(0 4px 0 rgba(20, 32, 107, 0.25)); }
.recovery-lead { margin: 0 0 10px; font-size: 15px; }
.recovery-warning { margin: 0; }

.recovery-print-area {
  padding: 14px 16px;
  border: 3px dashed var(--rr-navy);
  border-radius: 14px;
  background: #fffdf2;
}
.recovery-print-title { margin: 0 0 10px; color: var(--rr-navy); }
.recovery-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  counter-reset: code;
}
.recovery-codes li { counter-increment: code; display: flex; align-items: center; gap: 10px; }
.recovery-codes li::before {
  content: counter(code);
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--rr-navy);
  color: #ffd400;
  font: 700 11px/1 var(--font-arcade);
}
.recovery-code {
  padding: 6px 10px;
  border: 2px solid var(--rr-navy);
  border-radius: 8px;
  background: #fff;
  color: var(--rr-navy);
  font: 700 17px/1.2 var(--font-mono);
  letter-spacing: 0.08em;
  white-space: nowrap;
  user-select: all;
}
.recovery-print-note { margin: 0; color: var(--rr-muted); }
.recovery-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.recovery-subhead { margin: 18px 0 8px; font-size: 16px; }
.recovery-tips { margin-bottom: 4px; }
.recovery-continue { margin-top: 16px; }
/* The continue label names where you go next ("…Back to my game idea!"): let it wrap on a phone instead of
   pushing the page sideways (.btn is nowrap). */
.recovery-continue .btn { max-width: 100%; white-space: normal; text-align: center; }

.recovery-code-input { font-family: var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.recovery-code-input::placeholder { text-transform: none; letter-spacing: 0.04em; }

/* Settings → Recovery codes */
.recovery-count { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; margin: 0 0 8px; font-weight: 700; }
.recovery-count-num {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 6px;
  border: 2px solid var(--rr-navy);
  border-radius: 8px;
  background: #0f1640;
  color: #7dff8a;
  font-size: 13px;
}
.recovery-make { margin-top: 12px; max-width: 420px; }

/* Editors: the one-time code */
.recovery-admin { max-width: 760px; }
.recovery-admin .form { margin-top: 14px; }
.recovery-admin-code { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 0 14px; }
.recovery-code-big { font-size: 22px; padding: 10px 14px; }

@media (max-width: 980px) {
  .legal-layout { grid-template-columns: minmax(0, 1fr); }
  .legal-toc { position: static; }
  .legal-toc ol { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px 10px; }
}

@media (max-width: 560px) {
  .legal-hero .page-hero-art { width: 72px; }
  .legal-hero .page-hero-title { font-size: 19px; }
  .legal-short { padding: 14px 14px 12px; }
  .legal-short-list li { font-size: 14px; }
  .legal-article .panel-body { padding: 4px 14px 16px; }
  .legal-section > h2 { font-size: 17px; }
  .data-cards { grid-template-columns: minmax(0, 1fr); }
  /* The cookie table becomes one card per cookie. */
  .legal-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .legal-table, .legal-table tbody, .legal-table tr, .legal-table th, .legal-table td { display: block; }
  .legal-table tbody tr + tr { border-top: 2px solid var(--rr-line); }
  .legal-table tbody th[scope="row"] { padding-bottom: 2px; border-top: 0; }
  .legal-table td { padding-top: 2px; border-top: 0; }
  .legal-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--rr-muted);
    font: 700 10.5px/1.4 var(--font-body);
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  .recovery-intro { flex-direction: column; }
  .recovery-art { width: 72px; }
  .recovery-codes { grid-template-columns: minmax(0, 1fr); }
  .recovery-code { font-size: 16px; }
  .recovery-actions .btn { flex: 1 1 140px; }
}

@media print {
  .legal-toc, .legal-more { display: none !important; }
  .legal-layout { grid-template-columns: 1fr; }
  .legal-short, .legal-article, .legal-hero { box-shadow: none; }
  .legal-hero { background: #fff; color: #000; }
  .legal-hero .page-hero-title, .legal-hero .page-hero-lead, .legal-meta, .legal-chip { color: #000; text-shadow: none; }

  /* The codes sheet prints just the codes. */
  body:has(.recovery-print-area) .masthead,
  body:has(.recovery-print-area) .flash,
  .recovery-sheet > .panel-head,
  .recovery-intro,
  .recovery-actions,
  .recovery-subhead,
  .recovery-tips,
  .recovery-continue { display: none !important; }
  .recovery-sheet { border: 0; box-shadow: none; }
  .recovery-print-area { border-color: #000; background: #fff; }
}
