/* ==========================================================================
   Vectored — legal pages
   Loaded after style.css, on the five legal documents only. It adds the two
   things a long document needs and a landing page does not: a table of
   contents that tracks the scroll, and typography that survives 3,000 words.
   Everything else (tokens, nav, footer, buttons) comes from vec.css.
   ========================================================================== */

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

.legal-head {
  /* The header is fixed, so the first thing on the page has to clear it. */
  padding-block: calc(var(--header-h) + clamp(36px, 20px + 4vw, 72px)) clamp(24px, 4vw, 36px);
  border-bottom: 1px solid var(--divider);
}
.legal-head__kicker {
  font: 600 12.5px/1 var(--mono);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--amber-500);
}
.legal-head h1 {
  margin-top: 14px;
  font-size: clamp(34px, 5.4vw, 52px);
}
.legal-head__sub {
  margin-top: 16px;
  max-width: 62ch;
  font-size: 17.5px;
  line-height: 1.55;
  color: var(--text-2);
}
.legal-head__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 22px;
  font-size: 13.5px;
  color: var(--text-3);
}
.legal-head__meta b { color: var(--text-2); font-weight: 600; }

/* --- Layout ------------------------------------------------------------- */

.legal-layout {
  display: grid;
  /* minmax(0, …) and not 1fr: a grid item refuses to shrink below its
     min-content width, and one wide price table would then push the whole
     page sideways on a phone. */
  grid-template-columns: minmax(0, 1fr);
  gap: 40px;
  padding-block: clamp(32px, 5vw, 56px) clamp(64px, 9vw, 104px);
}
@media (min-width: 900px) {
  .legal-layout { grid-template-columns: 232px minmax(0, 1fr); gap: 64px; }
}

/* --- Table of contents -------------------------------------------------- */

.toc { align-self: start; }
@media (min-width: 900px) {
  .toc { position: sticky; top: 92px; max-height: calc(100vh - 120px); overflow-y: auto; }
}
.toc__title {
  display: none;
  font: 600 12px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.toc ol { margin: 14px 0 0; padding: 0; list-style: none; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 6px;
  padding: 7px 10px 7px 6px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.35;
  color: var(--text-2);
  text-decoration: none;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.toc a::before {
  content: counter(toc);
  font: 500 12px/1.5 var(--mono);
  color: var(--text-3);
}
.toc a:hover { background: var(--sunk); color: var(--text); }
.toc a.is-current { background: var(--amber-050); color: var(--text); font-weight: 600; }
.toc a.is-current::before { color: var(--amber-500); }

/* Small screens: the list collapses so it never buries the document. */
.toc__toggle {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--divider);
  border-radius: var(--r-btn);
  background: var(--elevated);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.toc__toggle::after { content: '↓'; float: right; color: var(--text-3); }
.toc__toggle[aria-expanded="true"]::after { content: '↑'; }
.toc__panel[hidden] { display: none; }

@media (min-width: 900px) {
  .toc__toggle { display: none; }
  .toc__title { display: block; }
  /* The panel is never collapsed on desktop, whatever JS last set. */
  .toc__panel, .toc__panel[hidden] { display: block; }
}

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

.legal-body { max-width: 72ch; min-width: 0; }
.legal-body > section { scroll-margin-top: 88px; }
.legal-body > section + section { margin-top: 52px; }

.legal-body h2 {
  font-size: clamp(21px, 2.4vw, 25px);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--divider);
}
.legal-body h2 .num {
  display: inline-block;
  min-width: 1.6em;
  font: 600 .68em/1 var(--mono);
  color: var(--amber-500);
  vertical-align: baseline;
}
.legal-body h3 {
  margin-top: 30px;
  font-size: 17px;
  letter-spacing: -.012em;
}
.legal-body p,
.legal-body li {
  margin-top: 14px;
  color: var(--text-2);
  font-size: 16.5px;
  line-height: 1.65;
}
.legal-body ul,
.legal-body ol { margin: 0; padding-left: 22px; }
.legal-body li::marker { color: var(--text-3); }
.legal-body a { color: var(--amber-500); text-underline-offset: 2px; }
.legal-body strong { color: var(--text); font-weight: 600; }

/* A clause the reader must not skim past — withdrawal rights, cancellation,
   liability caps. One accent, used sparingly, or it stops meaning anything. */
.legal-note {
  margin-top: 22px;
  padding: 18px 20px;
  border: 1px solid var(--divider);
  border-left: 3px solid var(--amber-500);
  border-radius: 0 var(--r-card) var(--r-card) 0;
  background: var(--sunk);
}
.legal-note p:first-child { margin-top: 0; }
.legal-note__label {
  font: 600 11.5px/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--amber-500);
}

/* --- Tables (prices, cookies, data categories) -------------------------- */

.legal-table-wrap {
  margin-top: 20px;
  overflow-x: auto;
  border: 1px solid var(--divider);
  border-radius: var(--r-card);
}
.legal-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.legal-table th,
.legal-table td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--divider);
  color: var(--text-2);
}
.legal-table thead th {
  background: var(--sunk);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .01em;
  white-space: nowrap;
}
.legal-table tbody tr:last-child th,
.legal-table tbody tr:last-child td { border-bottom: 0; }
.legal-table tbody th { font-weight: 600; color: var(--text); white-space: nowrap; }
.legal-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --- Definition list (identity block on the legal notice) --------------- */

.deflist {
  margin: 20px 0 0;
  display: grid;
  gap: 0;
  border: 1px solid var(--divider);
  border-radius: var(--r-card);
  overflow: hidden;
}
.deflist > div {
  display: grid;
  gap: 4px 24px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--divider);
}
@media (min-width: 620px) {
  .deflist > div { grid-template-columns: 200px minmax(0, 1fr); align-items: baseline; }
}
.deflist > div:last-child { border-bottom: 0; }
.deflist dt { font-size: 13.5px; font-weight: 600; color: var(--text); }
.deflist dd { margin: 0; font-size: 15.5px; color: var(--text-2); }

/* --- Unverified facts ---------------------------------------------------
   Anything only the operator can supply — company number, registered address,
   host. Deliberately loud: a placeholder that ships is worse than a missing
   page, and `tools/build-dist.sh` fails the build while any remain. */
.tbd {
  display: inline-block;
  padding: 1px 8px;
  border: 1px dashed var(--danger);
  border-radius: 6px;
  background: rgba(198, 72, 62, .07);
  font: 600 13.5px/1.5 var(--mono);
  color: var(--danger);
  white-space: nowrap;
}

/* --- Cross-links between the five documents ----------------------------- */

.legal-also {
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--divider);
}
.legal-also__title {
  font: 600 12px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.legal-also__grid {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  /* Four documents cross-link from each page; 210px left the fourth alone on
     a second row inside the article column. */
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
}
.legal-also__grid a {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--divider);
  border-radius: var(--r-card);
  background: var(--elevated);
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
.legal-also__grid a span {
  display: block;
  margin-top: 4px;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--text-3);
}
.legal-also__grid a:hover {
  border-color: var(--amber-300);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
@media (prefers-reduced-motion: reduce) {
  .legal-also__grid a:hover { transform: none; }
}
