/* =============================================================================
   Policy documents (/terms, /privacy) — Pages/Shared/_PolicyPage.cshtml.
   Builds on home.css + interior.css: the same masthead, page header, tokens and
   footer as About/Contact, with a calmer reading layout for long legal text.
   The document body is HTML from API2's policies endpoint:
     .policy-header > p                      opening paragraphs
     .policy-section > h2 + .policy-body > p  numbered sections
   ============================================================================= */

/* A text page: no hero artwork, so the header is shorter and single-column. */
.ihero--compact {
    min-height: 0;
    grid-template-columns: 1fr;
    padding-bottom: clamp(36px, 6vh, 64px);
}
.ihero--compact .ihero__content { max-width: 33.98em; }
.ihero--compact .ihero__heading { font-size: clamp(2.2rem, 5vw, 3.6rem); }

.policy-meta {
    margin-top: var(--space-lede);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-5);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bone-dim);
}

/* ---------- Layout: contents rail + document ---------- */
.policy { padding-top: clamp(40px, 6vh, 72px); }

.policy__layout {
    display: grid;
    grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
    gap: clamp(32px, 6vw, 96px);
    align-items: start;
}

.policy__toc {
    position: sticky;
    top: 110px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    padding-right: var(--space-2);
}
.policy__toc details > summary { list-style: none; cursor: default; }
.policy__toc details > summary::-webkit-details-marker { display: none; }
.policy__toc-title {
    font-size: var(--text-2xs);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--bone-dim);
    margin-bottom: var(--space-4);
}
.policy__toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.policy__toc li a {
    display: block;
    padding: 6px 0 6px var(--space-4);
    margin-left: -1px;
    border-left: 1px solid transparent;
    font-size: var(--text-base);
    line-height: 1.4;
    color: var(--bone-dim);
    overflow-wrap: anywhere;
    transition: color 0.2s, border-color 0.2s;
}
.policy__toc li a:hover,
.policy__toc li a:focus-visible { color: var(--bone); border-left-color: var(--signal-2); }

/* ---------- The document ---------- */
.policy__doc {
    max-width: 34.93em;
    font-family: var(--font-body);
    font-size: 1.02rem;
    line-height: 1.75;
    color: var(--bone-dim);
    overflow-wrap: anywhere; /* long URLs and emails wrap instead of being clipped */
}
.policy__doc p { margin: 0 0 1em; }
.policy__doc a { color: var(--signal-2); text-decoration: underline; text-underline-offset: 3px; }
.policy__doc a:hover { color: var(--bone); }
.policy__doc strong { color: var(--bone); font-weight: 600; }
.policy__doc ul, .policy__doc ol { margin: 0 0 1em 1.25em; }

.policy__doc .policy-header {
    padding-bottom: var(--space-7);
    margin-bottom: var(--space-7);
    border-bottom: 1px solid var(--line);
    font-size: 1.12rem;
    color: var(--bone-2);
}

.policy__doc .policy-section { margin-bottom: var(--space-8); }
.policy__doc .policy-section > h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    line-height: 1.25;
    color: var(--bone);
    margin: 0 0 var(--space-4);
}
/* Clear the fixed masthead when a heading is jumped to from the contents. */
.policy__doc h2[id] { scroll-margin-top: 110px; }
.policy__doc .policy-subsection { margin: var(--space-4) 0 var(--space-4) var(--space-5); }
.policy__doc .policy-subsection > h3 {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--bone);
    margin: 0 0 var(--space-2);
}

.policy__unavailable { max-width: 30.21em; }
.policy__unavailable a { color: var(--signal-2); text-decoration: underline; }

/* ---------- Narrow screens: contents become a collapsible block above the text ---------- */
@media (max-width: 900px) {
    .policy__layout { grid-template-columns: minmax(0, 1fr); }
    .policy__toc {
        position: static;
        max-height: none;
        padding: var(--space-4) var(--space-5);
        border: 1px solid var(--line);
        background: rgba(30, 33, 113, 0.35);
    }
    .policy__toc details > summary { cursor: pointer; margin-bottom: 0; }
    .policy__toc details[open] > summary { margin-bottom: var(--space-4); }
    .policy__toc details > summary::after { content: " +"; }
    .policy__toc details[open] > summary::after { content: " –"; }
}
