/* Terms and Privacy pages: built on road.css (tokens, top bar, footer).
   Dark header like a road sign gantry, a contents list drawn as a road with the reader as the car,
   clauses numbered like kilometre posts. The legal text itself is unchanged. */

.legal-page { background: var(--paper); }
.legal-page .topbar.scrolled { background: rgba(6, 18, 32, .97); }

/* reading progress: a thin headlight line under the top bar */
.read-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; pointer-events: none; }
.read-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--sky), var(--brand)); transform: scaleX(0); transform-origin: left; box-shadow: 0 0 10px rgba(90,176,255,.7); }

/* ---------- header block ---------- */
.legal-hero { position: relative; overflow: hidden; background: radial-gradient(1000px 420px at 85% -10%, rgba(11,95,176,.45), transparent 60%), var(--night); color: #fff; padding: 128px 0 64px; }
.legal-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 22px; height: 4px; background: repeating-linear-gradient(90deg, rgba(90,176,255,.55) 0 34px, transparent 34px 60px); background-size: 60px 4px; animation: lane 2.4s linear infinite; opacity: .7; }
.legal-hero .container { max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); position: relative; }
.legal-hero .kicker { display: inline-flex; align-items: center; gap: 10px; background: var(--sign); color: #fff; border-radius: 10px; padding: 8px 14px; font: 800 14px/1 var(--display); letter-spacing: .02em; box-shadow: inset 0 0 0 3px var(--sign), inset 0 0 0 5px #fff, 0 10px 24px -10px rgba(11,95,176,.8); }
.legal-hero .kicker::before { content: ""; width: 14px; height: 16px; background: #fff; clip-path: polygon(0 0, 70% 0, 100% 28%, 100% 100%, 0 100%); }
.legal-hero h1 { margin-top: 22px; font-size: clamp(38px, 6vw, 72px); line-height: 1.02; font-weight: 900; }
.legal-hero .lead { margin: 18px 0 0; max-width: 70ch; font-size: clamp(16px, 1.5vw, 19px); line-height: 1.6; color: rgba(255,255,255,.78); }
.legal-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.legal-meta > span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); font-size: 14px; color: rgba(255,255,255,.7); }
.legal-meta strong { color: #fff; font-weight: 700; }
.legal-meta a { color: var(--sky); text-decoration: none; font-weight: 600; }
.legal-meta a:hover { text-decoration: underline; }

/* ---------- body: contents + text ---------- */
.legal-body { padding: 48px 0 88px; }
.legal-grid { max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 48px; align-items: start; }

.legal-toc { position: sticky; top: 92px; max-height: calc(100vh - 116px); overflow: auto; overscroll-behavior: contain; background: #fff; border-radius: 22px; padding: 22px 18px 22px 22px; box-shadow: 0 24px 48px -36px rgba(6,18,32,.45); border: 1px solid rgba(14,23,38,.06); scrollbar-width: thin; }
.legal-toc summary { display: none; }
.legal-toc-head { font: 900 18px/1 var(--display); margin-bottom: 14px; }
.legal-toc ul { list-style: none; margin: 0; padding: 0 0 0 16px; position: relative; }
/* the road: a dashed lane line down the left edge */
.legal-toc ul::before { content: ""; position: absolute; left: 3px; top: 4px; bottom: 4px; width: 2px; background: repeating-linear-gradient(180deg, var(--line) 0 8px, transparent 8px 14px); }
.legal-toc-part { margin: 18px 0 6px; font-size: 11.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--sign); }
.legal-toc-part:first-child { margin-top: 0; }
.legal-toc a { position: relative; display: block; padding: 5px 8px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 14px; line-height: 1.4; transition: color .2s, background-color .2s; }
.legal-toc a:hover { color: var(--ink); background: var(--paper); }
/* the reader: a blue dot that sits on the lane line next to the current clause */
.legal-toc a::before { content: ""; position: absolute; left: -17px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 999px; background: var(--brand); box-shadow: 0 0 0 3px #fff, 0 0 12px 2px rgba(0,113,227,.6); transform: scale(0); transition: transform .25s cubic-bezier(.2,.8,.2,1); }
.legal-toc a.active { color: var(--ink); font-weight: 700; background: #eef5fd; }
.legal-toc a.active::before { transform: scale(1); }

.legal-content { min-width: 0; max-width: 820px; }
.legal-content > .lede { display: none; } /* repeats the header lead */

.legal-part + .legal-part { margin-top: 56px; }
.legal-part-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--sign); }
.legal-part-eyebrow::before { content: ""; width: 22px; height: 4px; border-radius: 4px; background: var(--brand); }
.legal-part h2 { margin: 8px 0 20px; font-size: clamp(26px, 3vw, 36px); line-height: 1.1; font-weight: 900; }

.legal-clause { position: relative; scroll-margin-top: 96px; background: #fff; border-radius: 20px; padding: 24px 28px; border: 1px solid rgba(14,23,38,.06); box-shadow: 0 18px 36px -32px rgba(6,18,32,.4); }
.legal-clause + .legal-clause { margin-top: 14px; }
.legal-clause-head { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; }
/* clause number: large blue numeral with a hairline before the title */
.legal-clause-num { flex: none; padding: 2px 18px 2px 0; border-right: 1px solid var(--line); background: linear-gradient(135deg, var(--brand) 20%, var(--sky)); -webkit-background-clip: text; background-clip: text; color: transparent; font: 800 28px/1 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.legal-clause-title { font: 800 clamp(18px, 1.7vw, 21px)/1.25 var(--display); letter-spacing: -0.01em; text-wrap: balance; }
.legal-clause p { margin: 0; font-size: 16px; line-height: 1.7; color: #2b3646; }
.legal-clause p + p, .legal-clause p + .legal-table, .legal-clause .legal-table + p { margin-top: 12px; }
.legal-clause a { color: var(--brand); text-underline-offset: 3px; }
.legal-clause:target { animation: arrive 1.6s ease-out; }
@keyframes arrive { 0%, 30% { box-shadow: 0 0 0 3px var(--sky), 0 18px 36px -24px rgba(11,95,176,.6); } }

/* important clauses: primary-blue edge and a label */
.legal-clause.callout { background: linear-gradient(90deg, #eaf3fe, #fff 40%); border-color: #c9def7; box-shadow: inset 5px 0 0 var(--brand), 0 18px 36px -32px rgba(6,18,32,.4); }
.legal-callout-label { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; padding: 4px 10px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.legal-callout-label::before { content: "!"; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 999px; background: #fff; color: var(--brand); font-size: 11px; }

.legal-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.legal-table table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 14.5px; line-height: 1.5; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.legal-table th { background: var(--paper); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.legal-table tr:last-child td { border-bottom: 0; }

.legal-footnote { margin-top: 40px; padding-top: 22px; border-top: 1px dashed var(--line); font-size: 14px; color: var(--muted); }
.legal-footnote p { margin: 0; }
.legal-footnote p + p { margin-top: 6px; }

/* the footer sits right after the light body */
.legal-page .foot { margin-top: 0; }

@media (max-width: 900px) {
    .legal-hero { padding: 104px 0 52px; }
    .legal-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .legal-toc { position: sticky; top: 76px; z-index: 5; max-height: calc(100vh - 96px); padding: 0; border-radius: 16px; box-shadow: 0 -12px 0 var(--paper), 0 18px 30px -24px rgba(6,18,32,.5); }
    .legal-toc summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; cursor: pointer; list-style: none; font: 800 16px/1 var(--display); }
    .legal-toc summary::-webkit-details-marker { display: none; }
    .legal-toc summary::after { content: "+"; font-size: 22px; line-height: 1; color: var(--brand); transition: transform .25s; }
    .legal-toc[open] summary::after { transform: rotate(45deg); }
    .legal-toc-head { display: none; }
    .legal-toc ul { margin: 0 18px 18px 30px; }
    .legal-clause { padding: 20px 18px; border-radius: 16px; }
    .legal-clause-head { align-items: flex-start; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .legal-hero::after, .legal-clause:target { animation: none; }
    .legal-toc a::before { transition: none; }
}
