/* base.css — tokens, reset, type, and the shared device kit.
   Warm retro-future: the future as imagined in 1979.
   Day cut is the default; night is a mode, set via [data-theme="night"]. */

/* ---------------------------------------------------------------- tokens */

:root {
  /* type — all system stacks, nothing to load */
  --display: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --body: system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --hand: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;

  /* day palette */
  --bg: #ECE3D0;
  --surface: #F3ECDC;
  --surface-2: #E7DCC5;
  --fg: #2A2823;
  --fg-soft: #6B6250;
  --accent: #C4572F;
  --amber: #DBA23C;
  --green: #7C8144;
  --wood: #6E4A2E;
  --rule: #D8CBB0;
  --bcol: #2A2823;      /* structural borders are ink in daylight */

  /* structure — flat on the day cut */
  --radius: 0px;
  --radius-sm: 0px;
  --bw: 2px;
  --scan: .05;
  --scan-gap: 3px;

  /* light is flat in daylight; night switches these on */
  --glow-display: none;
  --glow-btn: none;
  --glow-led: 0 0 0 3px rgba(196, 87, 47, .16);

  --measure: 1080px;
  --pad: 32px;
}

[data-theme="night"] {
  --bg: #1E1B15;
  --surface: #2A251D;
  --surface-2: #332D23;
  --fg: #ECE3D0;
  --fg-soft: #B4A992;
  --accent: #E06A3C;
  --amber: #E6AC4E;
  --green: #979E54;
  --wood: #8A5E39;
  --rule: #463E30;
  --bcol: #463E30;

  --radius: 14px;
  --radius-sm: 10px;
  --bw: 1px;
  --scan: .09;

  --glow-display: 0 0 26px rgba(224, 106, 60, .55);
  --glow-btn: 0 0 24px rgba(224, 106, 60, .4);
  --glow-led: 0 0 14px rgba(224, 106, 60, .75), 0 0 0 3px rgba(224, 106, 60, .18);
}

/* ----------------------------------------------------------------- reset */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

/* CRT scanlines over everything, at a whisper */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: var(--scan);
  background: repeating-linear-gradient(
    to bottom, #000 0, #000 1px, transparent 1px, transparent var(--scan-gap)
  );
}

img, svg { max-width: 100%; height: auto; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--amber); }

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

/* visually hidden but still announced */
.vh {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 12px; top: 12px;
  z-index: 1000;
  background: var(--surface);
  border: var(--bw) solid var(--fg);
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 12px;
}

/* ------------------------------------------------------------------ type */

.display {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: .95;
  text-transform: lowercase;
  margin: 0;
  text-wrap: balance;
}

.display em {
  font-style: normal;
  color: var(--accent);
  text-shadow: var(--glow-display);
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-soft);
}

.hand {
  font-family: var(--hand);
  font-size: 19px;
  line-height: 1.3;
  color: var(--wood);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 22px;
}

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

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding-inline: var(--pad);
}

/* Longhands on purpose: .wrap owns the INLINE padding, blocks own the BLOCK
   padding. A `padding` shorthand in either one silently wipes the other —
   which is exactly what it did until this was untangled. */
section { padding-block: 72px; border-top: var(--bw) solid var(--rule); }

/* eyebrow sits above the heading so both hang off the same left edge as the
   content below — side by side pushed the heading off the grid */
.section-head { margin-bottom: 40px; }
.section-head .display { font-size: clamp(28px, 4.4vw, 40px); }

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 13px 22px;
  border: var(--bw) solid var(--bcol);
  border-radius: var(--radius-sm);
  color: var(--fg);
  background: transparent;
  transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.btn:hover { background: var(--surface-2); color: var(--fg); }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #FDF6E7;
  box-shadow: var(--glow-btn);
}
.btn--primary:hover { background: var(--wood); border-color: var(--wood); color: #FDF6E7; }

/* ------------------------------------------------------------ device kit
   Pure CSS, no images. Each one frames a real fact — the moment they
   decorate instead, this tips into nostalgia kitsch. */

/* status LED — one pulsing dot, availability */
.led {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--glow-led);
  animation: led-pulse 2.6s ease-in-out infinite;
  flex: none;
}
@keyframes led-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .45; }
}

/* speaker grille — masked dot field, the mass a photo would have held */
.grille {
  position: relative;
  aspect-ratio: 1;
  border: var(--bw) solid var(--bcol);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, .10);
  overflow: hidden;
}
.grille::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--fg) 1.1px, transparent 1.6px) 0 0 / 9px 9px;
  opacity: .8;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 62%, transparent 74%);
          mask-image: radial-gradient(circle at 50% 50%, #000 62%, transparent 74%);
}

/* CRT readout — amber phosphor, scanlines, a slow flicker */
.readout {
  display: inline-block;
  position: relative;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .08em;
  color: var(--amber);
  background: #14120C;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  text-shadow: 0 0 6px rgba(230, 172, 78, .85);
  box-shadow: inset 0 2px 7px rgba(0, 0, 0, .75);
  animation: crt-flicker 3.6s steps(1, end) infinite;
}
.readout::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(rgba(0, 0, 0, .32) 0 1px, transparent 1px 2px);
}
@keyframes crt-flicker {
  0%, 92%, 94%, 97%, 100% { opacity: 1; }
  93% { opacity: .72; }
  96% { opacity: .88; }
}

/* name plate — brand left, mono detail right, on a hairline */
.plate {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-soft);
}

/* knob — the day/night control. The body's light and shadow stay fixed;
   only the indicator rotates, the way a real knob under a real lamp does. */
.knob {
  --turn: 0deg;
  position: relative;
  width: 40px; height: 40px;
  padding: 0;
  border: var(--bw) solid var(--bcol);
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, .55), transparent 46%),
    radial-gradient(circle at 68% 78%, rgba(0, 0, 0, .28), transparent 52%),
    var(--surface-2);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .12);
  flex: none;
}
.knob:active { cursor: grabbing; }
.knob::after {
  content: "";
  position: absolute;
  left: 50%; top: 5px;
  width: 3px; height: 11px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--accent);
  transform-origin: 50% 15px;
  transform: rotate(var(--turn));
  transition: transform .3s cubic-bezier(.3, 1.4, .5, 1);
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
