/*
 * Shared styles for the Junk Monkey public pages (GitHub Pages).
 *
 * Tokens mirror the app so the legal pages look like the product:
 *   src/theme/colors.ts  →  --primary / --dark-text / --light-cyan / --gold
 * --gray-text deliberately diverges from colors.ts on accessibility grounds;
 * see the note on it below before "fixing" the mismatch.
 *
 * Deliberately dependency-free: no build step, no CDN font, no JS. These pages
 * must render even if a reviewer opens them on a bad hotel connection.
 */

:root {
    /*
     * --primary is a FILL colour. It must never be used as a text colour: at
     * 2.14:1 on white it fails the 4.5:1 AA floor for normal text, the 3:1 floor
     * for large text, and the 3:1 floor for meaningful icons and focus rings.
     * Use --link for anything a reader has to read.
     */
    --primary: #57c0cb;
    --primary-dark: #45aab5; /* hover fill only — also too light for text */

    /*
     * --link is the brand cyan walked down in lightness until it clears 4.5:1 on
     * every background these pages use. Same hue (185.7deg) and saturation, so it
     * still reads as the brand colour:
     *   on #ffffff  5.42:1     on #f5f5f7  4.98:1
     *   on #d4f1f4  4.57:1  ←  binding case (header gradient)
     *   on #fff9ee  5.18:1
     * Do not lighten it. #1f7d88 looks close enough but fails on #f5f5f7 (4.44)
     * and #d4f1f4 (4.07) — the same trap that caught #6e6e73 for --gray-text.
     */
    --link: #26747c;
    --link-hover: #186c76;

    /*
     * Label colour for text sitting ON a --primary or --gold fill. Currently the
     * same hex as --dark-text, and kept as a separate token on purpose: if the
     * brand fill is ever darkened, this flips to #ffffff in one place instead of
     * being hunted down at every button.
     *   #1d1d1f on #57c0cb  7.86:1     #1d1d1f on #f5a623  8.30:1
     * (white on those fills is 2.14:1 and 2.03:1 — both fail.)
     */
    --on-primary: #1d1d1f;

    --dark-text: #1d1d1f;
    /*
     * Intentionally NOT colors.ts's grayText (#86868b). That value is only
     * 3.6:1 on white and 3.3:1 on --surface, so every use of it here — the
     * nav, the "last updated" line, table captions and the whole footer — was
     * below the 4.5:1 WCAG AA floor for normal-size text.
     *
     * #636366 is the lightest grey that clears 4.5:1 on all four backgrounds
     * these pages actually use:
     *   on #ffffff (body)          5.99:1
     *   on #f5f5f7 (footer)        5.50:1
     *   on #d4f1f4 (header top)    5.04:1   ← the binding constraint
     *   on #fff9ee (warn callout)  5.71:1
     * #6e6e73 was the first candidate and fails the header case at 4.27:1,
     * which is easy to miss because the nav sits partway down the gradient
     * where the background is already close to white.
     */
    --gray-text: #636366;
    --light-cyan: #d4f1f4;
    --gold: #f5a623;
    --surface: #f5f5f7;
    --hairline: rgba(210, 210, 215, 0.6);

    --measure: 44rem;
    --font:
        -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.65;
    color: var(--dark-text);
    background: #ffffff;
}

/* ---------- Header ---------- */

