/**
 * access.css — WaveCtl access experience (/login/).
 *
 * Shared presentation for the three access screens:
 *   index.php   — RACE OPERATIONS   (access path selection)
 *   admin.php   — RACE DIRECTOR     (control access)
 *   zone.php    — ACCESS GATEWAY    (unified passkey gateway)
 *
 * Full-screen operational environment. No floating card, no SaaS chrome.
 * The viewport itself is the interface: strong typography, generous
 * negative space, restrained cyan accent, subtle structural rules.
 *
 * Reads every colour, font, radius and spacing value from the tokens
 * defined in style.css / brand.css, so a client theme in brand.css
 * flows through automatically.
 *
 * All three screens adopt the athlete door's visual language:
 *   · section 14 — shape and spacing (uppercase titles, soft radial
 *     glow, the door's underline inputs and pill CTA)
 *   · section 15 — the door's accents (amber eyebrow, pill CTA with
 *     the arrow and soft glow, event-block footer)
 * Every flow, DOM id and AJAX contract is untouched.
 *
 * None of the three screens carries a brand rail: the identity block
 * IS the header, as on the athlete door. The .access-brand rules
 * remain (unused) for any future screen that wants a rail.
 */

/* ================================================================
   1. Shell
   ================================================================ */
.access-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--surface-body);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.access-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    box-sizing: border-box;
    padding:
        clamp(20px, 5vh, 52px)
        clamp(20px, 5vw, 40px)
        clamp(24px, 5vh, 48px);
}

/* ================================================================
   2. Brand rail
   ----------------------------------------------------------------
   Not used by any of the three /login/ screens (they carry the
   identity block as their header, as on the athlete door). Kept
   for any future screen that wants a rail.
   ================================================================ */
.access-brand {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--spacing-md);
    padding-bottom: clamp(20px, 4vh, 40px);
    border-bottom: 1px solid var(--border-default);
    margin-bottom: clamp(28px, 6vh, 56px);
}
.access-brand-mark {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(22px, 3vw, 26px);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-primary);
    line-height: 1;
}
.access-brand-mark em {
    font-style: normal;
    color: var(--action-primary);
}
.access-brand-meta {
    font-size: 10px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

/* ================================================================
   3. Identity block (headings)
   ================================================================ */
.access-identity {
    margin-bottom: clamp(28px, 6vh, 44px);
}
.access-eyebrow {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--action-primary);
    margin-bottom: 10px;
}
.access-title {
    font-family: var(--font-display);
    font-size: clamp(34px, 7vw, 56px);
    line-height: 0.95;
    letter-spacing: 0.01em;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-primary);
    margin: 0 0 10px;
}
.access-subtitle {
    font-size: clamp(13px, 1.4vw, 15px);
    line-height: 1.5;
    color: var(--text-muted);
    max-width: 46ch;
    margin: 0;
}

/* ================================================================
   4. Access path selection (index.php)
   ================================================================ */
.access-paths {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 600px) {
    .access-paths { grid-template-columns: 1fr 1fr; gap: var(--spacing-md); }
}
.access-path {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 22px 20px;
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
    min-height: 96px;
}
.access-path:hover,
.access-path:focus-visible {
    border-color: var(--action-primary);
    background: var(--action-primary-bg);
    outline: none;
}
.access-path-label {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1;
}
.access-path-desc {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}
.access-path-meta {
    margin-top: auto;
    padding-top: 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
}

/* ================================================================
   5. Forms
   ================================================================ */
.access-form { display: block; }
.access-field { margin-bottom: 18px; }
.access-field-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.access-input {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 16px;
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 16px;
    line-height: 1.2;
    outline: none;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}
.access-input::placeholder { color: var(--text-disabled); opacity: 0.55; }
.access-input:hover { border-color: var(--border-active); }
.access-input:focus {
    border-color: var(--action-primary);
    background: var(--action-primary-bg);
    box-shadow: none;
}
.access-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 520px) {
    .access-field-row { grid-template-columns: 1fr; gap: 0; }
}

/* ================================================================
   6. Passkey (OTP) — zone.php step 1
   ================================================================ */
.access-otp {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: var(--spacing-lg);
}
.access-otp.is-verifying {
    opacity: 0.55;
    pointer-events: none;
}
.access-otp-box {
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border-active);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: clamp(24px, 6vw, 34px);
    font-weight: 700;
    text-align: center;
    outline: none;
    box-shadow: none;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
    -webkit-appearance: none;
    appearance: none;
}
.access-otp-box:hover { border-color: var(--border-active); }
.access-otp-box:focus {
    border-color: var(--action-primary);
    background: var(--action-primary-bg);
    box-shadow: none;
}
.access-otp-box.is-filled {
    border-color: var(--text-secondary);
}
.access-otp-box:focus.is-filled,
.access-otp-box:focus {
    border-color: var(--action-primary);
}

