/* ────────────────────────────────────────────────────────────────
   GOAT Finance · Legal Hub · Shared Stylesheet
   ────────────────────────────────────────────────────────────────
   Source of truth: GOAT_Finance___Brand_Guidelines_V1_0.pdf
   (April 2026). Supersedes goatfinance.io/brand where they differ.

   Conventions follow the PDF tokens (§ 11):
     --f-display / --f-body / --f-mono
     --ease / --spring
     --gold (#E89B3C) is the primary accent; --gold-2 (#C9A961) is muted.

   - Dark mode is default. Light mode via [data-theme="light"].
   - Film grain overlay (§ 08) applied via .grain on <body>.
   - Logo wordmark uses currentColor so a single SVG serves both themes;
     the gold dot retains fixed --gold.
   - Print forces light surface for paper legibility.
   ──────────────────────────────────────────────────────────────── */


/* ─── 1. Brand tokens (verbatim from PDF § 11) ─────────────────── */
:root,
[data-theme="dark"] {
    /* Surfaces */
    --ink:        #0A0A0B;
    --ink-2:      #0F0F11;
    --ink-3:      #151519;

    /* Text */
    --bone:       #F4F1EA;
    --bone-2:     #E8E4DB;
    --paper:      #FAF8F3;

    /* Accents */
    --gold:       #E89B3C;
    --gold-2:     #C9A961;
    --gold-soft:  rgba(232, 155, 60, 0.18);

    /* Semantic */
    --signal:     #7FEBA0;
    --alert:      #FF6B4A;

    /* Opacity-derived text colors (bone on ink) */
    --text-dim:   rgba(244, 241, 234, 0.62);
    --text-faint: rgba(244, 241, 234, 0.38);

    /* Structural lines */
    --line:       rgba(244, 241, 234, 0.08);
    --line-2:     rgba(244, 241, 234, 0.14);

    /* Typography */
    --f-display:  'Fraunces', Georgia, serif;
    --f-body:     'Geist', Helvetica, sans-serif;
    --f-mono:     'Geist Mono', ui-monospace, monospace;

    /* Motion */
    --ease:       cubic-bezier(0.22, 1, 0.36, 1);
    --spring:     cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Layout */
    --content-max: 760px;
    --shell-max:   1240px;
    --toc-width:   280px;
    --gutter:      clamp(20px, 4vw, 56px);

    /* Spacing scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;
}

[data-theme="light"] {
    /* Invert surface and text. Gold stays the same — it has WCAG AA
       contrast on both ink and paper backgrounds. */
    --ink:        #FAF8F3;
    --ink-2:      #F4F1EA;
    --ink-3:      #E8E4DB;
    --bone:       #0A0A0B;
    --bone-2:     #2A2A2D;
    --text-dim:   rgba(10, 10, 11, 0.66);
    --text-faint: rgba(10, 10, 11, 0.42);
    --line:       rgba(10, 10, 11, 0.10);
    --line-2:     rgba(10, 10, 11, 0.16);
}


/* ─── 2. Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--space-8);
}

body {
    margin: 0;
    background: var(--ink);
    color: var(--bone);
    font-family: var(--f-body);
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; height: auto; }

a {
    color: var(--bone);
    text-decoration: underline;
    text-decoration-color: var(--gold);
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: color 200ms var(--ease), text-decoration-color 200ms var(--ease);
}

a:hover {
    color: var(--gold);
    text-decoration-color: var(--gold);
}

a:focus-visible {
    outline: 1px solid var(--gold);
    outline-offset: 3px;
}


/* ─── 3. Film grain overlay (PDF § 08) ─────────────────────────── */
.grain::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

[data-theme="light"] .grain::before {
    opacity: 0.05;
    mix-blend-mode: multiply;
}


/* ─── 4. Typography (PDF § 05) ─────────────────────────────────── */
h1, h2, h3, h4 {
    font-family: var(--f-display);
    font-weight: 400;
    color: var(--bone);
    line-height: 1.18;
    letter-spacing: -0.015em;
    margin: 0 0 var(--space-4) 0;
}

/* Display M scale: clamp(32px, 4vw, 56px) — § 05 scale */
h1 {
    font-size: clamp(32px, 4vw, 56px);
    font-weight: 400;
    letter-spacing: -0.02em;
}

