/* ==========================================================================
   HackTrent — design system
   Body type: Atkinson Hyperlegible (Braille Institute, low-vision optimized)
   Display:   Fraunces, only at large sizes
   Themes:    light / dark, follows system, overridable by the header switch
   Contrast:  every text pair meets WCAG AA; body text exceeds AAA (7:1)
   ========================================================================== */

/* ---------- Tokens: light ---------- */
:root {
    --bg: #faf8fd;
    --surface: #ffffff;
    --surface-2: #f1ecf9;
    --ink: #221b2e;            /* 15.4:1 on bg */
    --ink-soft: #4d4360;       /* 8.1:1 on bg */
    --heading: #3b1f66;        /* 12.6:1 on bg */
    --brand: #5a2ca0;
    --brand-deep: #2c1452;     /* header, hero, footer */
    --accent: #ffc83d;         /* focus ring, highlights */
    --accent-ink: #221b2e;     /* text on accent, 12.1:1 */
    --edge: #221b2e;           /* offset shadows and chip borders */
    --link: #4a21a3;           /* 9.4:1 on bg */
    --link-visited: #64399a;
    --line: #cbbde3;
    --line-strong: #3b1f66;
    --error: #9e2019;          /* 7.6:1 on white (AAA) */
    --success: #1b5e20;        /* 7.9:1 on white */
    --plate-shadow: 6px 6px 0 var(--line);
    --radius: 12px;
    color-scheme: light;
}

/* ---------- Tokens: dark ---------- */
:root[data-theme="dark"] {
    --bg: #15101d;
    --surface: #211a2d;
    --surface-2: #1b1526;
    --ink: #ece6f4;            /* 14.6:1 */
    --ink-soft: #b7abc9;       /* 7.6:1 */
    --heading: #d6c6f5;        /* 11.4:1 */
    --brand: #8a63cf;
    --brand-deep: #0f0a17;
    --link: #c7b3ff;           /* 9.6:1 */
    --link-visited: #ddc9f5;
    --line: #3c3150;
    --line-strong: #a98bdf;
    --error: #ffb3ab;          /* 9.2:1 on surface */
    --success: #9ae6a0;
    --line: #4a3e62;
    --plate-shadow: 6px 6px 0 var(--line-strong);
    --edge: var(--line-strong);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #15101d;
        --surface: #211a2d;
        --surface-2: #1b1526;
        --ink: #ece6f4;
        --ink-soft: #b7abc9;
        --heading: #d6c6f5;
        --brand: #8a63cf;
        --brand-deep: #0f0a17;
        --link: #c7b3ff;
        --link-visited: #ddc9f5;
        --line: #3c3150;
        --line-strong: #a98bdf;
        --error: #ffb3ab;
        --success: #9ae6a0;
        --line: #4a3e62;
        --plate-shadow: 6px 6px 0 var(--line-strong);
        --edge: var(--line-strong);
        color-scheme: dark;
    }
}

/* ---------- Base ---------- */
html {
    font-size: 100%;
    /* Keeps focused/anchored content clear of the sticky header (WCAG 2.4.11) */
    scroll-padding-top: 6rem;
}

@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }

    /* Only geometry animates. Colours switch instantly so a theme change can
       never leave an element mid-transition with mismatched colours. */
    a, button, summary, .plate, .switch-thumb {
        transition: box-shadow 150ms ease, transform 150ms ease, left 150ms ease;
    }
}

body {
    margin: 0;
    font-family: "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 1.125rem;
    line-height: 1.65;
    color: var(--ink);
    background-color: var(--bg);
}

h1, h2, .site-name, .fact dd {
    font-family: "Fraunces", Georgia, serif;
}

strong { font-weight: 700; }

.icon-defs { display: none; }

.icon {
    width: 1.25em;
    height: 1.25em;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -0.2em;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Programmatic focus targets: no ring needed, they are not interactive */
main:focus, h1:focus, h2:focus, h3:focus, .search-results-title:focus,
.form-error-summary:focus { outline: none; }

.form-error-summary:focus { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Focus: double ring visible on any background ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible,
.table-wrap:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    box-shadow: 0 0 0 6px var(--brand-deep);
}

/* Target size: 44px minimum for every control */
button, .site-nav a, .button, summary, .choice input {
    min-height: 44px;
}

/* ---------- Links ---------- */
main a, .foot a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
}

