/* ==========================================================================
   Legal documents - /legal/*
   Loaded only on the Terms of Service, Privacy Policy and Disclaimer pages,
   so the landing page never downloads this file. Colour, type and layout
   tokens are inherited from style.css / result-ui.css.
   ========================================================================== */

/* Smooth anchor scrolling for the table of contents (browser history, hash
   updates and the back/forward buttons stay native). */
html { scroll-behavior: smooth; }

/* Content column: 1000px max, 12px gutters on phones (no page overflow). */
.section--notice .container,
.section--legal .container {
    width: calc(100% - 24px);
    max-width: 1000px;
}

.section--legal { margin-bottom: 16px; }

.crumbs { margin-bottom: 8px; }

/* ==========================================================================
   Top information card - brand, page title, effective / updated dates
   ========================================================================== */

.legal-hero {
    background: var(--paper);
    border: 1px solid var(--line);
    border-top: 4px solid var(--accent);
    border-radius: 8px;
    padding: 16px 14px;
    margin-bottom: 12px;
    text-align: center;
}

.legal-hero__brand {
    font-size: var(--font-size-xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-wider);
    text-transform: uppercase;
    color: var(--ink-mute);
    line-height: var(--line-normal);
}

.legal-hero__title {
    margin-top: 6px;
    font-size: clamp(1.5rem, 1.1vw + 1.2rem, 2.125rem);   /* 24 -> 34 */
    line-height: 1.2;
}

.legal-hero__subtitle {
    margin-top: 6px;
    font-size: var(--font-size-sm-plus);
    color: var(--ink-soft);
    line-height: var(--line-relaxed);
}

.legal-hero__meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px 18px;
    margin: 14px 0 0;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
}

.legal-hero__pair {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.legal-hero__pair dt {
    font-size: var(--font-size-xs);
    font-weight: var(--weight-bold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--ink-mute);
    line-height: var(--line-normal);
}

.legal-hero__pair dd {
    margin: 0;
    font-size: var(--font-size-sm);
    font-weight: var(--weight-semibold);
    color: var(--ink);
    line-height: var(--line-normal);
}

/* ==========================================================================
   "On This Page" table of contents
   ========================================================================== */

.legal-toc {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 12px;
    margin-bottom: 12px;
    scroll-margin-top: 14px;
}

.legal-toc__title {
    font-size: var(--font-size-md);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--ink-soft);
    line-height: var(--line-normal);
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--line-soft);
}

.legal-toc__list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.legal-toc__list a {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 6px 8px;
    background: var(--ground);
    border: 1px solid var(--line-soft);
    border-radius: 6px;
    color: var(--ink);
    font-size: var(--font-size-sm);
    font-weight: var(--weight-semibold);
    line-height: var(--line-normal);
    text-decoration: none;
}

.legal-toc__list a:hover {
    background: var(--next-bg);
    border-color: var(--next);
    text-decoration: none;
}

.legal-toc__list a.is-current {
    background: var(--next-bg);
    border-color: var(--next);
    color: var(--next);
}

.legal-toc__num {
    flex: 0 0 auto;
    min-width: 26px;
    padding: 2px 5px;
    border-radius: 4px;
    background: var(--brand);
    color: var(--accent);
    font-size: var(--font-size-xs);
    font-weight: var(--weight-bold);
    font-variant-numeric: tabular-nums;
    text-align: center;
    line-height: 1.4;
}

.legal-toc__label { min-width: 0; }

/* ==========================================================================
   Legal content card
   ========================================================================== */

.legal-doc {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 2px 14px;
}

.legal-block {
    padding: 16px 0;
    border-top: 1px solid var(--line-soft);
    scroll-margin-top: 14px;
}

.legal-block:first-child { border-top: 0; }

.legal-block__title {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: clamp(1.1875rem, 0.7vw + 1rem, 1.5625rem);   /* 19 -> 25 */
    line-height: 1.32;
    color: var(--ink);
    margin-bottom: 8px;
}

.legal-block__num {
    flex: 0 0 auto;
    margin-top: 3px;
    padding: 2px 7px;
    border-radius: 5px;
    background: var(--brand);
    color: var(--accent);
    font-size: var(--font-size-th);
    font-weight: var(--weight-bold);
    font-variant-numeric: tabular-nums;
    line-height: 1.4;
}

.legal-block__text { min-width: 0; }

.legal-block__body {
    font-size: var(--font-size-md);      /* 16 desktop */
    line-height: 1.78;
    color: var(--ink-soft);
    letter-spacing: var(--tracking-normal);
}

.legal-block__body p { margin: 0 0 10px; }
.legal-block__body p:last-child { margin-bottom: 0; }

.legal-block__body ul {
    list-style: disc;
    padding-left: 1.35rem;
    margin: 0 0 10px;
}
.legal-block__body li {
    margin-bottom: 5px;
    line-height: 1.7;
}
.legal-block__body li:last-child { margin-bottom: 0; }
.legal-block__body ul::marker { color: var(--next); }

.legal-block__body a {
    color: var(--next);
    font-weight: var(--weight-semibold);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.legal-block__body a:hover { color: var(--brand); }

.legal-block__body strong,
.legal-block__body b {
    color: var(--ink);
    font-weight: var(--weight-bold);
}

/* ==========================================================================
   Related pages row
   ========================================================================== */

.legal-related {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.legal-related a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 7px 14px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--next);
    font-size: var(--font-size-sm);
    font-weight: var(--weight-semibold);
    line-height: var(--line-normal);
    text-decoration: none;
}

.legal-related a:hover {
    background: var(--next-bg);
    border-color: var(--next);
    text-decoration: none;
}

.legal-related a[aria-current="page"] {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--accent);
}

/* ==========================================================================
   Floating controls on a legal document
   - the auto refresh control is meaningless here, the up button only appears
     once the reader has scrolled (legal.js). Without JS the noscript rule in
     legal-body.php keeps it visible and usable.
   ========================================================================== */

.float-btn--refresh { display: none; }

.float-btn--top {
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
}

.float-btn--top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
}

/* ==========================================================================
   Responsive steps
   ========================================================================== */

@media (min-width: 600px) {
    .legal-hero { padding: 20px 22px; }
    .legal-hero__subtitle { font-size: var(--font-size-md); }

    .legal-toc { padding: 16px 18px; }
    .legal-toc__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .legal-toc__list a { font-size: var(--font-size-sm-plus); }

    .legal-doc { padding: 4px 22px; }
    .legal-block { padding: 18px 0; }
}

@media (min-width: 960px) {
    .legal-toc__list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 599px) {
    .legal-hero { padding: 14px 12px; }
    .legal-hero__meta { gap: 4px 14px; }

    .legal-toc { padding: 12px 10px; }

    .legal-doc { padding: 2px 12px; }
    .legal-block { padding: 14px 0; }
    .legal-block__body {
        font-size: var(--font-size-sm-plus);   /* 15 */
        line-height: 1.75;
    }
    .legal-block__title { gap: 7px; }
}

@media (max-width: 359px) {
    .legal-hero__pair { flex-direction: column; gap: 0; align-items: center; }
    .legal-toc__list a { font-size: var(--font-size-th); }
}

/* Respect reduced motion for the smooth anchor scrolling too. */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .float-btn--top { transition: none; }
}

/* Print: the document itself, nothing else. */
@media print {
    .legal-toc, .legal-related, .crumbs, .top-alert { display: none; }
    .legal-hero, .legal-doc { border: 0; padding-left: 0; padding-right: 0; }
    .legal-block { break-inside: avoid-page; }
}
