/**
 * 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    — JUDGE ACCESS      (unified judge 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.
 */

/* ================================================================
   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
   ================================================================ */
.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. Detected access context (zone.php step 2)
   ---------------------------------------------------------------
   This block is the heading of step 2. In the previous pass it sat
   under an identity title that repeated the same detection; that
   duplicated the message and split the visual weight across two
   headings.
   Here it stands alone: a compact "Detected" eyebrow above the
   context block gives step 2 a single anchor to land on.
   ================================================================ */
.access-context {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 0 16px 18px;
    border-left: 3px solid var(--action-primary);
    margin-top: 4px;
    margin-bottom: clamp(24px, 5vh, 36px);
}
.access-context[hidden] { display: none !important; }
.access-context-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.access-context-value {
    font-family: var(--font-display);
    font-size: clamp(26px, 4.4vw, 34px);
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-primary);
    line-height: 1.02;
}
.access-context-meta {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
}

/* ================================================================
   11. Footer / system status
   ================================================================ */
.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;
}

/* ================================================================
   12. 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 judge gateways, without changing the
   overall visual language. */
.access-screen--director .access-eyebrow {
    color: var(--state-warning);
}

/* zone.php step 2 — the identity block's title duplicates what the
   context block already says ("STATION JUDGE" above "ZONE / 1000M
   ROW"). Demote it: keep the "Detected" eyebrow as the step's
   confirmatory label, drop the title to a small caption, and let the
   cyan-ruled context block below it carry the heading weight.
   #accessTitle stays in the DOM because the JS still writes to it;
   it just renders as a small line, not a competing headline. */
.access-screen--gateway .access-identity--detected {
    margin-bottom: 0;
}
.access-screen--gateway .access-identity--detected .access-eyebrow {
    margin-bottom: 6px;
}
.access-screen--gateway .access-identity--detected .access-title {
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-secondary);
    line-height: 1.2;
    margin: 0 0 16px;
}
.access-screen--gateway .access-identity--detected .access-subtitle {
    display: none;
}

/* ================================================================
   13. 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; }
}

/* ================================================================
   14. Reduced motion
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
    .access-path,
    .access-input,
    .access-otp-box,
    .access-submit,
    .access-back { transition: none; }
}