/* ================================================================
   7. Primary action
   ================================================================ */
.access-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 18px 20px;
    background: var(--action-primary);
    color: var(--text-inverse);
    border: 0;
    border-radius: var(--radius-sm);
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color var(--transition-fast), opacity var(--transition-fast);
    min-height: 56px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.access-submit:hover { background: var(--color-secondary-hover); }
.access-submit:active {
    background: var(--color-secondary-active);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.access-submit:focus-visible {
    outline: 2px solid var(--action-primary);
    outline-offset: 3px;
}
.access-submit:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

/* ================================================================
   8. Validation
   ================================================================ */
.access-error {
    padding: 10px 14px;
    margin-bottom: var(--spacing-md);
    background: var(--state-danger-bg);
    border-left: 2px solid var(--state-danger);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.4;
}
.access-error[hidden] { display: none !important; }

/* ================================================================
   9. Secondary action (back / re-enter)
   ================================================================ */
.access-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    margin-bottom: var(--spacing-md);
    background: none;
    border: 0;
    color: var(--text-muted);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: color var(--transition-fast);
}
.access-back:hover { color: var(--text-primary); }

/* ================================================================
   10. Footer / system status
   ----------------------------------------------------------------
   Base rules. Section 15 restyles the footer per screen (event
   block, back link) — these are the fallback for anything that
   carries .access-footer without a screen modifier.
   ================================================================ */
.access-footer {
    margin-top: auto;
    padding-top: clamp(24px, 4vh, 40px);
    border-top: 1px solid var(--border-soft);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--spacing-md);
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.access-footer-mark { font-weight: 700; color: var(--text-secondary); }
.access-footer-meta { font-family: var(--font-mono); letter-spacing: 0.04em; }
.access-footer .access-back {
    margin: 0;
    padding: 0;
}

/* ================================================================
   11. Page-specific modifiers
   ================================================================ */

/* index.php — larger title because there is no form. */
.access-screen--paths .access-title {
    font-size: clamp(38px, 8vw, 64px);
}

/* admin.php — the Race Director entry carries an amber accent to
   distinguish it from the other gateways, without changing the
   overall visual language. Kept: section 14 relies on it and does
   not override the eyebrow colour for --director. */
.access-screen--director .access-eyebrow {
    color: var(--state-warning);
}

/* ================================================================
   12. Small-screen refinements
   ================================================================ */
@media (max-width: 520px) {
    .access-otp { gap: 10px; }
    .access-footer { flex-direction: column; align-items: flex-start; gap: 6px; }
}

@media (max-width: 380px) {
    .access-screen {
        padding-left: 16px;
        padding-right: 16px;
    }
    .access-otp { gap: 8px; }
}

/* ================================================================
   13. Reduced motion
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
    .access-path,
    .access-input,
    .access-otp-box,
    .access-submit,
    .access-back { transition: none; }
}

/* ================================================================
   14. The /login/ screens — the athlete door's shape and spacing
   ----------------------------------------------------------------
   index.php   (.access-screen--paths)
   admin.php   (.access-screen--director)
   zone.php    (.access-screen--gateway)

   All three carry a shared ops-console look by default. This
   section brings them onto the same visual footing as the athlete
   door (athlete-app.css .aa-door-*): uppercase titles, a soft
   radial glow, the door's underline inputs and its pill CTA.

   Presentation only. Every flow, DOM id and AJAX contract on all
   three screens is untouched.

   Two things stay per-screen and are called out below:
     · admin.php keeps its amber eyebrow (section 11) — the Race
       Director door's one distinguishing cue.
     · index.php's path cards keep the door's rounded card shape
       but read as two large targets, not form fields.

   Tokens only — no hex, no sizes outside the scale.
   ================================================================ */

/* ── Shell: the three screens share one column and one horizon ── */
.access-screen--paths,
.access-screen--director,
.access-screen--gateway {
    position: relative;
    max-width: 480px;
}

.access-screen--paths::before,
.access-screen--director::before,
.access-screen--gateway::before {
    content: "";
    position: absolute;
    inset: 0;
    height: 320px;
    background: radial-gradient(
        ellipse at 50% 0%,
        var(--action-primary-bg),
        transparent 70%
    );
    pointer-events: none;
    z-index: 0;
}

.access-screen--paths > *,
.access-screen--director > *,
.access-screen--gateway > * { position: relative; z-index: 1; }

