/* ============================================================
   Through Their Eyes — site.css
   WCAG 2.2 AA baseline. Pure CSS. No build step.
   ============================================================ */

/* ---- Tokens ---- */
:root {
    --bg: #0b1020;
    --bg-elev: #131a33;
    --bg-card: #1a2247;
    --fg: #f4f6ff;
    --fg-muted: #b9c0e0;
    --fg-dim: #8a93b8;
    --accent: #ffd166;       /* warm gold — high contrast on dark */
    --accent-ink: #1a1300;
    --link: #9ed0ff;
    --link-hover: #ffffff;
    --good: #74e0a3;
    --warn: #ffb454;
    --bad: #ff7a7a;
    --border: #2a3470;
    --focus: #ffd166;

    --radius-sm: 6px;
    --radius: 12px;
    --radius-lg: 22px;

    --max: 1180px;
    --gap: clamp(16px, 2vw, 28px);

    --shadow-sm: 0 1px 2px rgba(0,0,0,.25);
    --shadow: 0 12px 32px rgba(0,0,0,.35);

    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
}

/* Honor user dark/light preference but stay on dark by default — the
   simulations rely on a controlled palette. Light mode kept readable. */
@media (prefers-color-scheme: light) {
    :root.has-light {
        --bg: #fbfbf9;
        --bg-elev: #ffffff;
        --bg-card: #ffffff;
        --fg: #14172b;
        --fg-muted: #3a3f5c;
        --fg-dim: #6b7290;
        --accent: #c9540a;
        --accent-ink: #ffffff;
        --link: #1e4ad6;
        --link-hover: #0f2d99;
        --border: #e1e3ec;
        --shadow: 0 8px 24px rgba(20,23,43,.08);
    }
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.6;
    color: var(--fg);
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at top left, rgba(255,209,102,.07), transparent 60%),
        radial-gradient(ellipse at bottom right, rgba(120,143,255,.08), transparent 60%);
    min-height: 100vh;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
table { border-collapse: collapse; }

/* ---- Focus: must always be visible ---- */
:focus { outline: none; }
:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---- Skip link (keyboard users) ---- */
.skip-link {
    position: absolute;
    left: 8px;
    top: -40px;
    background: var(--accent);
    color: var(--accent-ink);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    z-index: 100;
    transition: top .15s ease;
}
.skip-link:focus { top: 8px; }

/* ---- Layout helpers ---- */
.container {
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding-inline: clamp(16px, 4vw, 28px);
}

/* ---- Header / nav ---- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(11, 16, 32, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.site-header__row {
    display: flex;
    align-items: center;
    gap: 24px;
    padding-block: 14px;
    flex-wrap: wrap;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--fg);
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
}
.brand__mark { color: var(--accent); display: inline-flex; }
.site-nav { flex: 1; }
.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.site-nav a {
    color: var(--fg-muted);
    text-decoration: none;
    padding: 8px 6px;
    border-bottom: 2px solid transparent;
}
.site-nav a:hover, .site-nav a:focus-visible { color: var(--fg); }
.site-nav a[aria-current="page"] {
    color: var(--fg);
    border-bottom-color: var(--accent);
}
.nav-cta {
    background: var(--accent);
    color: var(--accent-ink) !important;
    padding: 8px 14px !important;
    border-radius: 999px;
    font-weight: 700;
}
.nav-cta:hover, .nav-cta:focus-visible { filter: brightness(1.05); }

.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--fg-dim);
}
.lang-switch a {
    color: var(--fg-muted);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}
.lang-switch a.is-active {
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 700;
}

/* ---- Headings ---- */
h1, h2, h3 {
    font-family: var(--font-display);
    line-height: 1.15;
    margin: 0 0 .5em;
    letter-spacing: -.01em;
}
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.4rem); }
h3 { font-size: 1.3rem; }
.eyebrow {
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--accent);
    font-weight: 700;
    font-size: .82rem;
    margin: 0 0 14px;
}
.lede {
    font-size: clamp(1.05rem, 1.6vw, 1.25rem);
    color: var(--fg-muted);
    max-width: 70ch;
}

/* ---- Buttons & links ---- */
a { color: var(--link); text-underline-offset: 2px; }
a:hover, a:focus-visible { color: var(--link-hover); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 22px;
    border-radius: 999px;
    border: 2px solid transparent;
    background: var(--accent);
    color: var(--accent-ink);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    transition: transform .12s ease, filter .12s ease;
    min-height: 48px;
}
.btn:hover, .btn:focus-visible { filter: brightness(1.05); transform: translateY(-1px); }
.btn--ghost {
    background: transparent;
    color: var(--fg);
    border-color: var(--border);
}
.btn--ghost:hover { border-color: var(--accent); color: var(--fg); }
.btn--big { padding: 18px 28px; font-size: 1.05rem; }
.btn--block { width: 100%; }

