/* static/css/stopwatch/stopwatch.css
   Stopwatch — premium minimalist "audiophile instrument" faceplate.
   Tap / beep / flash behaviour is wired in stopwatch.js (step 5);
   this file is the visual shell and its running / paused / flash states. */

:root {
    --sw-bg:        #08080a;
    --sw-panel-a:   #18181c;
    --sw-panel-b:   #0e0e10;
    --sw-line:      rgba(255, 255, 255, 0.09);
    --sw-line-soft: rgba(255, 255, 255, 0.05);
    --sw-ink:       #f5f5f7;   /* primary readout — bright */
    --sw-ink-2:     #c4c4cd;   /* labels — still bright, never faint */
    --sw-amber:     #f0a830;   /* tube-glow accent */
    --sw-amber-hi:  #ffc663;
    --sw-glow:      rgba(240, 168, 48, 0.55);
}

/* ---- stage ---- */
.sw-stage {
    min-height: calc(100vh - 160px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    background:
        radial-gradient(120% 90% at 50% 18%, #131318 0%, var(--sw-bg) 62%);
}

/* ---- faceplate ---- */
.sw-panel {
    position: relative;
    width: 100%;
    max-width: 432px;
    padding: 30px 30px 22px;
    border: 1px solid var(--sw-line);
    border-radius: 20px;
    background: linear-gradient(165deg, var(--sw-panel-a), var(--sw-panel-b));
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.06) inset,
        0 0 0 1px rgba(0, 0, 0, 0.4),
        0 38px 90px -34px rgba(0, 0, 0, 0.85);
    font-family: 'Chivo Mono', ui-monospace, 'SFMono-Regular', monospace;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    user-select: none;
    animation: sw-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

/* brushed hairline along the top edge */
.sw-panel::before {
    content: "";
    position: absolute;
    inset: 0 18% auto;
    top: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
}

/* ---- header ---- */
.sw-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: sw-rise 0.6s 0.05s both;
}

.sw-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--sw-ink-2);
}

.sw-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4a4a52;
    box-shadow: 0 0 0 0 rgba(240, 168, 48, 0);
    transition: background 0.25s ease, box-shadow 0.25s ease;
}

.sw-status {
    font-size: 0.66rem;
    font-weight: 400;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--sw-ink-2);
    transition: color 0.25s ease;
}

/* ---- readout ---- */
.sw-readout {
    margin: 26px 0 24px;
    text-align: center;
    line-height: 1;
    color: var(--sw-ink);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    transition: text-shadow 0.3s ease, color 0.3s ease;
    animation: sw-rise 0.6s 0.1s both;
}

.sw-main {
    font-size: clamp(3.4rem, 15vw, 5.1rem);
    font-weight: 300;
    letter-spacing: -0.02em;
}

.sw-cs {
    font-size: clamp(1.5rem, 6vw, 2.1rem);
    font-weight: 400;
    letter-spacing: 0;
    color: var(--sw-amber);
    margin-left: 0.06em;
}

/* ---- beep control ---- */
.sw-beep {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    border: 1px solid var(--sw-line-soft);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.015);
    animation: sw-rise 0.6s 0.15s both;
}

.sw-beep-label {
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--sw-ink-2);
}

.sw-beep-set {
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.sw-beep-val {
    min-width: 4ch;
    text-align: center;
    font-size: 1.06rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--sw-ink);
    font-variant-numeric: tabular-nums;
}

.sw-step {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--sw-line);
    border-radius: 9px;
    background: linear-gradient(165deg, #1d1d21, #141417);
    color: var(--sw-ink-2);
    font-family: inherit;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease, transform 0.08s ease;
}

.sw-step:hover {
    color: var(--sw-amber-hi);
    border-color: rgba(240, 168, 48, 0.4);
}

.sw-step:active {
    transform: scale(0.92);
}

/* ---- footer ---- */
.sw-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 18px;
    animation: sw-rise 0.6s 0.2s both;
}

.sw-hint {
    font-size: 0.66rem;
    font-weight: 400;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--sw-ink-2);
    transition: color 0.25s ease;
}

.sw-foot-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* version switch (Pro / Lite) — same engraved control as Reset,
   but hovers amber to mark it as the doorway to the other version */
.sw-switch {
    padding: 6px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #7e7e88;
    font-size: 0.64rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    text-decoration: none;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.sw-switch:hover {
    color: var(--sw-amber-hi);
    border-color: rgba(240, 168, 48, 0.4);
}

.sw-reset {
    padding: 6px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: none;
    color: #7e7e88;
    font-family: inherit;
    font-size: 0.64rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.sw-reset:hover {
    color: var(--sw-ink);
    border-color: var(--sw-line);
}

/* ---- running / paused states (toggled by JS in step 5) ---- */
.sw-panel.is-running .sw-dot {
    background: var(--sw-amber);
    box-shadow: 0 0 12px 1px var(--sw-glow);
    animation: sw-breathe 1.6s ease-in-out infinite;
}

.sw-panel.is-running .sw-status,
.sw-panel.is-running .sw-hint {
    color: var(--sw-amber);
}

.sw-panel.is-running .sw-readout {
    text-shadow: 0 0 26px var(--sw-glow);
}

.sw-panel.is-paused .sw-dot {
    background: var(--sw-amber);
    opacity: 0.6;
}

.sw-panel.is-paused .sw-status {
    color: var(--sw-amber-hi);
}

/* ---- full-viewport alert flash (toggled 3x by JS) ---- */
.sw-flash {
    position: fixed;
    inset: 0;
    z-index: 60;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(circle at 50% 42%, var(--sw-amber-hi), var(--sw-amber) 65%);
    transition: opacity 0.16s ease-out;
}

.sw-flash.on {
    opacity: 0.92;
    transition: opacity 0.04s ease-in;
}

/* ---- motion ---- */
@keyframes sw-rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

@keyframes sw-breathe {
    0%, 100% { box-shadow: 0 0 9px 0 var(--sw-glow); }
    50%      { box-shadow: 0 0 16px 3px var(--sw-glow); }
}

/* ---- 480px: minimum padding ---- */
@media (max-width: 480px) {
    .sw-stage {
        padding: 0;
        min-height: calc(100vh - 120px);
    }
    .sw-panel {
        max-width: 100%;
        border-radius: 0;
        padding: 22px 14px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sw-panel,
    .sw-head,
    .sw-readout,
    .sw-beep,
    .sw-foot {
        animation: none;
    }
    .sw-panel.is-running .sw-dot {
        animation: none;
    }
}
