/* lockpad.io: a dark, precise launch page. Blue-black ink, one brass-gold accent, Geist
   throughout. The dial is the page. */

@font-face {
    font-family: 'Geist';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(/fonts/geist-latin-wght-normal.woff2) format('woff2-variations');
}

/* Registered so the drift can animate them; JS sets them in px to follow a mouse. */
@property --x { syntax: '<length-percentage>'; inherits: true; initial-value: 50%; }
@property --y { syntax: '<length-percentage>'; inherits: true; initial-value: 40%; }

:root {
    --ink-0: oklch(0.145 0.012 265);
    --ink-1: oklch(0.185 0.014 265);
    --ink-2: oklch(0.225 0.016 265);
    --ink-3: oklch(0.3 0.018 265);
    --ink-4: oklch(0.42 0.018 265);
    --hairline: oklch(1 0 0 / 0.07);
    --text: oklch(0.965 0.004 265);
    --text-2: oklch(0.76 0.012 265);
    --text-3: oklch(0.66 0.014 265);
    --gold: oklch(0.84 0.125 84);
    --gold-ink: oklch(0.3 0.06 75);
    --dot: oklch(1 0 0 / 0.1);
    --dot-lit: oklch(0.84 0.125 84 / 0.55);

    --gutter: clamp(1rem, 4vw, 3.5rem);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

    color-scheme: dark;
}

* { box-sizing: border-box; }

html {
    background: var(--ink-0);
    scrollbar-color: var(--ink-3) var(--ink-0);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100svh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    font-family: 'Geist', system-ui, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

p { margin: 0; }

::selection { background: var(--gold); color: var(--gold-ink); }

/* The dot field: dim everywhere, lit in gold around the pointer --------------------------- */

.field {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(circle, var(--dot) 1px, transparent 1.4px) 0 0 / 24px 24px;
    mask: radial-gradient(120% 95% at 50% 40%, #000 35%, transparent 100%);
}

.field::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, var(--dot-lit) 1px, transparent 1.5px) 0 0 / 24px 24px;
    mask: radial-gradient(15rem circle at var(--x) var(--y), #000, transparent);
}

/* With no pointer to follow, the light leaves its rest behind the dial, drifts through the open
   ground twice, and returns there. */
@media (hover: none) {
    .motion .field::after { animation: drift 20s ease-in-out 2; }
}

@keyframes drift {
    from, to { --x: 50%; --y: 40%; }
    25% { --x: 12%; --y: 12%; }
    50% { --x: 88%; --y: 14%; }
    75% { --x: 50%; --y: 88%; }
}

/* Top bar ------------------------------------------------------------------------------------ */

.bar,
.foot {
    width: 100%;
    max-width: 80rem;
    margin-inline: auto;
}

.bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem var(--gutter);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 1.1875rem;
    font-weight: 620;
    letter-spacing: -0.025em;
}

.mark { width: 1.35rem; height: 1.35rem; }
.mark__pad { fill: var(--gold); fill-rule: evenodd; }

.status {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.3rem 0.8rem 0.3rem 0.65rem;
    border-radius: 999px;
    background: var(--ink-1);
    box-shadow: inset 0 0 0 1px var(--hairline);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-2);
}

.status__dot {
    position: relative;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--gold);
}

/* The dot pings three times once the dial has unlocked, then rests. */
.unlocked .status__dot::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--gold);
    animation: ping 2.4s var(--ease-out) 0.4s 3 both;
}

@keyframes ping {
    from { transform: scale(1); opacity: 0.6; }
    40%, to { transform: scale(2.8); opacity: 0; }
}

/* Hero --------------------------------------------------------------------------------------- */

.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(0.5rem, 3vh, 2.5rem) var(--gutter) clamp(2rem, 6vh, 4rem);
    text-align: center;
}

h1 {
    margin: clamp(1.5rem, 4vh, 2.75rem) 0 0;
    font-size: clamp(2.5rem, min(1rem + 7.4vw, 6.8svh), 4.75rem);
    font-weight: 640;
    line-height: 1.02;
    letter-spacing: -0.032em;
    text-wrap: balance;
}

.words { display: flex; flex-direction: column; align-items: center; }

.lede span { display: block; }
.lede .keep { display: inline; white-space: nowrap; }

.lede {
    max-width: 30rem;
    margin-top: clamp(0.9rem, 1.8vw, 1.25rem);
    font-size: clamp(1.0625rem, 1.25vw, 1.1875rem);
    line-height: 1.6;
    color: var(--text-2);
    text-wrap: balance;
}

@media (max-width: 22.5rem) {
    .lede { font-size: 1rem; }
}

/* The dial ------------------------------------------------------------------------------------ */

.dial {
    position: relative;
    width: min(52vh, 82vw, 36rem);
    width: min(52svh, 82vw, 36rem);
    min-width: 15rem;
    aspect-ratio: 1;
    container-type: inline-size;
}

@media (max-width: 30rem) {
    .dial { width: min(52vh, 90vw, 36rem); width: min(52svh, 90vw, 36rem); }
}

/* On a small dial the digits grow, so they stay legible; at radius 152 there is room. */
@container (max-width: 420px) {
    .dial__digit { font-size: 13px; }
}

@container (max-width: 340px) {
    .dial__digit { font-size: 15px; }
}