/* ---- Hero ---- */
.hero {
    padding-block: clamp(40px, 8vw, 100px);
}
.hero__h1 {
    max-width: 22ch;
}
.hero__lede { margin-block: 24px 32px; }
.hero__ctas { display: flex; gap: 14px; flex-wrap: wrap; }

/* ---- Stats strip ---- */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--gap);
    margin-block: 48px;
}
.stat {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 22px 24px;
    box-shadow: var(--shadow-sm);
}
.stat__value {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3.2vw, 2.6rem);
    color: var(--accent);
    line-height: 1;
    margin-bottom: 8px;
}
.stat__label {
    color: var(--fg-muted);
    font-size: .98rem;
}

/* ---- Section ---- */
.section { padding-block: clamp(40px, 6vw, 80px); }
.section--alt { background: var(--bg-elev); border-block: 1px solid var(--border); }
.section__head { margin-bottom: clamp(20px, 3vw, 40px); }

/* ---- Experience cards ---- */
.exp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--gap);
}
.exp-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    text-decoration: none;
    color: var(--fg);
    transition: transform .15s ease, border-color .15s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 220px;
}
.exp-card:hover, .exp-card:focus-visible {
    border-color: var(--accent);
    transform: translateY(-3px);
}
.exp-card__icon {
    width: 44px; height: 44px; border-radius: 12px;
    background: rgba(255,209,102,.14);
    color: var(--accent);
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 6px;
}
.exp-card__title { margin: 0; }
.exp-card__cta {
    margin-top: auto;
    color: var(--accent);
    font-weight: 700;
}
.exp-card__cta::after { content: " →"; }

/* ---- Quote / testimonial ---- */
.testimonial {
    margin-block: 60px;
    padding: 28px;
    border-left: 4px solid var(--accent);
    background: var(--bg-elev);
    border-radius: var(--radius);
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--fg);
}
.testimonial__attr { font-family: var(--font-body); color: var(--fg-muted); font-size: 1rem; margin-top: 12px; }