h2 {
    font-size: clamp(22px, 2.6vw, 30px);
    font-weight: 400;
    margin-top: var(--space-7);
    padding-top: var(--space-5);
    border-top: 1px solid var(--line);
}

.legal-notice h2,
.legal-clickwrap-ref h2,
.legal-schedule h2,
.legal-section:first-of-type h2 {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

h3 {
    font-size: 19px;
    font-weight: 500;
    margin-top: var(--space-6);
}

p {
    margin: 0 0 var(--space-4) 0;
    color: var(--text-dim);
}

p:last-child { margin-bottom: 0; }

strong { color: var(--bone); font-weight: 600; }

ol, ul {
    margin: 0 0 var(--space-4) 0;
    padding-left: var(--space-5);
    color: var(--text-dim);
}

li { margin-bottom: var(--space-2); }
li p { margin-bottom: var(--space-2); }

ol[type="1"] { list-style-type: decimal; }

code {
    font-family: var(--f-mono);
    font-size: 0.88em;
    background: var(--ink-3);
    padding: 2px 6px;
    border: 1px solid var(--line);
    color: var(--bone);
}


/* ─── 5. Page chrome ───────────────────────────────────────────── */
.skip-link {
    position: absolute;
    left: -9999px;
    top: var(--space-3);
    background: var(--gold);
    color: var(--ink);
    padding: var(--space-3) var(--space-5);
    text-decoration: none;
    font-family: var(--f-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    z-index: 10000;
}

.skip-link:focus { left: var(--space-3); color: var(--ink); }


/* Site header */
.site-header {
    border-bottom: 1px solid var(--line);
    padding: var(--space-4) var(--gutter);
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 11, 0.82);
    backdrop-filter: saturate(140%) blur(12px);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
}

[data-theme="light"] .site-header {
    background: rgba(250, 248, 243, 0.86);
}

.site-header__inner {
    max-width: var(--shell-max);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}


/* Wordmark — inline SVG, uses currentColor for theme switch.
   PDF § 03: digital minimum 120px width. Default at 132px.
   Clear space: 1× cap-height (~6-8px on this size). */
.wordmark {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--bone);
    line-height: 0;
}

.wordmark__svg {
    width: 132px;
    height: auto;
    color: inherit;
}

.wordmark:hover {
    color: var(--bone);
    opacity: 0.85;
}

.wordmark:focus-visible {
    outline: 1px solid var(--gold);
    outline-offset: 4px;
}


/* Header nav */
.site-header__nav {
    display: flex;
    align-items: center;
    gap: var(--space-5);
}

.site-header__nav a {
    font-family: var(--f-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
    text-decoration-color: transparent;
}

.site-header__nav a:hover { color: var(--gold); }


/* Theme toggle — matches the main site button (34×34, 6px radius, subtle bg) */
.theme-toggle {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--bone);
    width: 34px;
    height: 34px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 200ms var(--ease), border-color 200ms var(--ease), color 200ms var(--ease);
    border-radius: 6px;
    padding: 0;
}

[data-theme="light"] .theme-toggle {
    background: rgba(10, 10, 11, 0.03);
    border-color: rgba(10, 10, 11, 0.08);
    color: var(--bone);
}

.theme-toggle:hover {
    color: var(--gold);
    border-color: var(--gold-soft);
}

.theme-toggle svg {
    width: 14px;
    height: 14px;
    display: block;
}

/* Show the icon that represents the CURRENT theme.
   Click goes to the opposite — label is updated by JS. */
[data-theme="dark"] .theme-toggle__icon-sun { display: none; }
[data-theme="light"] .theme-toggle__icon-moon { display: none; }


/* Breadcrumb */
.legal-breadcrumb {
    padding: var(--space-5) var(--gutter) 0;
}

.legal-breadcrumb__inner {
    max-width: var(--shell-max);
    margin: 0 auto;
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--text-faint);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.legal-breadcrumb a {
    color: var(--text-dim);
    text-decoration-color: transparent;
}

.legal-breadcrumb a:hover { color: var(--gold); }

.legal-breadcrumb__sep {
    margin: 0 var(--space-3);
    color: var(--gold);
}

.legal-breadcrumb__current { color: var(--bone); }


/* Footer */
.site-footer {
    margin-top: var(--space-8);
    border-top: 1px solid var(--line);
    padding: var(--space-7) var(--gutter) var(--space-5);
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-dim);
}

