/* ============================================================
   legal.css — privacy-policy.html and terms.html, one shared layout
   Loaded after home.css (hm-hero, hm-section) and section-index.css
   (the sticky chip index). Classes here are lg- and legal-only; every
   colour, size and space comes from variables.css. The pages are light
   (data-theme="light") and offer EN / ES / HI (data-langs on <html>).

   Page shape: hero (title + last updated) → sticky index of every
   section → intro → one .lg-section per heading, contact last.
   ============================================================ */

/* Reading column: capped for line length, but anchored to the container's left edge like the hero title
   and the first chip of the index (all three sit in a .container), not centred on its own. */
.lg-narrow {
    max-width: var(--legal-content-width);
}

/* Phones: less white space between the sticky index and the start of the text. */
@media (max-width: 767px) {
    .lg-page main > .hm-section {
        padding-top: var(--space-6);
    }
}

/* "Last updated" under the hero title */
.lg-updated {
    margin-top: var(--space-3);
    font-family: var(--font-sans);
    font-size: var(--text-body-size);
    line-height: var(--text-body-line);
    color: var(--home-hero-subtitle-ink);
}

.lg-intro {
    margin: 0 0 var(--space-8);
    font-family: var(--font-sans);
    font-size: var(--text-body-lg-size);
    line-height: var(--text-body-lg-line);
    color: var(--ink);
}

/* One block per heading; a rule between blocks keeps a long page scannable. */
.lg-section {
    padding-top: var(--space-6);
    margin-top: var(--space-6);
    border-top: 1px solid var(--border);
}

.lg-title {
    margin: 0 0 var(--space-3);
    font-family: var(--font-display);
    font-weight: var(--weight-bold);
    font-size: var(--text-display-sm-size);
    line-height: var(--text-display-sm-line);
    color: var(--ink);
    text-align: left;
}

/* The numbered Astros parts and the "Bad behavior includes…" lead-in */
.lg-subtitle {
    margin: var(--space-5) 0 var(--space-2);
    font-family: var(--font-sans);
    font-weight: var(--weight-semibold);
    font-size: var(--text-body-size);
    line-height: var(--text-body-line);
    color: var(--ink);
    text-align: left;
}

.lg-text {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--text-body-size);
    line-height: var(--text-body-line);
    color: var(--ink);
}

.lg-text + .lg-text {
    margin-top: var(--space-3);
}

.lg-text a,
.lg-text a:visited {
    color: var(--accent);
    text-decoration: underline;
}

/* ---- Back to top: appears once the hero is out of view (legal.js) ----
   Sticky, as the last thing in <main>: it rides at the bottom of the window while the text scrolls, and comes
   to rest --legal-top-rest above the footer instead of covering it. The margins take it out of the flow
   (negative top = its height + the rest gap), so the page is exactly as tall as without it.
   --lg-top-size is the visible circle (smaller on phones); ::before keeps the tap target at --legal-top-hit. */
.lg-top {
    --lg-top-size: var(--legal-top-size);
    position: sticky;
    bottom: var(--space-6);
    z-index: 90;  /* over the page and the sticky index (50), under the header's menus (999) */
    display: flex;
    margin: calc(-1 * (var(--lg-top-size) + var(--legal-top-rest))) var(--space-6) var(--legal-top-rest) auto;
    align-items: center;
    justify-content: center;
    width: var(--lg-top-size);
    height: var(--lg-top-size);
    padding: 0;
    border: 2px solid var(--accent);
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: var(--white);
    box-shadow: var(--shadow);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(var(--space-2));
    transition: opacity 0.3s, transform 0.3s, background-color 0.3s, color 0.3s, visibility 0s linear 0.3s;
}

.lg-top::before {
    content: "";
    position: absolute;
    inset: calc((var(--lg-top-size) - var(--legal-top-hit)) / 2 - 2px);  /* - 2px: insets start inside the border */
}

.lg-top--visible {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.3s, transform 0.3s, background-color 0.3s, color 0.3s;
}

/* style.css gives every button:focus / :active a #f9004d (red) border; this one stays blue. */
.lg-top:focus,
.lg-top:active {
    border-color: var(--accent);
}

.lg-top:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* Same hover as .hm-btn: the fill turns to the surface, the icon to the accent. */
@media (hover: hover) {
    .lg-top:hover {
        background: var(--surface);
        color: var(--accent);
    }
}

/* Phones: a smaller circle (same tap target), above the bottom tab bar. */
@media (max-width: 767px) {
    .lg-top {
        --lg-top-size: var(--legal-top-size-sm);
        margin-right: var(--space-5);
        bottom: calc(var(--header-tabbar-height) + env(safe-area-inset-bottom) + var(--space-4));
    }
}

/* style.css forces every <p> to 18px / 28px !important below 768px; keep these on the type scale. */
@media (max-width: 767px) {
    p.lg-text {
        font-size: var(--text-body-size) !important;
        line-height: var(--text-body-line) !important;
    }

    p.lg-intro {
        font-size: var(--text-body-lg-size) !important;
        line-height: var(--text-body-lg-line) !important;
    }
}

/* Hindi: Devanagari glyphs come from Noto Sans Devanagari (its Google Fonts CSS is unicode-range'd,
   so the font is only downloaded when Devanagari is on screen). Latin text keeps the usual faces. */
html:lang(hi) {
    --font-sans: "Noto Sans", "Noto Sans Devanagari", -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-display: "Bricolage Grotesque", "Noto Sans Devanagari", "Helvetica Neue", Arial, sans-serif;
}
