/* ============================================================
   ALZHUB.ORG — design system
   ------------------------------------------------------------
   Palette: warm sand/cream page (#FBF3E7) with a deep indigo-plum
   primary (#4E3369) and a warm terracotta accent (#B8592F) — the
   opposite of a clinical teal/white health-tech look. This is a
   site for stressed family caregivers and older adults reading on
   a phone, often with low vision, so warmth and calm come first:
   soft rounded surfaces, restrained shadows, generous whitespace,
   no harsh borders. Every colour pair below is contrast-checked
   (WCAG AA, 4.5:1+ for text) — see the ratios noted inline.
   Type: 'Lora' (serif) for headings — an editorial, trustworthy
   warmth — paired with 'Atkinson Hyperlegible' for body text,
   a typeface designed by the Braille Institute specifically for
   readers with low vision, which is exactly this audience.
   Every colour / space / type value is a custom property, set once.
   ============================================================ */

:root {
    /* surfaces */
    --cream: #FBF3E7;           /* page background */
    --paper: #FFFFFF;           /* card / panel surface */
    --sand: #F3E9D8;            /* tinted band background */
    --rule: #E8DCC8;            /* soft warm divider, never a hard border */

    /* text */
    --ink: #2B2233;             /* body + headings          13.83:1 on cream */
    --muted: #5C5468;           /* secondary text            6.53:1 on cream */

    /* action / identity */
    --primary: #4E3369;         /* deep indigo-plum          9.53:1 on cream, white-on-it 10.49:1 */
    --primary-dark: #3A2650;    /* hover / active            white-on-it 13.35:1 */
    --primary-light: #ECE3F2;   /* tint for wells & badges */
    --accent: #B8592F;          /* warm terracotta, large text/icons/buttons — white-on-it 4.66:1 */
    --accent-dark: #96461F;     /* accent text on cream       5.97:1 */
    --accent-light: #FBEADE;    /* tint for accent panels */
    --confirm: #3F6B4E;         /* success/positive           5.1:1 on cream */
    --focus: #1857B8;           /* focus ring — distinct from brand hues, 6:1+ */

    /* type */
    --font-display: 'Lora', Georgia, 'Times New Roman', serif;
    --font-body: 'Atkinson Hyperlegible', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* space / shape */
    --radius: 1rem;
    --radius-sm: .6rem;
    --shadow-soft: 0 6px 20px rgba(43, 34, 51, .08);
    --shadow-softer: 0 2px 10px rgba(43, 34, 51, .06);
    --max-measure: 68ch;
}

/* ---------- reset-lite ---------- */
* { box-sizing: border-box; }
html { font-size: 100%; scroll-behavior: smooth; }
html.text-lg { font-size: 118.75%; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--cream);
    color: var(--ink);
    font-size: 1.125rem;
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

img { max-width: 100%; height: auto; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

/* ---------- type ---------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--ink);
    line-height: 1.25;
    font-weight: 600;
    margin: 0 0 .75rem;
}
h1 { font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem); line-height: 1.15; }
h2 { font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem); }
h3 { font-size: clamp(1.25rem, 1.1rem + .5vw, 1.5rem); }
h4 { font-size: 1.25rem; }
p { margin: 0 0 1.1rem; max-width: var(--max-measure); }
.measure { max-width: var(--max-measure); }
ul, ol { margin: 0 0 1.1rem; padding-left: 1.4rem; }
li { margin-bottom: .4rem; line-height: 1.65; }
strong { color: var(--ink); font-weight: 700; }
small, .small { font-size: .95rem; }

a { color: var(--primary); text-decoration-thickness: 2px; text-underline-offset: 2px; }
a:hover { color: var(--primary-dark); }
main a { text-decoration: underline; }
.nav a, .btn, .card-link, footer a, .skip-link { text-decoration: none; }

/* ---------- focus ---------- */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible, input:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ---------- skip link ---------- */
.skip-link {
    position: absolute;
    left: 1rem;
    top: -100px;
    background: var(--primary);
    color: #fff;
    padding: .75rem 1.25rem;
    border-radius: var(--radius-sm);
    z-index: 1000;
    transition: top .15s;
    font-weight: 700;
}
.skip-link:focus { top: 1rem; }

/* ---------- layout ---------- */
.container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 1.5rem;
}
.section { padding: 3.5rem 0; }
.section-tight { padding: 2rem 0; }
.grid {
    display: grid;
    gap: 1.5rem;
}
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* ---------- header ---------- */
.site-header {
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    max-width: 1120px;
    margin: 0 auto;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--ink);
}
.brand:hover { color: var(--primary); }
.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.15rem;
    flex-shrink: 0;
}
nav.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    align-items: center;
}
nav.main-nav a {
    padding: .55rem .85rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1rem;
    color: var(--ink);
}
nav.main-nav a:hover { background: var(--sand); color: var(--primary); }
nav.main-nav a[aria-current="page"] {
    background: var(--primary-light);
    color: var(--primary-dark);
}
.header-actions { display: flex; align-items: center; gap: .5rem; }