.site-footer__inner {
    max-width: var(--shell-max);
    margin: 0 auto;
}

.site-footer__top {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-7);
    padding-bottom: var(--space-7);
    border-bottom: 1px solid var(--line);
}

.site-footer h3 {
    font-family: var(--f-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin: 0 0 var(--space-4) 0;
}

.site-footer__entities {
    list-style: none;
    padding: 0;
    margin: 0;
}

.site-footer__entities li {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--line);
    margin: 0;
}

.site-footer__entities li:last-child { border-bottom: none; }

.site-footer__entities .entity-name {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--bone);
    font-family: var(--f-display);
    font-weight: 500;
    font-size: 15px;
    margin-bottom: 4px;
}

.site-footer__entities .entity-name .gold-dot {
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: var(--gold);
    display: inline-block;
    flex-shrink: 0;
}

.site-footer__entities .entity-meta {
    display: block;
    color: var(--text-faint);
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    line-height: 1.55;
}

.site-footer__links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3) var(--space-5);
}

.site-footer__links a {
    color: var(--text-dim);
    text-decoration-color: transparent;
    font-size: 13.5px;
}

.site-footer__links a:hover {
    color: var(--gold);
    text-decoration-color: var(--gold-soft);
}

.site-footer__legal {
    margin-top: var(--space-5);
    font-size: 12.5px;
    color: var(--text-faint);
    line-height: 1.7;
    font-style: italic;
}

.site-footer__bottom {
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--text-faint);
    letter-spacing: 0.06em;
}

.site-footer__bottom .gold-dot {
    width: 3px;
    height: 3px;
    border-radius: 999px;
    background: var(--gold);
    display: inline-block;
    margin: 0 var(--space-3);
    vertical-align: middle;
}


/* ─── 6. Legal document layout ─────────────────────────────────── */
.legal-shell {
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: var(--space-5) var(--gutter) var(--space-7);
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
}

.legal-doc-header {
    border-bottom: 1px solid var(--line);
    padding-bottom: var(--space-6);
    margin-bottom: var(--space-6);
}

.legal-doc-header__eyebrow {
    font-family: var(--f-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold);
    margin: 0 0 var(--space-3) 0;
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
}

.legal-doc-header__eyebrow .doc-num {
    color: var(--gold);
    padding-right: var(--space-4);
    border-right: 1px solid var(--gold-soft);
}

.legal-doc-header h1 {
    margin-bottom: var(--space-5);
    max-width: 18ch;
}

.legal-doc-header h1 em {
    font-style: italic;
    color: var(--gold);
    font-weight: 300;
}

.legal-doc-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, max-content));
    gap: var(--space-5);
    margin: 0;
    padding-top: var(--space-4);
    border-top: 1px solid var(--line);
}

.legal-doc-meta dt {
    font-family: var(--f-mono);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 10px;
    color: var(--text-faint);
    margin-bottom: var(--space-2);
}

.legal-doc-meta dd {
    margin: 0;
    color: var(--bone);
    font-family: var(--f-mono);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.legal-doc-meta dd a {
    color: var(--bone);
    text-decoration-color: var(--gold);
}


/* TOC */
.legal-toc {
    background: var(--ink-2);
    border: 1px solid var(--line);
    padding: var(--space-4) var(--space-5);

    /* Custom scrollbar (Firefox) — only takes effect when overflow appears */
    scrollbar-width: thin;
    scrollbar-color: var(--line-2) transparent;
}

/* Custom scrollbar (WebKit / Blink) */
.legal-toc::-webkit-scrollbar {
    width: 6px;
}

.legal-toc::-webkit-scrollbar-track {
    background: transparent;
}

.legal-toc::-webkit-scrollbar-thumb {
    background: var(--line-2);
    border-radius: 3px;
    transition: background 200ms var(--ease);
}

.legal-toc::-webkit-scrollbar-thumb:hover {
    background: var(--gold-soft);
}

.legal-toc:hover {
    scrollbar-color: var(--gold-soft) transparent;
}

.legal-toc summary {
    cursor: pointer;
    font-family: var(--f-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) 0;
}

.legal-toc summary::-webkit-details-marker { display: none; }

.legal-toc summary::after {
    content: '+';
    font-family: var(--f-display);
    font-size: 18px;
    color: var(--gold);
    transition: transform 200ms var(--ease);
}

.legal-toc[open] summary::after { content: '−'; }

.legal-toc-list {
    list-style: none;
    padding: 0;
    margin: var(--space-4) 0 0 0;
}

.legal-toc-list li {
    margin: 0;
    border-top: 1px solid var(--line);
}

.legal-toc-list li a {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-dim);
    text-decoration: none;
    transition: color 200ms var(--ease);
}