main a:visited { color: var(--link-visited); }
main a:hover, .foot a:hover { text-decoration-thickness: 3px; }

/* ---------- Skip link ---------- */
.skip-link {
    position: absolute;
    left: 1rem;
    top: -10rem;
    z-index: 100;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 700;
    padding: 0.8em 1.4em;
    border: 3px solid var(--accent-ink);
    border-radius: 8px;
    text-decoration: none;
}

.skip-link:focus { top: 1rem; }

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--brand-deep);
    border-bottom: 3px solid var(--accent);
    color: #ffffff;
}

.header-inner {
    max-width: 76rem;
    margin: 0 auto;
    padding: 0.7rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.branding {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    padding: 0.2rem;
}

.logo {
    width: 2.6rem;
    height: 2.6rem;
}

.logo-hex {
    fill: var(--accent);
}

.logo-mark {
    fill: none;
    stroke: #2c1452;
    stroke-width: 3.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }

.site-name {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.tagline {
    font-size: 0.95rem;
    font-style: italic;
    color: #d8cbee;            /* 11:1 on brand-deep */
}

/* ---------- Navigation: boxed tiles ---------- */
.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.site-nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 1rem;
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
}

.site-nav a:hover {
    border-color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* Current section: filled, offset shadow and a ribbon — not color alone */
.site-nav a[aria-current] {
    background: rgba(0, 0, 0, 0.35);
    border-color: var(--accent);
    box-shadow: 4px 4px 0 var(--accent);
}

.site-nav a[aria-current]::before {
    content: "";
    position: absolute;
    top: -2px;
    left: 50%;
    width: 1.4rem;
    height: 0.45rem;
    transform: translateX(-50%);
    background: var(--accent);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 55%, 0 100%);
}

/* ---------- Header tools ---------- */
.header-tools {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.search { display: flex; }

.search input {
    width: 11rem;
    min-height: 44px;
    padding: 0.4rem 0.9rem;
    font: inherit;
    font-size: 1rem;
    color: #221b2e;
    background: #ffffff;
    border: 2px solid #ffffff;
    border-radius: 8px 0 0 8px;
}

.search input::placeholder { color: #5f5570; }   /* 6.6:1 */

.header-tools button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-width: 44px;
    padding: 0.3rem 0.7rem;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-radius: 8px;
    cursor: pointer;
}

.header-tools button[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
}

.header-tools button:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: #ffffff;
}

.search .icon-button {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: var(--accent);
    border-radius: 0 8px 8px 0;
}

.search .icon-button:hover { background: #ffd666; border-color: #ffd666; }

.text-size { display: flex; gap: 0.3rem; }

/* ---------- Theme switch ---------- */
.theme-switch .switch-track {
    position: relative;
    width: 2.6rem;
    height: 1.4rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid #ffffff;
}

.theme-switch .switch-thumb {
    position: absolute;
    top: 50%;
    left: 0.15rem;
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    background: #ffffff;
    transform: translate(0, -50%);
}

/* State keyed off the root attribute set before first paint, so markup and
   visual agree even before script.js runs. The moon stays in both states;
   the track carries on/off. */
:root[data-dark="true"] .switch-track { background: var(--accent); border-color: var(--accent); }
:root[data-dark="true"] .switch-thumb { transform: translate(1.15rem, -50%); background: #2c1452; }
.theme-switch .icon-sun { display: none; }

/* ---------- Search results panel ---------- */
.search-results {
    background: var(--surface);
    color: var(--ink);
    border-top: 1px solid var(--line);
    box-shadow: 0 6px 0 var(--line-strong);
}

.search-results-inner {
    max-width: 76rem;
    margin: 0 auto;
    padding: 1.2rem 1.25rem 1.4rem;
}

.search-results-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--heading);
}

.search-results ul { margin: 0.6rem 0 1rem; padding-left: 1.3rem; }
.search-results li { margin: 0.3rem 0; }
.search-results a { color: var(--link); font-weight: 700; text-underline-offset: 3px; }

.text-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    font: inherit;
    font-weight: 700;
    color: var(--ink);
    background: var(--surface-2);
    border: 2px solid var(--line-strong);
    border-radius: 8px;
    cursor: pointer;
}