/* None of the three screens carries a brand rail — the identity
   block IS the header, as on the athlete door. Give it the top
   space the rail used to hold. */
.access-screen--paths,
.access-screen--director,
.access-screen--gateway {
    padding-top: clamp(48px, 14vh, 140px);
}

/* ── Identity block ───────────────────────────────────────────
   Uppercase display title, as on the athlete door. */
.access-screen--paths .access-identity,
.access-screen--director .access-identity,
.access-screen--gateway .access-identity {
    margin-bottom: clamp(24px, 5vh, 36px);
}

.access-screen--paths .access-title,
.access-screen--director .access-title,
.access-screen--gateway .access-title {
    text-transform: uppercase;
    font-size: clamp(34px, 7vw, 52px);
    line-height: 0.95;
    letter-spacing: 0.01em;
    font-weight: 800;
    margin: 0 0 14px;
}

/* index.php's title is the only one with no form under it; give it
   a touch more presence, as its own modifier did before. */
.access-screen--paths .access-title {
    font-size: clamp(38px, 8vw, 60px);
    line-height: 0.95;
}

.access-screen--paths .access-eyebrow,
.access-screen--director .access-eyebrow,
.access-screen--gateway .access-eyebrow {
    letter-spacing: 0.28em;
    margin-bottom: 12px;
}

/* admin.php's eyebrow keeps its amber (section 11); the other two
   use the calmer muted tone. (Section 15 raises these two to the
   door's amber.) */
.access-screen--paths .access-eyebrow,
.access-screen--gateway .access-eyebrow {
    color: var(--text-muted);
}

.access-screen--paths .access-subtitle,
.access-screen--director .access-subtitle,
.access-screen--gateway .access-subtitle {
    font-size: clamp(14px, 1.5vw, 16px);
    line-height: 1.55;
    color: var(--text-secondary);
    max-width: 34ch;
    margin: 0;
}

/* ── Fields (admin.php, zone.php) ─────────────────────────────
   The door's underline: no box, no fill, a single bottom rule.
   The label above keeps its uppercase letterspaced treatment. */
.access-screen--director .access-field,
.access-screen--gateway .access-field { margin-bottom: 22px; }

.access-screen--director .access-field-label,
.access-screen--gateway .access-field-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.access-screen--director .access-input,
.access-screen--gateway .access-input {
    width: 100%;
    box-sizing: border-box;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border-default);
    border-radius: 0;
    padding: 8px 0 12px;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 17px;
    line-height: 1.2;
    outline: none;
    transition: border-color var(--transition-fast);
}
.access-screen--director .access-input:hover,
.access-screen--gateway .access-input:hover {
    border-bottom-color: var(--border-active);
}
.access-screen--director .access-input:focus,
.access-screen--gateway .access-input:focus {
    background: transparent;
    border-bottom-color: var(--action-primary);
    box-shadow: none;
}
.access-screen--director .access-input::placeholder,
.access-screen--gateway .access-input::placeholder {
    color: var(--text-disabled);
    opacity: 0.55;
}

/* ── OTP boxes (zone.php step 1) ──────────────────────────────
   Kept as boxes: a 4-digit passkey is easier to tap in a square
   than on an underline. Same radius family as the door's CTA. */
.access-screen--gateway .access-otp {
    gap: 12px;
    margin-bottom: clamp(24px, 4vh, 32px);
}
.access-screen--gateway .access-otp-box {
    border-radius: var(--radius-md);
    background: var(--surface-card);
    border-color: var(--border-default);
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}
.access-screen--gateway .access-otp-box:hover {
    border-color: var(--border-active);
}
.access-screen--gateway .access-otp-box:focus,
.access-screen--gateway .access-otp-box:focus.is-filled {
    border-color: var(--action-primary);
    background: var(--surface-card);
    box-shadow: none;
}
.access-screen--gateway .access-otp-box.is-filled {
    border-color: var(--text-secondary);
    background: var(--surface-card);
}

/* ── Path cards (index.php) ───────────────────────────────────
   Rounded, on the card surface, and taller than a form field. Two
   columns once there is room. */
.access-screen--paths .access-paths {
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 600px) {
    .access-screen--paths .access-paths {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-md);
    }
}
.access-screen--paths .access-path {
    padding: 22px 20px;
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    min-height: 120px;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}
.access-screen--paths .access-path:hover,
.access-screen--paths .access-path:focus-visible {
    border-color: var(--action-primary);
    background: var(--surface-card);
    outline: none;
}
.access-screen--paths .access-path-label {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.15;
}
.access-screen--paths .access-path-desc {
    font-size: 13px;
    color: var(--text-secondary);
    letter-spacing: 0;
    margin-top: 6px;
}
.access-screen--paths .access-path-meta {
    margin-top: auto;
    padding-top: 14px;
    font-family: var(--font-primary);
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: none;
}