.legal-toc-list li a:hover { color: var(--bone); }

.legal-toc-list .toc-num {
    font-family: var(--f-mono);
    font-size: 10.5px;
    color: var(--gold);
    min-width: 28px;
    flex-shrink: 0;
    padding-top: 3px;
    letter-spacing: 0.06em;
}


/* Content column */
.legal-content { max-width: var(--content-max); }

.legal-section { scroll-margin-top: 84px; }

.legal-section h2 .section-num {
    font-family: var(--f-mono);
    color: var(--gold);
    font-size: 0.5em;
    margin-right: var(--space-4);
    letter-spacing: 0.06em;
    vertical-align: 0.4em;
    font-weight: 500;
}

.legal-section:target h2 { color: var(--gold); }


/* ─── 7. Section variants ──────────────────────────────────────── */

/* Legal Hub landing page — single-column layout, card grid */
.legal-hub {
    grid-template-columns: 1fr !important;
    max-width: 880px;
}

.legal-hub__header {
    border-bottom: 1px solid var(--line);
    padding-bottom: var(--space-6);
    margin-bottom: var(--space-7);
}

.legal-hub__lede {
    font-size: 18.5px;
    line-height: 1.55;
    color: var(--text-dim);
    max-width: 60ch;
    margin: var(--space-4) 0 0 0;
}

.legal-hub__group {
    margin-bottom: var(--space-7);
}

.legal-hub__group-header {
    margin-bottom: var(--space-5);
}

.legal-hub__group-eyebrow {
    font-family: var(--f-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold);
    margin: 0 0 var(--space-2) 0;
}

.legal-hub__group-meta {
    font-size: 14px;
    color: var(--text-faint);
    margin: 0;
}

.legal-hub__cards {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}

.legal-hub__card {
    background: var(--ink-2);
    border: 1px solid var(--line);
    padding: var(--space-5) var(--space-6);
    margin: 0;
    display: flex;
    flex-direction: column;
    transition: border-color 200ms var(--ease), background 200ms var(--ease);
}

.legal-hub__card:hover {
    border-color: var(--gold-soft);
}

.legal-hub__card-num {
    font-family: var(--f-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.16em;
    color: var(--gold);
    margin: 0 0 var(--space-2) 0;
}

.legal-hub__card h3 {
    font-family: var(--f-display);
    font-size: 22px;
    font-weight: 400;
    line-height: 1.25;
    margin: 0 0 var(--space-3) 0;
    letter-spacing: -0.01em;
}

.legal-hub__card h3 a {
    color: var(--bone);
    text-decoration: none;
}

.legal-hub__card h3 a:hover {
    color: var(--gold);
}

.legal-hub__card p {
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--text-dim);
    margin: 0 0 var(--space-3) 0;
}

.legal-hub__card-meta {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    margin: var(--space-2) 0 var(--space-4) 0 !important;
}

.legal-hub__card-meta-sep {
    margin: 0 var(--space-2);
    color: var(--gold);
}