/* ---------- Eyebrow labels (small caps) ---------- */
.eyebrow {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 0.6rem;
}

.eyebrow-light { color: #ffe199; }      /* 12:1 on hero */

/* ---------- Hero ---------- */
.hero {
    position: relative;
    color: #ffffff;
    padding: 4.5rem 1.25rem 6rem;
    background:
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.09) 1px, transparent 0) 0 0 / 26px 26px,
        linear-gradient(140deg, #2c1452 0%, #3b1f66 50%, #5a2ca0 100%);
}

.hero-inner {
    max-width: 76rem;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 3.5rem;
    align-items: center;
}

.hero h1 {
    font-size: clamp(2.6rem, 6vw, 4.6rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.015em;
    margin-bottom: 1.2rem;
}

.hero-accent {
    font-family: "Fraunces", Georgia, serif;
    font-style: italic;
    font-weight: 600;
    color: var(--accent);
    text-decoration: underline wavy var(--accent);
    text-decoration-thickness: 0.06em;
    text-underline-offset: 0.14em;
}

.hero-lead {
    font-size: 1.25rem;
    color: #ebe3f7;            /* 11:1 */
    max-width: 32em;
    margin-bottom: 2rem;
}

.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ---------- Buttons: offset-shadow style ---------- */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    font: inherit;
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: none;
    border-radius: 8px;
    border: 2px solid;
    cursor: pointer;
}

.button-primary,
main a.button-primary,
main a.button-primary:visited {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: var(--accent-ink);
    box-shadow: 4px 4px 0 var(--accent-ink);
    text-decoration: none;
}

.hero .button-primary { border-color: var(--accent-ink); box-shadow: 4px 4px 0 var(--accent-ink); }

.button-primary:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--accent-ink); }
.hero .button-primary:hover { box-shadow: 6px 6px 0 var(--accent-ink); }
.button-primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--accent-ink); }

main a.button-ghost,
main a.button-ghost:visited {
    color: #ffffff;
    border-color: #ffffff;
    background: transparent;
    text-decoration: none;
}

.button-ghost:hover { background: rgba(255, 255, 255, 0.12); }

/* ---------- Plates: framed cards with an inner rule and offset shadow ---------- */
.plate {
    position: relative;
    background: var(--surface);
    border: 2px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--plate-shadow);
}

/* The inner rule that gives plates their framed, printed feel */
.plate::after {
    content: "";
    position: absolute;
    inset: 6px;
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) - 6px);
    pointer-events: none;
}

.hero-plate::after { border-color: rgba(255, 255, 255, 0.35); }

.hero-plate {
    margin: 0;
    padding: 0.7rem;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 8px 8px 0 var(--accent);
}

.hero-plate img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
}

.hero-plate figcaption {
    font-size: 0.9rem;
    font-style: italic;
    color: #ebe3f7;
    padding: 0.5rem 0.2rem 0;
}

/* ---------- Facts ---------- */
.facts {
    max-width: 76rem;
    margin: -3rem auto 0;
    padding: 0 1.25rem;
    position: relative;
    z-index: 2;
}

.facts dl {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 0;
}

.fact {
    display: flex;
    flex-direction: column-reverse;   /* number first visually; dt first in reading order */
    align-items: flex-start;
    gap: 0.2rem;
    padding: 1.1rem 1.3rem;
    background: var(--surface);
    border: 2px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--plate-shadow);
}

.fact dt {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.95rem;
    color: var(--ink-soft);
}

.fact-icon { color: var(--brand); }
:root[data-dark="true"] .fact-icon { color: var(--accent); }

.fact dd {
    margin: 0;
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--heading);
}

/* ---------- Bands ---------- */
.band { padding: 4.5rem 1.25rem; }
.band-tinted { background: var(--surface-2); }

.band-inner { max-width: 76rem; margin: 0 auto; }

.band h2 {
    font-size: clamp(1.9rem, 3.4vw, 2.6rem);
    font-weight: 800;
    line-height: 1.15;
    color: var(--heading);
    margin-bottom: 1rem;
}