.site-header {
    background: linear-gradient(180deg, var(--light-cyan) 0%, #ffffff 100%);
    border-bottom: 1px solid var(--hairline);
}

.site-header .inner,
main,
.site-footer .inner {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 20px;
}

.site-header .inner {
    padding-top: 28px;
    padding-bottom: 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.4px;
    color: var(--dark-text);
    text-decoration: none;
}

.brand img {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: block;
}

nav.site-nav {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    font-size: 15px;
    font-weight: 500;
}

nav.site-nav a {
    color: var(--gray-text);
    text-decoration: none;
}

nav.site-nav a:hover,
nav.site-nav a:focus-visible {
    color: var(--link);
    text-decoration: underline;
}

nav.site-nav a[aria-current='page'] {
    /* 4.57:1 against the #d4f1f4 top of the header gradient — the binding case
       on this page. --primary was 1.80:1 here. */
    color: var(--link);
    font-weight: 600;
}

/* ---------- Content ---------- */

main {
    padding-top: 40px;
    padding-bottom: 64px;
}

h1 {
    font-size: 34px;
    line-height: 1.2;
    letter-spacing: -0.8px;
    margin: 0 0 8px;
}

h2 {
    font-size: 22px;
    line-height: 1.3;
    letter-spacing: -0.4px;
    margin: 40px 0 10px;
    padding-top: 4px;
}

h3 {
    font-size: 17px;
    margin: 24px 0 6px;
}

p,
ul,
ol,
table {
    margin: 0 0 16px;
}

ul,
ol {
    padding-left: 22px;
}

li {
    margin-bottom: 6px;
}

a {
    color: var(--link);
}

/*
 * :not(.button) matters. Without it this rule also repaints the filled contact
 * button's label on hover, turning dark-teal-on-cyan (2.23:1) — a regression the
 * contrast audit caught immediately. Filled buttons keep --on-primary in every
 * state; only inline links darken.
 */
a:not(.button):hover,
a:not(.button):focus-visible {
    color: var(--link-hover);
}

.updated {
    color: var(--gray-text);
    font-size: 15px;
    margin-bottom: 28px;
}

.lede {
    font-size: 19px;
    color: var(--dark-text);
}

/* Summary / callout box */
.callout {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-left: 4px solid var(--primary);
    border-radius: 14px;
    padding: 18px 20px;
    margin: 0 0 28px;
}

.callout h2,
.callout h3 {
    margin-top: 0;
}

.callout.warn {
    border-left-color: var(--gold);
    background: #fff9ee;
}

.callout :last-child {
    margin-bottom: 0;
}

/* Tables (sub-processors, data types) */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

caption {
    text-align: left;
    color: var(--gray-text);
    font-size: 14px;
    padding-bottom: 8px;
}

th,
td {
    text-align: left;
    vertical-align: top;
    padding: 10px 12px;
    border-bottom: 1px solid var(--hairline);
}

th {
    font-weight: 600;
    background: var(--surface);
}

/* FAQ */
details {
    border: 1px solid var(--hairline);
    border-radius: 14px;
    padding: 14px 18px;
    margin-bottom: 10px;
    background: #ffffff;
}

details[open] {
    background: var(--surface);
}

summary {
    cursor: pointer;
    font-weight: 600;
}

summary::marker {
    /* The disclosure triangle is the affordance telling you the row opens, so
       it is a meaningful non-text element at the 3:1 floor. */
    color: var(--link);
}

details > :last-child {
    margin-bottom: 0;
}

details p {
    margin-top: 10px;
}

/* Contact button */
.button {
    display: inline-block;
    background: var(--primary);
    /* Dark ink on cyan is 7.86:1; the white label it replaces was 2.14:1. */
    color: var(--on-primary);
    font-weight: 600;
    text-decoration: none;
    padding: 13px 22px;
    border-radius: 14px;
}

.button:hover,
.button:focus-visible {
    background: var(--primary-dark);
}

/* Unresolved values the owner must replace before submitting. */
.todo {
    background: #fff2c9;
    border-bottom: 2px solid var(--gold);
    padding: 0 4px;
    font-weight: 600;
}

/* ---------- Footer ---------- */

.site-footer {
    border-top: 1px solid var(--hairline);
    background: var(--surface);
    padding: 28px 0;
    font-size: 15px;
    color: var(--gray-text);
}

.site-footer a {
    color: var(--gray-text);
}

.site-footer .inner > :last-child {
    margin-bottom: 0;
}

@media (max-width: 480px) {
    body {
        font-size: 16px;
    }

    h1 {
        font-size: 28px;
    }
}
