/* ============================================================
   base.css — reset + the time-machine control.
   Deliberately opinion-free about the site itself: every era
   stylesheet owns its own layout so they never fight.
   ============================================================ */

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

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

body {
  margin: 0;
  padding: 0 0 120px;         /* room for the fixed time machine */
  min-height: 100vh;
  font-family: system-ui, sans-serif;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, p, dl, dd, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }

.wrap { width: 100%; margin-inline: auto; }
.slot:empty { display: none; }

/* ------------------------------------------------------------
   Time machine — the one element that stays legible in every
   era. It sits *outside* the site's own design language.
   ------------------------------------------------------------ */

.tm {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 9999;
  width: min(560px, calc(100vw - 24px));
  font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}

.tm-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  padding: 12px 18px 10px;
  border-radius: 14px;
  background: rgba(14, 14, 18, .82);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .6), 0 1px 0 rgba(255,255,255,.08) inset;
  color: #f2f2f4;
}

.tm-readout { line-height: 1.15; min-width: 96px; }

.tm-year {
  display: block;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  color: var(--tm-accent, #d4622a);
  transition: color .3s ease;
}

.tm-name {
  display: block;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tm-slider { display: block; }

/* range input, restyled from scratch so it looks the same everywhere */
#eraRange {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  display: block;
}
#eraRange::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg,
    var(--tm-accent, #d4622a) 0 var(--tm-fill, 100%),
    rgba(255,255,255,.16) var(--tm-fill, 100%) 100%);
}
#eraRange::-moz-range-track {
  height: 4px;
  border-radius: 99px;
  background: rgba(255,255,255,.16);
}
#eraRange::-moz-range-progress {
  height: 4px;
  border-radius: 99px;
  background: var(--tm-accent, #d4622a);
}
#eraRange::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--tm-accent, #d4622a);
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
  transition: transform .15s ease;
}
#eraRange::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--tm-accent, #d4622a);
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
#eraRange:active::-webkit-slider-thumb { transform: scale(1.15); }
#eraRange:focus-visible { outline: none; }
#eraRange:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(255,255,255,.28); }
#eraRange:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px rgba(255,255,255,.28); }

.tm-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
}
.tm-ticks button {
  background: none;
  border: 0;
  padding: 2px 4px;
  font-family: inherit;
  font-size: 10.5px;
  letter-spacing: .06em;
  color: rgba(255,255,255,.42);
  cursor: pointer;
  border-radius: 5px;
  transition: color .2s ease;
}
.tm-ticks button:hover { color: rgba(255,255,255,.85); }
.tm-ticks button[aria-current="true"] { color: #fff; font-weight: 700; }
.tm-ticks button:focus-visible { outline: 2px solid var(--tm-accent, #d4622a); outline-offset: 1px; }

@media (max-width: 460px) {
  .tm-inner { grid-template-columns: 1fr; gap: 6px; padding: 10px 14px; }
  .tm-readout { display: flex; align-items: baseline; gap: 10px; }
  .tm-year { font-size: 20px; }
}

/* ------------------------------------------------------------
   Warp — a brief flash between eras. Purely decorative.
   ------------------------------------------------------------ */

.warp {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.10) 0 1px, transparent 1px 3px),
    radial-gradient(120% 80% at 50% 50%, rgba(255,255,255,.9), rgba(255,255,255,0) 60%);
  mix-blend-mode: overlay;
}
.warp.on { animation: warp .42s ease-out; }
@keyframes warp {
  0%   { opacity: 0; transform: scaleY(1); }
  18%  { opacity: 1; transform: scaleY(1.02); }
  100% { opacity: 0; transform: scaleY(1); }
}

/* View Transitions: cross-fade the whole document on era change */
::view-transition-old(root),
::view-transition-new(root) { animation-duration: .38s; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .warp.on { animation: none; }
}
