/* privacy + terms.  Loaded after theme.css and scene.css.
   A long, plain reading card with a small contents slip beside it. The slip sticks to the top of the
   window on a wide screen and folds up into one row on a phone. The legal text itself is copied from
   the real pages word for word; only the wrapping changed. */

main.legal-page .container { max-width: 72rem; }
.legal-page { padding: clamp(28px, 4vw, 56px) 0 clamp(60px, 8vw, 110px); }

.legal-head { width: fit-content; max-width: min(100%, 40rem); }
.legal-head h1 { font-size: var(--step-3); margin-bottom: .1rem; }
.legal-head p { font-size: var(--step-1); }

.legal-grid { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); gap: clamp(24px, 3vw, 40px); margin-top: clamp(24px, 3vw, 36px); align-items: start; }

/* ---------- the contents slip ---------- */
.legal-toc { position: sticky; top: 88px; max-height: calc(100svh - 112px); overflow-y: auto; background: var(--cream); border-radius: 12px; box-shadow: 5px 5px 0 var(--edge); padding: 18px 14px 12px; }
.legal-toc summary { list-style: none; padding: 0 10px 12px; font: 700 .75rem/1 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); cursor: default; }
.legal-toc summary::-webkit-details-marker { display: none; }
.legal-toc ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.legal-toc a { display: flex; align-items: center; min-height: 44px; padding: 8px 10px; border-radius: 8px; font: 700 .9375rem/1.25 var(--font-ui); color: var(--ink); text-decoration: none; }
.legal-toc a:hover { background: rgb(var(--ink-rgb) / .08); color: var(--ink); }
.legal-toc a[aria-current="true"] { background: var(--pen-wash); color: var(--terra-deep); box-shadow: inset 3px 0 0 var(--terra); }

/* ---------- the reading card ---------- */
.legal-grid .legal { max-width: none; margin: 0; padding: clamp(24px, 3.4vw, 46px); }
.legal-updated { display: inline-block; margin: 0 0 .6rem; padding: 8px 12px 7px; background: var(--cream-2); border-radius: var(--radius-sm); box-shadow: 3px 3px 0 var(--edge); font: 700 .875rem/1 var(--font-ui); color: var(--ink-dim); transform: rotate(-1deg); }

.legal h2 { margin: 2.6rem 0 0; padding-top: 1.5rem; border-top: 2px dotted rgb(var(--ink-rgb) / .28); font: 400 clamp(1.45rem, 1.2rem + .9vw, 1.8rem)/1.15 var(--font-heading); color: var(--ink); }
.legal h2:first-of-type { margin-top: 1.4rem; padding-top: 0; border-top: 0; }
.legal h3 { margin: 1.7rem 0 0; font: 400 1.2rem/1.2 var(--font-heading); color: var(--ink); }
.legal p, .legal li { color: var(--ink); font-size: 1.0625rem; line-height: 1.65; }
.legal p { margin: .85rem 0 0; max-width: 66ch; }
.legal ul { margin: .85rem 0 0; padding-left: 1.4rem; }
.legal li { margin: .5rem 0 0; max-width: 64ch; }
.legal li::marker { color: var(--terra); }
.legal strong { color: var(--ink); }
.legal a { color: var(--pen); text-underline-offset: 3px; }
.legal a:hover { color: var(--pen-deep); }
.legal-note { margin: 2.6rem 0 0; max-width: 66ch; color: var(--ink); line-height: 1.55; }
.legal-note a, .legal-note a:hover { color: inherit; font-weight: 700; }   /* the pen colour fails 4.5:1 on the yellow note in dark */
.legal-note::before { font: 700 .75rem/1 var(--font-ui); letter-spacing: .1em; color: var(--pen-deep); }

/* ---------- a phone: the slip becomes one folding row above the text ---------- */
@media (max-width: 960px) {
  .legal-grid { grid-template-columns: 1fr; }
  .legal-toc { position: static; max-height: none; overflow: visible; padding: 4px 14px; }
  .legal-toc summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 10px; cursor: pointer; border-radius: var(--radius-sm); }
  .legal-toc summary::after { content: ""; flex: none; width: 9px; height: 9px; margin-right: 4px; border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s; }
  .legal-toc details[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
  .legal-toc details[open] summary { padding-bottom: 0; }
  .legal-toc ul { padding-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .legal-toc summary::after { transition: none; }
}