.legal-hub__card-link {
    margin-top: auto;
    color: var(--gold);
    text-decoration: none;
    font-family: var(--f-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding-top: var(--space-3);
    border-top: 1px solid var(--line);
}

.legal-hub__card-link:hover {
    color: var(--gold);
    text-decoration: underline;
    text-decoration-color: var(--gold);
    text-underline-offset: 3px;
}

.legal-hub__card-link span {
    display: inline-block;
    transition: transform 200ms var(--spring);
    margin-left: var(--space-2);
}

.legal-hub__card:hover .legal-hub__card-link span {
    transform: translateX(3px);
}

.legal-hub__notice {
    background: var(--ink-2);
    border-left: 2px solid var(--gold-2);
    padding: var(--space-5) var(--space-6);
    margin-top: var(--space-7);
}

.legal-hub__notice-eyebrow {
    font-family: var(--f-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold-2);
    margin: 0 0 var(--space-3) 0;
}

.legal-hub__notice p:last-child {
    color: var(--text-dim);
    font-size: 14.5px;
    line-height: 1.65;
    margin: 0;
}

/* DRAFT banner — three independent safeguards stop accidental publication:
   1) NOINDEX meta tag + X-Robots-Tag in .htaccess
   2) .draft file extension denied by .htaccess
   3) This impossible-to-miss visual warning if the file is ever rendered
*/
.legal-draft-banner {
    background: rgba(255, 107, 74, 0.08);
    border: 1px solid var(--alert);
    border-left: 3px solid var(--alert);
    padding: var(--space-5) var(--space-6);
    margin: 0 0 var(--space-7) 0;
}

.legal-draft-banner__eyebrow {
    font-family: var(--f-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--alert);
    margin: 0 0 var(--space-3) 0;
}

.legal-draft-banner__reason {
    color: var(--bone);
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
}

/* Bracketed placeholders — visually obvious, never to be missed in any
   draft that reaches a human reader. Uses --alert (coral) so they stand
   out against both dark and light themes. */
.legal-placeholder {
    background: rgba(255, 107, 74, 0.14);
    color: var(--alert);
    font-family: var(--f-mono);
    font-size: 0.92em;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 2px;
    border: 1px solid rgba(255, 107, 74, 0.32);
    white-space: nowrap;
}

/* Entity Pack Part dividers (Part A · Entity Terms, Part B · Privacy Notice).
   Each part is a top-level section with its own eyebrow label and title.
   No background tint — preserves reading flow. Generous top spacing acts
   as the visual divider between Part A and Part B. */
.legal-part {
    margin-top: var(--space-8);
}

.legal-part:first-of-type {
    margin-top: var(--space-5);
}

.legal-part__eyebrow {
    font-family: var(--f-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gold);
    margin: 0 0 var(--space-3) 0;
    padding-top: var(--space-6);
    border-top: 1px solid var(--line);
}

.legal-part:first-of-type .legal-part__eyebrow {
    padding-top: 0;
    border-top: none;
}

.legal-part__title {
    font-family: var(--f-display);
    font-size: clamp(24px, 3vw, 34px);
    font-weight: 400;
    color: var(--bone);
    margin: 0 0 var(--space-6) 0;
    line-height: 1.2;
    letter-spacing: -0.015em;
    border-top: none !important;
    padding-top: 0 !important;
}

/* TOC group label for entity packs (Part A / Part B separator). */
.legal-toc-group {
    font-family: var(--f-mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold);
    margin: var(--space-5) 0 var(--space-3) 0;
    padding-top: var(--space-4);
    border-top: 1px solid var(--line);
}

.legal-toc-group:first-of-type {
    margin-top: var(--space-2);
    padding-top: 0;
    border-top: none;
}

/* Schedule blocks (appendices / annexes). Use a left border on gold-2
   (muted accent) so they read as adjacent reference material rather than
   compete with the body sections' gold accent. */
.legal-schedule {
    margin-top: var(--space-7);
    padding-top: var(--space-6);
    border-top: 1px solid var(--line);
}

.legal-schedule__eyebrow {
    font-family: var(--f-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold);
    margin: 0 0 var(--space-3) 0;
}

.legal-schedule h2 {
    font-size: clamp(20px, 2.4vw, 26px);
    margin-bottom: var(--space-5);
    color: var(--bone);
}

.legal-schedule__subsection {
    font-family: var(--f-display);
    font-size: 19px;
    font-weight: 500;
    color: var(--bone);
    margin: var(--space-6) 0 var(--space-3) 0;
    padding-top: var(--space-4);
    border-top: 1px solid var(--line);
    line-height: 1.3;
}

.legal-schedule__subsection:first-of-type {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.legal-schedule__subsection .schedule-subsection-num {
    color: var(--gold);
    font-family: var(--f-mono);
    font-size: 0.65em;
    margin-right: var(--space-3);
    letter-spacing: 0.06em;
    vertical-align: 0.2em;
    font-weight: 500;
}

/* Important Notice */
.legal-notice {
    background: var(--ink-2);
    border-left: 2px solid var(--gold);
    padding: var(--space-5) var(--space-6);
    margin: 0 0 var(--space-7) 0;
}

.legal-notice h2 {
    font-size: 13px;
    color: var(--gold);
    font-family: var(--f-mono);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin-bottom: var(--space-4);
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.legal-notice p {
    color: var(--bone-2);
    font-size: 15px;
    line-height: 1.7;
}

/* Clickwrap reference */
.legal-clickwrap-ref {
    background: var(--ink-2);
    border: 1px solid var(--line);
    border-left: 2px solid var(--signal);
    padding: var(--space-5) var(--space-6);
    margin-top: var(--space-7);
}

.legal-clickwrap-ref .clickwrap-eyebrow {
    font-family: var(--f-mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--signal);
    margin: 0 0 var(--space-3) 0;
}

.legal-clickwrap-ref h2 {
    font-size: 16px;
    color: var(--bone);
    font-family: var(--f-mono);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    border-top: none;
    margin-top: 0;
    padding-top: 0;
    margin-bottom: var(--space-3);
}

.legal-clickwrap-ref p {
    font-size: 14px;
    font-style: italic;
    color: var(--text-dim);
}


/* ─── 8. Print styles ──────────────────────────────────────────── */
@media print {
    :root {
        --ink:        #FFFFFF;
        --ink-2:      #FFFFFF;
        --ink-3:      #F4F1EA;
        --bone:       #0A0A0B;
        --bone-2:     #2A2A2D;
        --gold:       #8A6B23;
        --text-dim:   #1A1A1D;
        --text-faint: #4A4A4D;
        --line:       #CCCCCC;
        --gutter:     16mm;
    }

    body { background: white; font-size: 11pt; line-height: 1.5; }

    .grain::before,
    .skip-link,
    .site-header,
    .legal-breadcrumb,
    .legal-toc,
    .site-footer__links,
    .site-footer__bottom,
    .theme-toggle {
        display: none !important;
    }

    .legal-shell { padding: 0; gap: 0; display: block; }
    .legal-content { max-width: 100%; }

    .legal-section { page-break-inside: avoid; }
    .legal-section h2 { page-break-after: avoid; }

    a { color: black; text-decoration: none; }

    .legal-content a[href^="http"]::after,
    .legal-content a[href^="mailto"]::after {
        content: ' (' attr(href) ')';
        font-size: 0.85em;
        color: #555;
    }

    .legal-notice,
    .legal-clickwrap-ref {
        background: white;
        border: 1px solid #999;
    }

    .site-footer {
        margin-top: 10mm;
        padding: 6mm 0 0;
        border-top: 1px solid black;
        font-size: 9pt;
        color: black;
    }

    .site-footer__entities li { border-color: #ccc; }
    .site-footer__entities .entity-name,
    .site-footer__entities .entity-meta { color: black; }
    .site-footer h3 { color: black; }
}


/* ─── 9. Responsive ────────────────────────────────────────────── */
@media (max-width: 1023px) {
    /* Mobile: TOC sits sticky just under the header, collapsed by default.
       Tap the summary to expand. When expanded, it stays bounded by
       max-height so it never swallows the whole screen — content scrolls
       inside the panel. */
    .legal-toc-wrapper {
        position: sticky;
        top: 64px;
        z-index: 90;
        margin-bottom: var(--space-5);
    }

    .legal-toc {
        background: var(--ink-2);
    }

    .legal-toc[open] {
        max-height: calc(100vh - 84px);
        overflow-y: auto;
    }

    /* When TOC is sticky under the header, anchor targets need extra
       scroll-margin so they don't appear behind header + collapsed TOC. */
    .legal-section { scroll-margin-top: 128px; }
}

@media (min-width: 600px) {
    .site-footer__top { grid-template-columns: 1.6fr 1fr; }
    .legal-hub__cards { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
    .legal-shell {
        grid-template-columns: var(--toc-width) minmax(0, 1fr);
        gap: var(--space-7);
        align-items: start;
    }

    /* The sticky must live on the grid item (the wrapper), not on .legal-toc.
       .legal-toc is the same height as its content; if sticky lived there,
       the parent would also be that height and sticky would have no room. */
    .legal-toc-wrapper {
        position: sticky;
        top: calc(64px + var(--space-4));
        align-self: start;
    }

    .legal-toc {
        max-height: calc(100vh - 96px);
        overflow-y: auto;
    }

    .legal-toc summary { pointer-events: none; }
    .legal-toc summary::after { display: none; }
}

@media (max-width: 480px) {
    .wordmark__svg { width: 110px; }
}