/* ==========================================================================
   Trkafem — app.css
   Single stylesheet. All colors are CSS variables; the admin panel repaints
   the whole site by overriding the --brand-* / theme variables only — no
   template edits required.
   ========================================================================== */

/* ---- 1) TOKENS ----------------------------------------------------------- */
:root {
    --brand: #D8352F;
    --brand-strong: #B62823;
    --brand-soft: #FBE9E8;
    --brand-contrast: #ffffff;

    --page: #ffffff;
    --surface-1: #ffffff;
    --surface-2: #f5f6f8;
    --surface-3: #eaecef;

    --ink: #16181d;
    --ink-2: #494d55;
    --ink-3: #6b7079;

    --line: rgba(0, 0, 0, .10);
    --line-strong: rgba(0, 0, 0, .18);

    /* Footer is always dark, independent of the light/dark theme */
    --footer-bg: #14161a;
    --footer-ink: #e7e8ea;
    --footer-ink-2: rgba(231, 232, 234, .62);
    --footer-line: rgba(255, 255, 255, .10);

    --danger: #D8352F;
    --success: #1f9e6f;

    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: Georgia, "Times New Roman", serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Single width everywhere */
    --container-max: 1000px;
    --gutter: 16px;
    --gutter-mobile: 10px;
    --radius: 10px;
    --radius-card: 5px;
    --radius-sm: 7px;
    --header-h: 64px;

    --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
    --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;

    --card-gap: 15px;

    color-scheme: light;
}

/* ---- 2) DARK THEME ------------------------------------------------------- */
[data-theme="dark"] {
    --page: #0f1115;
    --surface-1: #171a1f;
    --surface-2: #1d2127;
    --surface-3: #23272e;

    --ink: #f2f3f5;
    --ink-2: #b8bcc4;
    --ink-3: #868b94;

    --line: rgba(255, 255, 255, .10);
    --line-strong: rgba(255, 255, 255, .18);

    --brand-soft: #2a1615;
    --footer-bg: #0b0d10;

    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) {
        --page: #0f1115; --surface-1: #171a1f; --surface-2: #1d2127; --surface-3: #23272e;
        --ink: #f2f3f5; --ink-2: #b8bcc4; --ink-3: #868b94;
        --line: rgba(255,255,255,.10); --line-strong: rgba(255,255,255,.18);
        --brand-soft: #2a1615; --footer-bg: #0b0d10; color-scheme: dark;
    }
}

/* ---- 3) RESET & BASE ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--page);
    -webkit-font-smoothing: antialiased;
}
img, picture, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
h1, h2, h3, h4 { margin: 0 0 var(--sp-3); line-height: 1.25; font-weight: 700; }
p { margin: 0 0 var(--sp-4); }
button { font: inherit; cursor: pointer; }

img[loading="lazy"] { opacity: 0; transition: opacity .35s ease; }
img[loading="lazy"].is-loaded,
img[loading="lazy"].is-error { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
    img[loading="lazy"] { opacity: 1; transition: none; }
}

/* ---- 4) LAYOUT ----------------------------------------------------------- */
.container { width: 100%; max-width: var(--container-max); margin-inline: auto; padding-inline: var(--gutter); }
@media (max-width: 640px) {
    .container { padding-inline: var(--gutter-mobile); }
}
.site-main { padding-block: var(--sp-6); min-height: 60vh; }

/* ---- 5) COMPONENTS ------------------------------------------------------- */

/* Header — single row */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--surface-1); border-bottom: 1px solid var(--line); }
.site-header__bar { display: flex; align-items: center; gap: var(--sp-3); height: var(--header-h); }
.site-header__menu-toggle { flex-shrink: 0; }

.site-logo { font-size: 20px; font-weight: 800; white-space: nowrap; letter-spacing: .02em; display: inline-flex; align-items: baseline; flex-shrink: 0; }
.site-logo__mark { color: var(--ink); }
.site-logo__accent { color: var(--brand); }
.site-logo__dot { color: var(--brand); }