/* ---- Footer ---- */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-elev);
    margin-top: 80px;
    padding-block: 28px;
}
.site-footer__row {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    color: var(--fg-muted);
    font-size: .95rem;
}
.site-footer__nav { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.site-footer__nav a { color: var(--fg-muted); text-decoration: none; }
.site-footer__nav a:hover, .site-footer__nav a:focus-visible { color: var(--fg); }
.site-footer__tag,
.site-footer__legal,
.site-footer__credit { margin: 0; }
.site-footer__credit { color: inherit; font-weight: 400; }

/* ============================================================
   FORMS
   ============================================================ */
.form { display: grid; gap: 18px; max-width: 640px; }
.form__row { display: grid; gap: 6px; }
.form__row--inline { grid-template-columns: 1fr 1fr; gap: 14px; }
.form label {
    font-weight: 600;
    color: var(--fg);
}
.form .hint { color: var(--fg-muted); font-size: .9rem; }
.form input[type="text"],
.form input[type="email"],
.form input[type="password"],
.form input[type="search"],
.form select,
.form textarea {
    background: var(--bg-elev);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    min-height: 48px;
    width: 100%;
}
.form textarea { min-height: 110px; resize: vertical; }
.form input:focus-visible,
.form select:focus-visible,
.form textarea:focus-visible {
    border-color: var(--accent);
}
.form .checkbox {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 10px;
    align-items: start;
    line-height: 1.45;
}
.form .checkbox input { width: 22px; height: 22px; }
.form .errors {
    background: rgba(255,122,122,.10);
    border: 1px solid var(--bad);
    color: #ffd6d6;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin: 0;
}
.form .errors li { margin-left: 18px; }
.form .success {
    background: rgba(116,224,163,.10);
    border: 1px solid var(--good);
    color: #e2ffec;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

/* ============================================================
   EXPERIENCE PAGE
   ============================================================ */
.exp {
    padding-block: 30px;
}
.exp__nav {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin-block: 8px 28px;
}
.exp__nav a {
    color: var(--fg-muted);
    text-decoration: none;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: .92rem;
}
.exp__nav a[aria-current="page"] {
    border-color: var(--accent);
    color: var(--fg);
    background: rgba(255,209,102,.10);
}
.exp__controls {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-block: 24px;
    display: grid;
    gap: 14px;
}
.exp__controls__row { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; }
.exp__controls label { font-weight: 600; }
.exp__stage {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(20px, 3vw, 36px);
    margin-block: 24px;
    position: relative;
    overflow: hidden;
}
.exp__stage h3 { margin-top: 0; }
.exp__disclaimer { color: var(--fg-muted); font-style: italic; }
.exp__task {
    border-left: 3px solid var(--accent);
    padding-left: 14px;
    margin-block: 24px;
    color: var(--fg);
    font-weight: 600;
}

/* ---- Visual filters (applied to .exp__stage--visual via class) ---- */
.exp__stage--visual .stage-content { transition: filter .25s ease, transform .25s ease; }
.filter-blur     .stage-content { filter: blur(3.5px); }
.filter-blur-2   .stage-content { filter: blur(7px); }
.filter-cataract .stage-content { filter: blur(2.5px) brightness(1.1) contrast(.7); }
.filter-protan   .stage-content { filter: url(#filter-protan); }
.filter-deutan   .stage-content { filter: url(#filter-deutan); }
.filter-tritan   .stage-content { filter: url(#filter-tritan); }
.filter-tunnel::after {
    content: "";
    position: absolute; inset: 0;
    background: radial-gradient(circle at 50% 45%, transparent 0, transparent 14%, rgba(0,0,0,.6) 26%, rgba(0,0,0,.97) 60%);
    pointer-events: none;
}

/* product card styling inside the stage */
.product-card {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 22px;
    align-items: start;
}
.product-card__img {
    background: linear-gradient(135deg, #2a3470, #1a2247);
    border-radius: var(--radius);
    aspect-ratio: 1;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
}
.product-card__price {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent);
}
.product-card__strike { color: var(--fg-dim); text-decoration: line-through; margin-left: 8px; }
.product-card__meta { color: var(--fg-muted); font-size: .92rem; margin-block: 4px 12px; }
.product-card__buy {
    margin-top: 14px;
    background: var(--accent);
    color: var(--accent-ink);
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 700;
}
.product-card__link { display: inline-block; margin-top: 10px; font-size: .9rem; }

/* ---- Dyslexia ---- */
.exp__stage--dyslexia .dyslexia-text {
    font-size: 1.15rem;
    line-height: 1.8;
}
.dyslexia-text .ch {
    display: inline-block;
    transition: transform .14s ease;
}

/* ---- ADHD popups & overlays ---- */
.adhd-popup {
    position: fixed;
    background: var(--bg-elev);
    border: 2px solid var(--accent);
    border-radius: 10px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
    max-width: 320px;
    z-index: 25;
    color: var(--fg);
    animation: pop-in .22s ease both;
}
.adhd-popup__close {
    background: transparent;
    border: none;
    color: var(--fg-muted);
    font-size: 1.3rem;
    cursor: pointer;
    position: absolute;
    top: 4px; right: 8px;
}
.adhd-ticker {
    position: fixed;
    top: 64px;
    left: 0; right: 0;
    background: var(--bad);
    color: #fff;
    font-weight: 700;
    overflow: hidden;
    z-index: 20;
    padding: 6px 0;
}
.adhd-ticker__inner {
    display: inline-block;
    white-space: nowrap;
    animation: ticker 18s linear infinite;
    padding-left: 100%;
}
.adhd-flash {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 15;
    animation: flash 1.6s steps(2,end) infinite;
    background: rgba(255,255,255,.04);
}
@keyframes flash {
    0%, 49% { background: rgba(255,255,255,0); }
    50%, 100% { background: rgba(255,255,255,.06); }
}
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@keyframes pop-in {
    from { transform: translateY(20px) scale(.92); opacity: 0; }
    to { transform: none; opacity: 1; }
}

/* ---- Motor target ---- */
.motor-stage {
    position: relative;
    height: 320px;
    background: rgba(0,0,0,.2);
    border-radius: var(--radius);
    overflow: hidden;
}
.motor-target {
    position: absolute;
    background: var(--good);
    color: #07210f;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-weight: 700;
    transition: top .25s ease, left .25s ease;
}
.motor-cursor-wrapper { cursor: none; }
.motor-cursor {
    position: fixed;
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 50;
    transition: transform .04s linear;
}

/* ---- Captionless video stub ---- */
.silent-video {
    background: #000;
    border-radius: var(--radius);
    aspect-ratio: 16/9;
    display: grid;
    place-items: center;
    color: #ddd;
    font-family: var(--font-display);
    font-size: 1.4rem;
    position: relative;
}
.silent-video::before {
    content: "▶";
    position: absolute;
    width: 64px; height: 64px;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    display: grid; place-items: center;
}

/* ---- Admin ---- */
.admin-wrap { max-width: 1100px; margin: 30px auto; padding-inline: 16px; }
.admin-bar {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 14px; margin-bottom: 18px;
}
.admin-stats { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-stat {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px; min-width: 180px;
}
.admin-stat__v { font-family: var(--font-display); font-size: 1.6rem; color: var(--accent); }
.admin-stat__l { color: var(--fg-muted); font-size: .9rem; }
.admin-table {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-elev);
}
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: .92rem; }
.admin-table th { background: var(--bg-card); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: rgba(255,209,102,.05); }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0s !important;
    }
    .adhd-flash { display: none; }
    .adhd-ticker__inner { animation: none; padding-left: 0; }
}

/* ---- High contrast support (Windows) ---- */
@media (forced-colors: active) {
    .btn, .nav-cta { border: 2px solid CanvasText; }
    :focus-visible { outline-color: Highlight; }
}

/* ---- Print ---- */
@media print {
    .site-header, .site-footer, .exp__controls { display: none; }
}

/* ============================================================
   MOBILE  (≤ 720 px — phones and small tablets)
   ============================================================ */
@media (max-width: 720px) {
    body { font-size: 16px; line-height: 1.55; }

    /* Container — tighten padding so content uses the screen. */
    .container { padding-inline: 14px; }

    /* ---- Header ---- */
    .site-header__row {
        gap: 10px;
        padding-block: 10px;
    }
    .brand__name { font-size: .98rem; }
    .lang-switch { margin-left: auto; }   /* push to right when nav wraps */

    .site-nav {
        order: 3;
        flex: 1 0 100%;
    }
    .site-nav ul {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 6px 10px;
        row-gap: 6px;
    }
    .site-nav a {
        padding: 7px 10px;
        font-size: .9rem;
        white-space: nowrap;
    }
    /* Hide the "Take the pledge" CTA from the nav on phones —
       the hero and footer CTAs still surface it. */
    .site-nav .nav-cta { display: none; }

    /* ---- Hero ---- */
    .hero { padding-block: 28px 24px; }
    .hero__h1 { font-size: clamp(1.75rem, 7vw, 2.2rem); }
    .hero__lede { font-size: 1rem; }
    .hero__ctas { flex-direction: column; align-items: stretch; }
    .hero__ctas .btn { width: 100%; }

    /* ---- Sections ---- */
    .section { padding-block: 36px; }
    .stats { margin-block: 32px; gap: 12px; }
    .stat { padding: 16px 18px; }
    .stat__value { font-size: 1.7rem; }

    /* ---- Experience cards ---- */
    .exp-grid { gap: 12px; }
    .exp-card { padding: 20px; min-height: 0; }

    /* ---- Testimonial ---- */
    .testimonial { padding: 20px; font-size: 1.05rem; margin-block: 36px; }

    /* ---- Forms ---- */
    .form__row--inline { grid-template-columns: 1fr; }
    .form input[type="text"],
    .form input[type="email"],
    .form input[type="password"],
    .form input[type="search"],
    .form select,
    .form textarea {
        font-size: 16px;          /* prevents iOS Safari from zooming on focus */
        padding: 11px 12px;
    }

    /* ---- Experience pages ---- */
    .exp__nav { gap: 6px; margin-block: 4px 18px; }
    .exp__nav a { font-size: .85rem; padding: 6px 12px; }
    .exp__controls { padding: 14px; }
    .exp__controls__row { gap: 8px 14px; }
    .exp__stage { padding: 18px; }

    /* Product card stacks vertically on phone */
    .product-card { grid-template-columns: 1fr; gap: 14px; }
    .product-card__img { max-width: 90px; }

    /* Motor target shorter, big finger-friendly */
    .motor-stage { height: 260px; }
    .motor-target { padding: 14px 18px; font-size: 1rem; }

    /* ADHD popups don't escape the viewport */
    .adhd-popup { max-width: calc(100vw - 28px); }
    .adhd-ticker { top: 56px; font-size: .85rem; }

    /* ---- Footer ---- */
    .site-footer { padding-block: 24px; margin-top: 56px; }
    .site-footer__nav { gap: 14px; }
    /* Wrap "A non-commercial..." onto its own line on phones. */
    .site-footer__legal-text { display: block; }

    /* ---- Admin ---- */
    .admin-wrap { margin-top: 18px; }
    .admin-bar { flex-direction: column; align-items: stretch; }
    .admin-bar form { flex-wrap: wrap; }
    .admin-stats { gap: 8px; }
    .admin-stat { min-width: 0; flex: 1; padding: 10px 12px; }
    .admin-stat__v { font-size: 1.3rem; }
    .admin-table th, .admin-table td { padding: 8px 10px; font-size: .85rem; }
}

/* iPhone notch / home indicator safe areas */
@supports (padding: env(safe-area-inset-bottom)) {
    .site-header { padding-top: env(safe-area-inset-top); }
    .site-footer { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
    .site-header__row,
    .site-footer__row {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* ---- Tiny utilities ---- */
.center { text-align: center; }
.muted { color: var(--fg-muted); }
.mt-l { margin-top: 32px; }
.mb-l { margin-bottom: 32px; }
.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}