/* text-size toggle */
.text-toggle {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: var(--sand);
    border: 1px solid var(--rule);
    border-radius: 999px;
    padding: .5rem .9rem;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: .95rem;
    color: var(--ink);
    cursor: pointer;
}
.text-toggle:hover { background: var(--primary-light); }
.text-toggle[aria-pressed="true"] { background: var(--primary); color: #fff; border-color: var(--primary); }

/* mobile nav toggle */
.nav-toggle {
    display: none;
    background: var(--sand);
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    padding: .5rem .75rem;
    font-weight: 700;
    cursor: pointer;
}
@media (max-width: 860px) {
    .nav-toggle { display: inline-flex; }
    nav.main-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; gap: .25rem; }
    nav.main-nav.open { display: flex; }
    nav.main-nav a { padding: .85rem 1rem; }
    .header-inner { padding: .9rem 1.25rem; }
}

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .8rem 1.5rem;
    border-radius: 999px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1.0625rem;
    border: 2px solid transparent;
    cursor: pointer;
    line-height: 1.2;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); color: #fff; }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }

/* ---------- hero ---------- */
.hero {
    background: linear-gradient(180deg, var(--sand) 0%, var(--cream) 100%);
    padding: 3.5rem 0 3rem;
    border-bottom: 1px solid var(--rule);
}
.hero .eyebrow {
    display: inline-block;
    font-weight: 700;
    color: var(--accent-dark);
    background: var(--accent-light);
    padding: .35rem .9rem;
    border-radius: 999px;
    font-size: .95rem;
    margin-bottom: 1rem;
}
.hero h1 { max-width: 18ch; }
.hero p.lead { font-size: 1.25rem; color: var(--muted); max-width: 56ch; }
.hero-actions { display: flex; gap: .85rem; flex-wrap: wrap; margin-top: 1.5rem; }

/* ---------- scope / disclaimer banner ---------- */
.scope-banner {
    background: var(--primary-light);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    margin: 2rem 0;
}
.scope-banner h2 { font-size: 1.15rem; margin-bottom: .5rem; }
.scope-banner p { margin-bottom: .5rem; color: var(--ink); }
.scope-banner p:last-child { margin-bottom: 0; }
.scope-banner .crisis {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rule);
}

/* ---------- cards ---------- */
.card {
    background: var(--paper);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow-softer);
    border: 1px solid var(--rule);
}
.card h3 { margin-bottom: .5rem; }
.card p:last-child { margin-bottom: 0; }
.card-link { font-weight: 700; }

.start-here-card {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    height: 100%;
}
.start-here-card .icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: .5rem;
}

/* ---------- facts ---------- */
.fact-card {
    background: var(--paper);
    border-radius: var(--radius);
    border-top: 4px solid var(--accent);
    padding: 1.5rem 1.75rem;
    box-shadow: var(--shadow-softer);
}
.fact-card .fact-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}
.fact-card .fact-source {
    font-size: .9rem;
    color: var(--muted);
    display: block;
    margin-top: .5rem;
}
.empty-state {
    background: var(--sand);
    border: 1px dashed var(--rule);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    color: var(--muted);
}
.empty-state p:last-child { margin-bottom: 0; }

/* ---------- rule head ---------- */
.rule-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0 0 1.75rem;
}
.rule-head::after { content: ''; flex: 1; height: 1px; background: var(--rule); }
.rule-head h2 { margin: 0; }

/* ---------- page header (stub/inner pages) ---------- */
.page-header {
    background: var(--sand);
    border-bottom: 1px solid var(--rule);
    padding: 3rem 0 2.5rem;
    margin-bottom: 2.5rem;
}
.page-header p.lead { color: var(--muted); font-size: 1.15rem; max-width: 60ch; margin-bottom: 0; }

/* ---------- glossary ---------- */
.glossary-term {
    border-bottom: 1px solid var(--rule);
    padding: 1.25rem 0;
}
.glossary-term:last-child { border-bottom: none; }
.glossary-term dt {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary-dark);
}
.glossary-term dd { margin: .4rem 0 0; color: var(--ink); }
.glossary-jump {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: 2rem;
}
.glossary-jump a {
    background: var(--sand);
    border-radius: 999px;
    padding: .4rem .8rem;
    font-weight: 700;
    font-size: .95rem;
}

/* ---------- footer ---------- */
footer {
    background: var(--primary);
    color: #F1EAF7;
    padding: 3rem 0 2rem;
    margin-top: 3rem;
}
footer a { color: #fff; }
footer a:hover { text-decoration: underline; }
footer h2, footer strong { color: #fff; }
footer .footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}
footer ul { list-style: none; padding: 0; margin: 0; }
footer li { margin-bottom: .6rem; }
footer .footer-bottom {
    border-top: 1px solid rgba(255,255,255,.2);
    padding-top: 1.5rem;
    font-size: .95rem;
    color: #E4D9EE;
}

/* ---------- forms ---------- */
label { font-weight: 700; display: block; margin-bottom: .4rem; }
input, textarea, select {
    font-family: var(--font-body);
    font-size: 1rem;
    padding: .7rem .9rem;
    border-radius: var(--radius-sm);
    border: 2px solid var(--rule);
    background: var(--paper);
    color: var(--ink);
    width: 100%;
}
input:focus, textarea:focus, select:focus {
    outline: 3px solid var(--focus);
    outline-offset: 1px;
    border-color: var(--focus);
}
.field { margin-bottom: 1.25rem; }

/* ---------- 404 ---------- */
.error-page { text-align: center; padding: 5rem 0; }
.error-page .code {
    font-family: var(--font-display);
    font-size: 5rem;
    font-weight: 700;
    color: var(--primary-light);
    line-height: 1;
}

@media (max-width: 600px) {
    .section { padding: 2.5rem 0; }
    .hero { padding: 2.5rem 0 2rem; }
}