:where(.band) p { margin-bottom: 1rem; max-width: 42em; }
.band-lead { font-size: 1.2rem; color: var(--ink-soft); }

/* ---------- About ---------- */
.about-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 3rem;
    align-items: start;
}

.check-list {
    list-style: none;
    margin: 1.4rem 0 0;
    padding: 0;
}

.check-list li {
    position: relative;
    padding-left: 2rem;
    margin: 0.55rem 0;
}

/* Check mark drawn in CSS: decorative, list semantics carry meaning */
.check-list li::before {
    content: "";
    position: absolute;
    left: 0.2rem;
    top: 0.45em;
    width: 0.55rem;
    height: 0.95rem;
    border: solid var(--brand);
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

:root[data-dark="true"] .check-list li::before { border-color: var(--accent); }

.news-card { padding: 1.4rem; }

.news-card img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 0.9rem;
}

.news-card h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--heading);
}

.news-date { color: var(--ink-soft); font-size: 0.95rem; }

/* ---------- Disclosures (details/summary) ---------- */
details summary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 700;
    color: var(--link);
    border-radius: 6px;
    list-style: none;
}

details summary::-webkit-details-marker { display: none; }

details summary::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border: solid currentColor;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(-45deg);
}

details[open] summary::before { transform: rotate(45deg); }
details p { margin-top: 0.4rem; }

/* ---------- Apply ---------- */
.apply-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 3rem;
    align-items: start;
}

.apply-form { padding: 2rem; }

.apply-form h3 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--heading);
    margin-bottom: 0.3rem;
}

.form-note { color: var(--ink-soft); font-size: 0.95rem; }

.field { margin: 1.3rem 0; border: 0; padding: 0; }

.field > label,
.field legend {
    display: block;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.field input[type="text"],
.field input[type="email"],
.field textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 48px;
    padding: 0.6rem 0.8rem;
    font: inherit;
    font-size: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 2px solid var(--ink-soft);   /* 3:1+ boundary for inputs */
    border-radius: 8px;
}

.field input:hover, .field textarea:hover { border-color: var(--brand); }

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
    border-color: var(--error);
    border-width: 3px;
}

.field-hint { font-size: 0.95rem; color: var(--ink-soft); margin: 0 0 0.4rem; }

.field-error {
    display: flex;
    gap: 0.4rem;
    align-items: flex-start;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--error);
    margin-top: 0.4rem;
}

.field-error:empty { display: none; }

.choice {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.35rem 0;
}

.choice input {
    width: 1.6rem;              /* 25.6px: clears the 24px target minimum */
    height: 1.6rem;
    min-height: 0;
    accent-color: var(--brand);
    flex-shrink: 0;
}

.choice label { cursor: pointer; padding: 0.35rem 0; }
.choice label a { color: var(--link); }

.form-error-summary {
    padding: 1rem 1.2rem;
    margin: 1rem 0;
    background: var(--bg);
    border: 3px solid var(--error);
    border-left-width: 10px;
    border-radius: 8px;
}

.form-error-summary h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--error);
    margin-bottom: 0.4rem;
}

.form-error-summary ul { margin: 0; padding-left: 1.4rem; }
.form-error-summary a { color: var(--error); font-weight: 700; }

.form-success {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-weight: 700;
    color: var(--success);
}

.form-success:empty { margin: 0; min-height: 0; }   /* stays in the accessibility tree */

/* ---------- Schedule ---------- */
.table-wrap { overflow-x: auto; }

table { width: 100%; min-width: 30rem; border-collapse: collapse; }

caption {
    text-align: left;
    font-weight: 700;
    padding: 1rem 1.2rem 0.5rem;
    color: var(--heading);
}

th, td {
    padding: 0.9rem 1.2rem;
    text-align: left;
    border-top: 1px solid var(--line);
}

thead th {
    background: var(--brand-deep);
    color: #ffffff;
    border-top: 0;
}

tbody th { color: var(--heading); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fact dd { font-variant-numeric: tabular-nums lining-nums; }
tbody tr:nth-child(even) { background: var(--surface-2); }

/* ---------- Contact ---------- */
.contact-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
    gap: 3rem;
    align-items: start;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    min-height: 44px;
}