.site-search { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; }
.site-search__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.site-search__icon { position: absolute; left: 14px; color: var(--ink-3); font-size: 18px; pointer-events: none; }
.site-search__input {
    width: 100%; height: 40px; padding: 0 16px 0 40px;
    border: 1px solid var(--line); border-radius: 20px;
    background: var(--surface-2); color: var(--ink); font-size: 14px;
}
.site-search__input::placeholder { color: var(--ink-3); }
.site-search__input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.site-header__actions { display: flex; align-items: center; gap: var(--sp-1); flex-shrink: 0; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border: none; border-radius: 50%;
    background: transparent; color: var(--ink-2); font-size: 20px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* Menu panel — slides down from under the header, full header width */
.site-menu-panel {
    overflow: hidden;
    max-height: 0;
    background: var(--surface-1);
    border-bottom: 1px solid transparent;
    transition: max-height .28s ease, border-color .28s ease;
}
.site-menu-panel.is-open { max-height: 70vh; border-bottom-color: var(--line); }
.site-menu-panel__inner { padding-block: var(--sp-4); }
.site-menu-panel__nav {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--sp-2);
}
.site-menu-panel__link {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--ink);
    font-size: 15px; font-weight: 600;
    transition: background .15s ease, color .15s ease;
}
.site-menu-panel__link:hover { background: var(--brand); color: var(--brand-contrast); }
.site-menu-panel__arrow { font-size: 17px; opacity: .5; transition: opacity .15s ease, transform .15s ease; }
.site-menu-panel__link:hover .site-menu-panel__arrow { opacity: 1; transform: translateX(2px); }

.site-menu-scrim { position: fixed; inset: 0; z-index: 40; border: none; background: rgba(0,0,0,.35); }

/* Section heading */
.section-head { display: flex; align-items: center; gap: var(--sp-3); margin: var(--sp-6) 0 var(--sp-4); }
.section-head__title { font-size: 20px; }
.section-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* News cards + grid */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--card-gap); }
.news-card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden; display: block; }
.news-card:hover { border-color: var(--line-strong); }
.news-card__media { aspect-ratio: 16 / 10; background: var(--surface-3); overflow: hidden; }
.news-card__media img { width: 100%; height: 100%; object-fit: cover; }
.news-card__body { padding: var(--sp-3) var(--sp-4) var(--sp-4); }
.news-card__eyebrow { color: var(--brand); font-size: 12px; font-weight: 600; }
.news-card__title { font-size: 16px; font-weight: 700; line-height: 1.35; margin: var(--sp-1) 0 0; }
.news-card__title--hero { font-size: 26px; }
.news-card__meta { margin: var(--sp-2) 0 0; font-size: 12px; color: var(--ink-3); }
.news-card--hero { margin-bottom: var(--card-gap); }
.news-card--hero .news-card__media { aspect-ratio: 21 / 9; }

/* Footer — always dark */
.site-footer { background: var(--footer-bg); color: var(--footer-ink); margin-top: var(--sp-8); padding-block: var(--sp-6); }
.site-footer a { color: var(--footer-ink-2); }
.site-footer a:hover { color: var(--footer-ink); }
.site-footer__top { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.4fr; gap: var(--sp-5); }
.site-footer .site-logo__mark { color: var(--footer-ink); }
.site-footer__tagline { font-size: 13px; color: var(--footer-ink-2); margin: var(--sp-3) 0; max-width: 30ch; }
.site-footer__social { display: flex; gap: var(--sp-1); }
.site-footer__social .icon-btn { color: var(--footer-ink-2); }
.site-footer__social .icon-btn:hover { color: var(--footer-ink); background: rgba(255,255,255,.08); }
.site-footer__col { display: flex; flex-direction: column; gap: var(--sp-2); }
.site-footer__col a { font-size: 14px; }
.site-footer__heading { font-size: 13px; font-weight: 700; color: var(--footer-ink); text-transform: uppercase; letter-spacing: .04em; margin-bottom: var(--sp-1); }
.site-footer__app-desc { font-size: 13px; color: var(--footer-ink-2); margin: 0 0 var(--sp-3); }
.site-footer__app-btns { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.store-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--footer-line);
    border-radius: var(--radius-sm); font-size: 12px; color: var(--footer-ink-2); background: transparent; }
