/* Shared styling for the public legal pages (privacy policy, delete account).

   Colours and body type are taken from cowsandfish.org so that someone arriving
   here from the app or a store listing recognises the brand:
     --green      #005d2f   their primary
     --blue       #084667   their secondary, used here for links
     --light-blue #548eaf
     body text    #333
     body font    Lato

   Their headings use "Founders" / "Founders-Bold", which are commercial fonts
   licensed to cowsandfish.org. We deliberately do not copy those font files, so
   headings fall back to Lato Bold. Lato is SIL OFL licensed and self-hosted in
   wwwroot/fonts so these pages make no third-party requests. */

@font-face {
    font-family: "Lato";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/lato-400.woff2") format("woff2");
}

@font-face {
    font-family: "Lato";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/lato-700.woff2") format("woff2");
}

.legal {
    --legal-ink: #333;
    --legal-muted: #626b73;
    --legal-primary: #005d2f;
    --legal-accent: #084667;
    --legal-rule: #e2e5e3;
    --legal-tint: #f4f7f4;

    font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    max-width: 46rem;
    margin: 0 auto 4rem;
    color: var(--legal-ink);
    font-size: 1.0625rem;
    line-height: 1.7;
}

.legal p,
.legal li {
    color: var(--legal-ink);
}

.legal a {
    color: var(--legal-accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
}

.legal a:hover,
.legal a:focus-visible {
    color: var(--legal-primary);
}

/* Header */

.legal-header {
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 3px solid var(--legal-primary);
}

.legal-logo {
    display: block;
    width: 200px;
    max-width: 60%;
    height: auto;
    margin-bottom: 1.5rem;
}

.legal-header h1 {
    margin: 0;
    color: var(--legal-primary);
    font-size: clamp(1.6rem, 4.5vw, 2.15rem);
    font-weight: 700;
    line-height: 1.2;
}

.legal-header .legal-subtitle {
    margin: 0.35rem 0 0;
    color: var(--legal-muted);
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    font-weight: 400;
}

.legal-updated {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: var(--legal-tint);
    color: var(--legal-muted);
    font-size: 0.8125rem;
    letter-spacing: 0.01em;
}

/* Section headings. scroll-margin keeps anchor jumps clear of the sticky-ish nav. */

.legal h2 {
    margin: 2.75rem 0 0.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--legal-rule);
    color: var(--legal-primary);
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.35;
    scroll-margin-top: 1.5rem;
}

.legal h2:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.legal h3 {
    margin: 1.75rem 0 0.5rem;
    font-size: 1.05rem;
    font-weight: 700;
}

.legal ul {
    padding-left: 1.25rem;
}

.legal li + li {
    margin-top: 0.35rem;
}

/* Table of contents */

.legal-toc {
    margin: 0 0 2.5rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--legal-rule);
    border-radius: 10px;
    background: var(--legal-tint);
}

.legal-toc h2 {
    margin: 0 0 0.6rem;
    padding: 0;
    border: 0;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--legal-muted);
}

.legal-toc ol {
    margin: 0;
    padding-left: 1.25rem;
    columns: 2;
    column-gap: 2rem;
}

.legal-toc li {
    margin: 0 0 0.3rem;
    break-inside: avoid;
}

@media (max-width: 34rem) {
    .legal-toc ol {
        columns: 1;
    }
}

/* The "how do I delete my account" callout. This is what most people and every
   app store reviewer arrive looking for, so it sits above the fold. */

.legal-callout {
    margin: 0 0 2.5rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--legal-rule);
    border-left: 4px solid var(--legal-accent);
    border-radius: 10px;
    background: #fff;
}

.legal-callout h2 {
    margin: 0 0 0.5rem;
    padding: 0;
    border: 0;
    font-size: 1.1rem;
}

.legal-callout p:last-child {
    margin-bottom: 0;
}

/* Written as `.legal a.legal-btn` on purpose: plain `.legal-btn` loses the
   specificity contest with `.legal a` above, which left white-on-green buttons
   rendering dark green text on a dark green background. */

.legal a.legal-btn {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.6rem 1.4rem;
    border-radius: 3rem;
    background: var(--legal-primary);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.legal a.legal-btn:hover,
.legal a.legal-btn:focus-visible {
    background: #004423;
    color: #fff;
    text-decoration: underline;
}

/* Emphasised section (account deletion), so it is obvious at a glance */

.legal-highlight {
    margin-top: 2.75rem;
    padding: 0.25rem 1.5rem 1.25rem;
    border: 1px solid var(--legal-rule);
    border-radius: 10px;
    background: var(--legal-tint);
    scroll-margin-top: 1.5rem;
}

.legal-highlight h2 {
    border-top: 0;
    padding-top: 1.25rem;
}

/* Card for the third-party retention list */

.legal-note {
    margin: 1.25rem 0;
    padding: 1rem 1.25rem;
    border: 1px solid var(--legal-rule);
    border-radius: 10px;
    background: #fff;
    font-size: 0.9375rem;
}

.legal-note ul {
    margin-bottom: 0;
}

.legal-footnote {
    margin-top: 3rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--legal-rule);
    color: var(--legal-muted);
    font-size: 0.9375rem;
}

/* Long URLs and emails should not blow out the layout on narrow screens */

.legal-url {
    word-break: break-word;
}

/* Legal documents get saved and printed */

@media print {
    .legal {
        max-width: none;
        font-size: 11pt;
    }

    header,
    footer,
    .legal-toc,
    .legal-btn {
        display: none !important;
    }

    .legal h2 {
        break-after: avoid;
    }

    .legal-callout,
    .legal-highlight,
    .legal-note {
        border: 1px solid #999;
        background: transparent;
    }

    .legal a::after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        color: #555;
    }

    .legal a[href^="#"]::after {
        content: "";
    }
}