.statement { padding: 1.8rem; }
.statement h3 {
    font-size: 1.6rem;
    font-family: "Fraunces", Georgia, serif;
    font-weight: 800;
    color: var(--heading);
    margin-bottom: 0.8rem;
}

/* ---------- Footer ---------- */
.foot {
    background: var(--brand-deep);
    color: #d8cbee;
    padding: 2.2rem 1.25rem;
    border-top: 3px solid var(--accent);
}

.foot-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem 2rem;
}

.footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.foot a,
.foot details summary { color: #ffd166; }
.foot details p a { color: #ffd166; }   /* 10:1 on brand-deep */

.back-to-top { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 44px; }

.foot-details { max-width: 22rem; }
.foot-details p { color: #d8cbee; font-size: 0.95rem; }

/* ---------- Selection ---------- */
::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
    .site-header { position: static; }
    html { scroll-padding-top: 1rem; }
}

@media (max-width: 960px) {
    .hero-inner, .about-grid, .apply-grid, .contact-grid { grid-template-columns: 1fr; }
    .facts dl { grid-template-columns: repeat(2, 1fr); }
    .hero { padding: 3rem 1.25rem 5rem; }

    .header-inner { justify-content: center; }
    .site-nav ul { justify-content: center; }
}

@media (max-width: 480px) {
    .facts dl { gap: 0.7rem; }
    .fact { padding: 0.9rem 1rem; }
    .fact dd { font-size: 1.8rem; }
    .apply-form { padding: 1.3rem; }

    /* Compact header: nav tiles tighter, tools on one row */
    .header-inner { padding: 0.6rem 1rem; gap: 0.7rem; }
    .site-nav ul { gap: 0.4rem; }
    .site-nav a { padding: 0.35rem 0.75rem; }
    .header-tools { width: 100%; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
    .search { flex: 1 1 100%; min-width: 0; }
    .search input { width: 100%; min-width: 0; }
    .apply-form .button-primary { width: 100%; margin-top: 1.4rem; }
    .text-size button, .theme-switch { padding-left: 0.5rem; padding-right: 0.5rem; }
}

@media (max-width: 360px) {
    .facts dl { grid-template-columns: 1fr; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    .button-primary:hover, .button-primary:active { transform: none; }
}

/* ---------- More contrast requested ---------- */
@media (prefers-contrast: more) {
    html:root {
        --ink-soft: var(--ink);
        --line: var(--line-strong);
    }

    .switch-track { background: transparent; }

    .site-nav a, .header-tools button { border-color: #ffffff; }
}

/* ---------- Windows High Contrast / forced colors ---------- */
@media (forced-colors: active) {
    a:focus-visible, button:focus-visible, input:focus-visible,
    textarea:focus-visible, summary:focus-visible, .table-wrap:focus-visible {
        outline: 3px solid Highlight;
        box-shadow: none;
    }

    .site-nav a[aria-current] { border: 3px solid Highlight; }
    .plate, .fact, .button, .header-tools button { border: 2px solid CanvasText; }
    .logo-hex { fill: CanvasText; }
    .logo-mark { stroke: Canvas; }
    .switch-track, .switch-thumb { forced-color-adjust: none; }
    .switch-track { background: Canvas; border-color: ButtonText; }
    .switch-thumb { background: ButtonText; }
    .theme-switch[aria-checked="true"] .switch-track { background: Highlight; border-color: Highlight; }
    .theme-switch[aria-checked="true"] .switch-thumb { background: HighlightText; }
}

/* ---------- Print ---------- */
@media print {
    .site-header, .skip-link, .hero-actions, .foot nav, .apply-form { display: none; }
    body { background: #ffffff; color: #000000; font-size: 12pt; }
    .hero { background: none; color: #000000; padding: 0 0 1rem; }
    .hero h1, .hero-accent, .hero-lead, .eyebrow-light, .hero-plate figcaption { color: #000000; }
    .plate, .fact { box-shadow: none; border: 1px solid #000000; }
    main a[href^="mailto"]::after { content: " (" attr(href) ")"; }
}

/* ---------- Focus rings must survive component shadows ---------- */
.button-primary:focus-visible,
main a.button-primary:focus-visible,
.hero .button-primary:focus-visible {
    box-shadow: 0 0 0 6px var(--brand-deep), 4px 4px 0 var(--accent-ink);
    transform: none;
}

.site-nav a[aria-current]:focus-visible {
    box-shadow: 0 0 0 6px var(--brand-deep), 4px 4px 0 var(--accent);
}

.table-wrap:focus-visible {
    box-shadow: 0 0 0 6px var(--brand-deep), var(--plate-shadow);
}

/* ---------- Checkbox row keeps radio-row styling ---------- */
.choice > label {
    display: inline;
    font-weight: 400;
    margin: 0;
}

.choice.field { margin: 1.3rem 0 0.4rem; }

/* ---------- Disabled state is visibly different ---------- */
.button:disabled,
.button[aria-disabled="true"],
.header-tools button:disabled {
    background: var(--surface-2);
    color: var(--ink-soft);
    border-color: var(--line);
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

/* ---------- Standalone links get the 44px target too ---------- */
.footer-links a,
.search-results a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}

/* ---------- Tick position survives user line-height overrides ---------- */
.check-list li::before {
    top: 0.45em;
    height: 0.95em;
    width: 0.55em;
}

/* ---------- Schedule rows stay scannable in dark mode ---------- */
:root[data-dark="true"] th,
:root[data-dark="true"] td { border-top-color: var(--line); }

/* ---------- Custom radio and checkbox: visible border in both themes ---------- */
.choice input[type="radio"],
.choice input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    background: var(--surface);
    border: 2.5px solid var(--ink-soft);      /* 7:1+ against the card in both themes */
    display: inline-grid;
    place-content: center;
    cursor: pointer;
}

.choice input[type="radio"] { border-radius: 50%; }
.choice input[type="checkbox"] { border-radius: 6px; }

.choice input:hover { border-color: var(--brand); }

.choice input::before {
    content: "";
    width: 0.8rem;
    height: 0.8rem;
    transform: scale(0);
    background: var(--brand);
    border-radius: 50%;
}

.choice input[type="checkbox"]::before {
    width: 0.5rem;
    height: 0.9rem;
    border-radius: 0;
    background: none;
    border: solid #ffffff;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg) scale(0);
    margin-top: -0.15rem;
}

.choice input:checked { border-color: var(--brand); }
.choice input[type="checkbox"]:checked { background: var(--brand); }
.choice input[type="radio"]:checked::before { transform: scale(1); }
.choice input[type="checkbox"]:checked::before { transform: rotate(45deg) scale(1); }

:root[data-dark="true"] .choice input:checked,
:root[data-dark="true"] .choice input[type="checkbox"]:checked { border-color: var(--accent); }
:root[data-dark="true"] .choice input[type="checkbox"]:checked { background: var(--accent); }
:root[data-dark="true"] .choice input[type="checkbox"]:checked::before { border-color: var(--accent-ink); }
:root[data-dark="true"] .choice input[type="radio"]::before { background: var(--accent); }

@media (prefers-reduced-motion: no-preference) {
    .choice input::before { transition: transform 120ms ease; }
}

@media (forced-colors: active) {
    .choice input[type="radio"],
    .choice input[type="checkbox"] { appearance: auto; -webkit-appearance: auto; }
}

/* ---------- Keyboard help ---------- */
.help-list {
    margin: 0.6rem 0 1rem;
    padding-left: 1.3rem;
}

.help-list li { margin: 0.35rem 0; }

kbd {
    font-family: inherit;
    font-size: 0.9em;
    font-weight: 700;
    padding: 0.1em 0.45em;
    border: 1.5px solid var(--line-strong);
    border-bottom-width: 3px;
    border-radius: 5px;
    background: var(--surface-2);
    color: var(--ink);
}

.apply-form .button-primary { margin-top: 1.6rem; }

/* The track must never be squeezed by the flex button */
.theme-switch .switch-track { flex: 0 0 2.6rem; }
.theme-switch .icon { flex-shrink: 0; }

/* ---------- Round 5 polish ---------- */

/* Section number chips bring the yellow into the body */
.eyebrow-num {
    display: inline-grid;
    place-items: center;
    min-width: 2em;
    padding: 0.1em 0.45em;
    background: var(--accent);
    color: var(--accent-ink);
    border: 2px solid var(--accent-ink);
    border-radius: 6px;
    letter-spacing: 0;
    font-family: "Fraunces", Georgia, serif;
    font-weight: 800;
}

/* Facts read as a ticket strip, lighter than the three real plates */
.fact {
    box-shadow: none;
    border-width: 2px 2px 6px;
}

.fact dt {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.85rem;
}

/* Table: caption is the card's title, header row quieter, aligned digits */
caption {
    font-family: "Fraunces", Georgia, serif;
    font-size: 1.25rem;
    font-weight: 800;
    padding: 1.1rem 1.2rem 0.7rem;
}

thead th {
    font-size: 0.95rem;
    line-height: 1.3;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* All three h3s share one treatment */
.news-card h3,
.apply-form h3,
.statement h3 {
    font-family: "Fraunces", Georgia, serif;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--heading);
}

/* Hero: caption becomes a tag pinned to the plate; yellow ring echoes the logo */
.hero-plate {
    margin-bottom: 1.2rem;
}

.hero-plate figcaption {
    position: absolute;
    left: 1.1rem;
    bottom: -1rem;
    padding: 0.25rem 0.8rem;
    background: var(--accent);
    color: var(--accent-ink);
    border: 2px solid var(--accent-ink);
    border-radius: 6px;
    font-style: normal;
    font-weight: 700;
    font-size: 0.95rem;
}

.hero {
    background:
        radial-gradient(circle at 88% 18%, transparent 11.5rem, rgba(255, 200, 61, 0.14) 11.5rem 12rem, transparent 12rem),
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.07) 1px, transparent 0) 0 0 / 26px 26px,
        linear-gradient(140deg, #2c1452 0%, #3b1f66 50%, #5a2ca0 100%);
}

.hero h1 { font-optical-sizing: auto; }
.hero-accent { font-variation-settings: "SOFT" 100, "WONK" 1; }

/* Footer: a predictable grid instead of four items fighting for one row */
.foot-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1.2rem 2rem;
}

.foot-policies {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 2.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    padding-top: 1rem;
}

.foot-details { max-width: 32rem; }

@media (max-width: 600px) {
    .foot-inner { grid-template-columns: 1fr; }
}

@media (forced-colors: active) {
    .eyebrow-num, .hero-plate figcaption { border: 2px solid CanvasText; }
}

@media print {
    .hero-plate figcaption { position: static; border: 0; background: none; }
}

/* Only eyebrows with a number chip lay out as a row */
.eyebrow { display: block; }
.eyebrow:has(.eyebrow-num) { display: flex; }
.eyebrow-num { margin-right: 0.1rem; }

/* ---------- Round 6 polish ---------- */

/* Balanced headings and orphan-free paragraphs where the browser supports it */
h1, h2, h3, .hero-lead, .band-lead { text-wrap: balance; }
p, li, td { text-wrap: pretty; }

/* A short accent rule under each section title ties the sections together */
.band > .band-inner > h2::after,
.band > .band-inner > div > h2::after {
    content: "";
    display: block;
    width: 3rem;
    height: 5px;
    margin-top: 0.55rem;
    background: var(--accent);
    border: 1.5px solid var(--accent-ink);
    border-radius: 3px;
}

/* Tinted bands get crisp edges so the rhythm reads at a glance */
.band-tinted {
    border-top: 2px solid var(--line);
    border-bottom: 2px solid var(--line);
}

/* News photo keeps a tidy 4:3 crop whatever the card width */
.news-card img {
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

/* Softer, more generous rhythm inside the about copy */
.prose p + p { margin-top: 0.2rem; }
.check-list { margin-top: 1.8rem; }

/* Hero lead gets a touch more room from the kicker */
.hero h1 { margin-top: 0.3rem; }

@media (forced-colors: active) {
    .band > .band-inner > h2::after,
    .band > .band-inner > div > h2::after { background: CanvasText; border-color: CanvasText; }
}

/* On phones the schedule wraps instead of scrolling, so the caption is
   never clipped and there is no sideways scroll anywhere on the page */
@media (max-width: 600px) {
    table { min-width: 0; }
    th, td { padding: 0.7rem 0.6rem; }
    tbody th { white-space: normal; }
    thead th { font-size: 0.8rem; }
    caption { font-size: 1.1rem; padding: 1rem 0.8rem 0.6rem; }
}

/* ==========================================================================
   Final overrides — kept last so media rules always win over polish blocks
   ========================================================================== */

/* Edges that must stay visible on dark surfaces */
.button-primary,
main a.button-primary,
main a.button-primary:visited { border-color: var(--edge); box-shadow: 4px 4px 0 var(--edge); }
.button-primary:hover { box-shadow: 6px 6px 0 var(--edge); }
.button-primary:active { box-shadow: 1px 1px 0 var(--edge); }
.button-primary:focus-visible,
main a.button-primary:focus-visible { box-shadow: 0 0 0 6px var(--brand-deep), 4px 4px 0 var(--edge); }
.hero .button-primary { border-color: var(--accent-ink); box-shadow: 4px 4px 0 var(--accent-ink); }
.hero .button-primary:hover { box-shadow: 6px 6px 0 var(--accent-ink); }
.hero .button-primary:focus-visible { box-shadow: 0 0 0 6px var(--brand-deep), 4px 4px 0 var(--accent-ink); }
.eyebrow-num { border-color: var(--edge); }

/* One accent per section title: the chip. The bar becomes a quiet brand rule. */
.band > .band-inner > h2::after,
.band > .band-inner > div > h2::after { background: var(--brand); border: 0; height: 4px; border-radius: 2px; }

/* Hero: calmer yellow budget, tag above the inner rule, no ring on small screens */
.hero-plate figcaption { z-index: 1; background: var(--brand-deep); color: #ffffff; border-color: rgba(255, 255, 255, 0.6); }
.table-wrap::after { display: none; }
.table-wrap { padding-bottom: 0.4rem; }
main > .band-tinted:last-child { border-bottom: 0; }

@media (max-width: 960px) {
    .hero { padding-bottom: 5.75rem; background:
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.07) 1px, transparent 0) 0 0 / 26px 26px,
        linear-gradient(140deg, #2c1452 0%, #3b1f66 50%, #5a2ca0 100%); }
}

@media (max-width: 480px) {
    .band { padding: 3rem 1.25rem; }
    .facts dl { grid-template-columns: 1fr; }
    .apply-form .button-primary { margin-top: 1.4rem; }
}

/* Reduced motion, re-asserted last */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .button-primary:hover, .button-primary:active { transform: none; }
    .choice input::before { transition: none; }
}

/* Forced colours, re-asserted last; switch state keyed on the pre-paint root attribute */
@media (forced-colors: active) {
    .fact, .plate, .button, .header-tools button { border: 2px solid CanvasText; }
    .fact { border-width: 2px; }
    .eyebrow-num, .hero-plate figcaption { border: 2px solid CanvasText; }
    .band > .band-inner > h2::after,
    .band > .band-inner > div > h2::after { background: CanvasText; }
    .switch-track { background: Canvas; border-color: ButtonText; }
    .switch-thumb { background: ButtonText; }
    :root[data-dark="true"] .switch-track { background: Highlight; border-color: Highlight; }
    :root[data-dark="true"] .switch-thumb { background: HighlightText; }
}

/* Print, re-asserted last */
@media print {
    .site-header, .skip-link, .hero-actions, .foot nav, .apply-form { display: none; }
    body { background: #ffffff; color: #000000; font-size: 12pt; }
    .hero { background: none; color: #000000; padding: 0 0 1rem; }
    .hero h1, .hero-accent, .hero-lead, .eyebrow-light { color: #000000; }
    .hero-plate figcaption { position: static; border: 0; background: none; color: #000000; }
    .plate, .fact { box-shadow: none; border: 1px solid #000000; }
    .plate::after { display: none; }
    thead th { background: none; color: #000000; border-bottom: 2px solid #000000; }
    .foot, .foot a, .foot details summary, .foot-details p { color: #000000; background: none; }
    .eyebrow-num { border-color: #000000; }
    .band > .band-inner > h2::after,
    .band > .band-inner > div > h2::after { background: #000000; }
    main a[href^="mailto"]::after { content: " (" attr(href) ")"; }
}