/* ── Submit (admin.php, zone.php) ─────────────────────────────
   Rounded CTA, eased letterspacing, no inset shadow. */
.access-screen--director .access-submit,
.access-screen--gateway .access-submit {
    border-radius: var(--radius-md);
    letter-spacing: 0.08em;
    min-height: 54px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: none;
}
.access-screen--director .access-submit:hover,
.access-screen--gateway .access-submit:hover {
    background: var(--color-secondary-hover);
}
.access-screen--director .access-submit:active,
.access-screen--gateway .access-submit:active {
    background: var(--color-secondary-active);
    box-shadow: none;
}

/* ── Errors (admin.php, zone.php) ─────────────────────────────
   Softer radius and padding, matching the door. */
.access-screen--director .access-error,
.access-screen--gateway .access-error {
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.45;
}

/* ── Small screens ──────────────────────────────────────────── */
@media (max-width: 520px) {
    .access-screen--paths .access-title,
    .access-screen--director .access-title,
    .access-screen--gateway .access-title {
        font-size: clamp(30px, 9vw, 42px);
    }
    .access-screen--gateway .access-otp { gap: 10px; }
    .access-screen--paths,
    .access-screen--director,
    .access-screen--gateway {
        padding-top: clamp(40px, 10vh, 80px);
    }
}
@media (max-width: 380px) {
    .access-screen--gateway .access-otp { gap: 8px; }
}

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .access-screen--paths .access-path,
    .access-screen--director .access-input,
    .access-screen--gateway .access-input,
    .access-screen--gateway .access-otp-box,
    .access-screen--director .access-submit,
    .access-screen--gateway .access-submit {
        transition: none;
    }
}

/* ================================================================
   15. The /login/ screens — the athlete door's accents
   ----------------------------------------------------------------
   Section 14 brought the /login/ screens to the door's shape and
   spacing. This section adopts the door's remaining cues — the
   amber eyebrow, the pill CTA with the arrow and soft glow, and the
   event-block footer.

   Presentation only. No markup or JS changes.
   ================================================================ */

/* ── Eyebrow: amber, as the door has ─────────────────────────
   The door's eyebrow is the event/role accent. Pull the /login/
   screens onto the same accent. admin.php's amber (section 11) is
   already the same tone, so this just makes the other two match. */
.access-screen--paths .access-eyebrow,
.access-screen--gateway .access-eyebrow {
    color: var(--action-primary);
}

/* ── Submit: pill with arrow, soft outer glow ────────────────
   The door's CTA is a rounded pill with an arrow on the right and
   a soft amber glow beneath it. Reproduce that here. The existing
   markup is a plain <button> with text; the arrow is added with
   a ::after so no HTML changes. */
.access-screen--director .access-submit,
.access-screen--gateway .access-submit {
    position: relative;
    border-radius: var(--radius-pill, 999px);
    padding: 18px 56px 18px 24px;
    text-align: left;
    justify-content: flex-start;
    font-size: 14px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04),
        0 8px 28px -8px var(--action-primary);
}
.access-screen--director .access-submit::after,
.access-screen--gateway .access-submit::after {
    content: "\2192";                 /* → */
    position: absolute;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    line-height: 1;
    opacity: 0.85;
}

/* ── Footer: the door's three-line event block ───────────────
   The athlete door's footer is a small block — event name, date,
   "Powered by WaveCTL" — with the back action beside it. Adopt
   that shape: the brand mark is a line, not a lone uppercase stamp. */
.access-screen--paths .access-footer,
.access-screen--director .access-footer,
.access-screen--gateway .access-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--spacing-md);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* The event block: name, date, brand — stacked, left-aligned. */
.access-footer-event {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.access-footer-event strong {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-primary);
}
.access-footer-event span {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.access-footer-event em {
    font-style: normal;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0.75;
}

/* The back action sits to the right of the event block, aligned
   to its baseline. */
.access-screen--paths .access-footer .access-back,
.access-screen--director .access-footer .access-back,
.access-screen--gateway .access-footer .access-back {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.access-screen--paths .access-footer .access-back:hover,
.access-screen--director .access-footer .access-back:hover,
.access-screen--gateway .access-footer .access-back:hover {
    color: var(--text-primary);
}

/* On narrow screens the footer stacks: event block on top, back
   action below, as on the door. */
@media (max-width: 520px) {
    .access-screen--paths .access-footer,
    .access-screen--director .access-footer,
    .access-screen--gateway .access-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}