@container (max-width: 290px) {
    .dial__digit { font-size: 16px; }
}

/* The dial's shadow, on a circle the size of its face (r196 of a 420 box), so the SVG's
   moving rings never have to be re-filtered. */
.dial::before {
    content: '';
    position: absolute;
    inset: calc(50% - 46.67%);
    border-radius: 50%;
    box-shadow: 0 24px 48px -8px oklch(0 0 0 / 0.55), 0 2px 6px oklch(0 0 0 / 0.35);
}

.dial__svg { display: block; width: 100%; height: 100%; overflow: visible; user-select: none; }

.ring { transition: opacity 0.8s var(--ease-out); }

.dial__face { fill: url(#face); }
.dial__face-lit { stop-color: var(--ink-2); }
.dial__face-rim { stop-color: oklch(0.165 0.013 265); }
.dial__hairline { fill: none; stroke: url(#rim); stroke-width: 1.25; }
.dial__rim-top { stop-color: oklch(1 0 0 / 0.16); }
.dial__rim-bottom { stop-color: oklch(1 0 0 / 0.07); }
/* Every tick ends at r 188.5; the larger ones reach further in. */
.dial__ticks { fill: none; stroke: var(--ink-4); stroke-width: 7; }
.dial__ticks--major { stroke: var(--text-3); stroke-width: 11; }
.dial__ticks--zero { stroke: var(--text-2); stroke-width: 15; }
.dial__arcs { fill: none; stroke: var(--ink-3); stroke-width: 3; stroke-linecap: round; }
.dial__dots { fill: none; stroke: var(--ink-4); stroke-width: 3; stroke-linecap: round; }
.dial__ticks, .dial__dots { opacity: calc(1 - 0.7 * var(--spin, 0)); }
/* The fine ticks, 3° apart, would freeze or crawl at any turning speed, so they fade out entirely. */
.dial__ticks:not(.dial__ticks--major, .dial__ticks--zero) { opacity: calc(1 - var(--spin, 0)); }

.dial__digit {
    font-size: 11px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    fill: var(--text-3);
    text-anchor: middle;
    dominant-baseline: central;
}

/* The notches and the caret they line up with. */
.dial__notch,
.dial__notch-dot,
.dial__caret { fill: var(--gold); }
.dial__caret { stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; transition: transform 0.16s var(--ease-out); }
.dial__caret.is-click { transform: translateY(2px); }
.dial__digit--zero { fill: var(--gold); font-weight: 650; transition: fill 0.25s var(--ease-out); }

/* Each number of the combination lights at the caret while the dial rests on it. */
.dial__digit { transition: fill 0.2s var(--ease-out), font-weight 0.2s var(--ease-out); }
.dial__digit.is-picked { fill: var(--gold); font-weight: 650; }

.dial__core {
    fill: var(--ink-1);
    stroke: url(#rim);
    stroke-width: 1.25;
}
.dial__mark { fill: var(--gold); fill-rule: evenodd; transition: fill 0.6s var(--ease-out); }

/* One ring of gold leaves the core when the dial unlocks. */
.dial__pulse { fill: none; stroke: var(--gold); stroke-width: 1.25; vector-effect: non-scaling-stroke; opacity: 0; transform-origin: 0 0; }
.unlocked .dial__pulse { animation: pulse 1.6s var(--ease-out) forwards; }

@keyframes pulse {
    from { opacity: 0.7; transform: scale(1); }
    to { opacity: 0; transform: scale(3.1); }
}

/* Each ring's notch lights as that ring lands on the caret, so the gold line builds itself. */
.dial__notch, .dial__notch-dot { transition: fill 0.25s var(--ease-out); }
.motion .ring:not(.is-set) :is(.dial__notch, .dial__notch-dot) { fill: var(--ink-4); }
.motion .ring:not(.is-set) .dial__digit--zero { fill: var(--text-3); }

/* While locked, the mark waits dim; dial.mjs scatters the rings and spins them into line. */
.motion:not(.unlocked) .dial__mark { fill: var(--ink-3); }
.motion:not(.playing) .ring { opacity: 0; }

/* Footer ------------------------------------------------------------------------------------- */

.foot {
    padding: 1.5rem var(--gutter) 1.75rem;
    font-size: 0.8125rem;
    color: var(--text-3);
}

/* Landscape phones: the dial beside the words, so both fit the first screen. */
@media (orientation: landscape) and (max-height: 500px) {
    .hero {
        flex-direction: row;
        gap: 2.5rem;
        text-align: left;
    }
    .words { align-items: flex-start; }
    .bar { padding-block: 0.75rem; }
    .foot { padding-block: 0.75rem; }
    .hero { padding-block: 0; }
    .dial { width: min(72vh, 45vw); width: min(72svh, 45vw); min-width: 0; flex: none; }
    h1 { margin-top: 0; font-size: clamp(2.25rem, 12svh, 3.5rem); }
}

/* Settings that change the page ---------------------------------------------------------------- */

@media (forced-colors: active) {
    .status { border: 1px solid CanvasText; }
    .mark__pad, .dial__mark, .dial__notch, .dial__notch-dot, .dial__caret, .dial__digit { fill: CanvasText; }
    .dial__hairline, .dial__ticks, .dial__arcs, .dial__dots, .dial__core, .dial__caret { stroke: CanvasText; }
}

@media print {
    .field { display: none; }
}