.store-btn:hover { color: var(--footer-ink); border-color: rgba(255,255,255,.25); }
.store-btn--accent { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }
.store-btn--accent:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--brand-contrast); }
.site-footer__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-3);
    margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--footer-line); font-size: 12px; color: var(--footer-ink-2); }
.site-footer__legal { display: flex; gap: var(--sp-4); }
@media (max-width: 720px) {
    .site-footer__top { grid-template-columns: 1fr 1fr; }
    .site-footer__brand { grid-column: 1 / -1; }
}

/* ---- 6) UTILITIES & ACCESSIBILITY --------------------------------------- */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 200; padding: 10px 16px; background: var(--brand); color: var(--brand-contrast); border-radius: 0 0 var(--radius-sm) 0; }
.skip-link:focus { left: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }

@media (max-width: 640px) {
    .site-header__actions .icon-btn:not(.theme-toggle) { display: none; }
    .site-menu-panel__nav { grid-template-columns: 1fr 1fr; }
}

/* ==========================================================================
   Membership: buttons, forms, auth modal, gender radios, user menu
   ========================================================================== */

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 18px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface-1); color: var(--ink); font-size: 14px; font-weight: 600; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn--accent { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }
.btn--accent:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--brand-contrast); }
.btn--block { width: 100%; }

/* Form fields */
.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-3); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.form-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form-input { height: 42px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface-1); color: var(--ink); font-size: 15px; }
.form-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.form-error { font-size: 12px; color: var(--danger); margin-top: 2px; }

/* Auth modal */
.auth-modal { position: fixed; inset: 0; z-index: 120; display: none; align-items: center; justify-content: center; padding: var(--sp-4); }
.auth-modal.is-open { display: flex; }
.auth-modal__scrim { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.auth-modal__dialog { position: relative; width: 100%; max-width: 420px; background: var(--surface-1);
    border-radius: 12px; padding: var(--sp-5); box-shadow: 0 20px 60px rgba(0,0,0,.25); max-height: 92vh; overflow-y: auto; }
.auth-modal__close { position: absolute; top: 10px; right: 10px; }
.auth-modal__tabs { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.auth-modal__tab { flex: 1; padding: 10px; border: none; border-bottom: 2px solid var(--line);
    background: transparent; color: var(--ink-3); font-weight: 600; }
.auth-modal__tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.auth-modal__title { font-size: 18px; margin-bottom: var(--sp-4); }
.auth-form.is-hidden { display: none; }

/* Gender radios — single row, colored by selection */
.gender-group { border: none; padding: 0; margin: 0 0 var(--sp-4); }
.gender-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); margin-top: 6px; }
.gender-option { display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 12px 6px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
    cursor: pointer; font-size: 13px; color: var(--ink-2); transition: border-color .15s, background .15s, color .15s; }
.gender-option i { font-size: 22px; }
.gender-option input { position: absolute; opacity: 0; width: 0; height: 0; }
/* Selected states, colored per gender */
.gender-option--male:has(input:checked)   { border-color: #4a90d9; background: #e7f0fb; color: #2f6fb0; }
.gender-option--female:has(input:checked) { border-color: #e0559b; background: #fbe7f1; color: #b23c7c; }
.gender-option--other:has(input:checked)  { border-color: #8a9099; background: #eceef1; color: #565b63; }
.gender-option:focus-within { box-shadow: 0 0 0 3px var(--brand-soft); }

/* User menu (logged in) */
.user-menu { position: relative; }
.user-menu__trigger { border: none; background: transparent; padding: 0; border-radius: 50%; cursor: pointer; line-height: 0; }
.user-menu__avatar { width: 32px; height: 32px; border-radius: 50%; display: block; }
.user-menu__dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px;
    background: var(--surface-1); border: 1px solid var(--line); border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 8px; display: none; z-index: 60; }
.user-menu.is-open .user-menu__dropdown { display: block; }
.user-menu__name { display: block; padding: 8px 12px; font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-menu__item { display: block; width: 100%; text-align: left; padding: 9px 12px; border: none;
    background: transparent; color: var(--ink-2); font-size: 14px; border-radius: 6px; cursor: pointer; }
.user-menu__item:hover { background: var(--surface-2); color: var(--ink); }
.user-menu__item--danger { color: var(--danger); }
.user-menu__logout { margin: 0; }