@font-face {
    font-family: "Space Grotesk";
    src: url("assets/space-grotesk-var.woff2") format("woff2");
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}

/*
   The page is dark by design, not by preference: the background is the wall
   clock read as a hex triplet, and hours cap at 23 while minutes and seconds
   cap at 59. #235959 is the brightest colour this app can ever produce, so
   light text always clears contrast and there is no second theme to build.

   Shape rule: everything is square. Corners are 0 across the whole page,
   including the round markers, which are drawn as tally squares.
*/

:root {
    --clock: #000000;
    --ink: #f4f6f5;
    --muted: rgba(244, 246, 245, .58);
    --hairline: rgba(244, 246, 245, .16);
    --accent: #ffb86b;
    --accent-ink: #14100a;
    --step: clamp(1.25rem, 3.4vw, 2.75rem);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    color-scheme: dark;
}

body {
    min-height: 100dvh;
    background: var(--clock);
    color: var(--ink);
    font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 1s linear;
}

/* A slow vignette so the flat hex reads as a lit surface rather than a fill. */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(120% 90% at 18% 12%, rgba(255, 255, 255, .10), transparent 58%),
        radial-gradient(90% 80% at 100% 100%, rgba(0, 0, 0, .45), transparent 60%);
}

/* ---------- layout ---------- */

.stage {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr;
    gap: calc(var(--step) * 1.4);
    padding: var(--step);
    align-content: center;
}

@media (min-width: 900px) {
    .stage {
        grid-template-columns: minmax(0, 1fr) 17rem;
        gap: calc(var(--step) * 2);
        padding: calc(var(--step) * 1.6) calc(var(--step) * 2);
        align-items: center;
    }
}

/* ---------- the timer ---------- */

.clock__state {
    font-size: clamp(.75rem, 1.1vw, .875rem);
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 500;
}

.clock__state[data-flash="on"] {
    animation: flash .9s steps(1, end) 3;
}

@keyframes flash {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: .25;
    }
}

.clock__time {
    font-size: clamp(5rem, 21vw, 15rem);
    font-weight: 500;
    line-height: .86;
    letter-spacing: -.045em;
    font-variant-numeric: tabular-nums;
    margin: .12em 0 .18em -.03em;
}

.clock__track {
    height: 3px;
    background: var(--hairline);
    max-width: 46rem;
}

.clock__fill {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width .95s linear;
}

.clock__controls {
    display: flex;
    flex-wrap: wrap;
    gap: .625rem;
    margin-top: calc(var(--step) * .9);
}

.clock__hint {
    margin-top: 1rem;
    font-size: .8125rem;
    color: var(--muted);
}

@media (hover: none) {
    .clock__hint {
        display: none;
    }
}

/* ---------- buttons ---------- */

.btn {
    font: inherit;
    font-size: .9375rem;
    font-weight: 500;
    letter-spacing: .02em;
    color: var(--ink);
    background: transparent;
    border: 1px solid var(--hairline);
    border-radius: 0;
    padding: .8125rem 1.5rem;
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease, transform .08s ease;
}

.btn:hover {
    border-color: var(--ink);
}

.btn:active {
    transform: translateY(1px);
}

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
    min-width: 8.5rem;
}

.btn--primary:hover {
    background: #ffc98d;
    border-color: #ffc98d;
}

.btn--quiet {
    padding: .5rem .875rem;
    font-size: .8125rem;
    color: var(--muted);
    align-self: start;
}

.btn--quiet:hover {
    color: var(--ink);
}

.btn--quiet[aria-pressed="true"] {
    color: var(--accent);
    border-color: var(--accent);
}

/* ---------- side rail ---------- */

.rail {
    display: grid;
    gap: calc(var(--step) * .95);
    align-content: start;
    font-size: .875rem;
}

@media (min-width: 900px) {
    .rail {
        border-left: 1px solid var(--hairline);
        padding-left: calc(var(--step) * 1.1);
    }
}

.rail__label {
    font-size: .6875rem;
    font-weight: 500;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: .625rem;
}

.rail__note {
    color: var(--muted);
    font-size: .8125rem;
    line-height: 1.55;
    margin-top: .5rem;
    max-width: 32ch;
}

.rail__hex {
    font-size: 1.375rem;
    font-weight: 500;
    letter-spacing: .02em;
    font-variant-numeric: tabular-nums;
}

.tally {
    display: flex;
    gap: .375rem;
}

.tally__mark {
    width: 1.75rem;
    height: .5rem;
    background: var(--hairline);
    transition: background-color .3s ease;
}

.tally__mark[data-done="true"] {
    background: var(--accent);
}

.spec {
    display: grid;
    gap: .375rem;
}

.spec__row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted);
}

.spec__row dd {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {

    body,
    .clock__fill,
    .tally__mark,
    .btn {
        transition: none;
    }

    .clock__state[data-flash="on"] {
        animation: none;
    }
}
