/* Page foundation: reset, type, the app frame, shared utilities. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* The hidden attribute always wins, whatever display a class sets. */
[hidden] {
  display: none !important;
}

/* A dialog always takes clicks, wherever it is mounted. Click-through is
   inherited, so one placed inside a click-through layer would show and be dead. */
dialog {
  pointer-events: auto;
}

html {
  height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 100%;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
}

/* A quiet grid that ties the pages to the map: faint, wide, and only toward
   the edges, so the middle where you read stays plain (the owner, 2026-12-06:
   the old grid was loud, but with none something is missing). */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgb(255 255 255 / 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 0.045) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: center;
  mask-image: radial-gradient(ellipse at center, transparent 30%, #000 95%);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-mono);
  font-weight: 600;
  line-height: 1.2;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
}

/* A screen is a full-page view. Only one is shown at a time. */
.screen {
  grid-area: 1 / 1;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: var(--space-5) var(--space-4);
  animation: screen-in var(--dur-expressive) var(--ease-enter) both;
}

.screen[hidden] {
  display: none;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(var(--travel));
  }
}

.panel {
  width: 100%;
  background: var(--bg-veil);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: var(--space-5);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.number {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.dim {
  color: var(--text-dim);
}

.stack {
  display: grid;
  gap: var(--space-3);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.noscript {
  padding: var(--space-6);
  text-align: center;
}

/* Short messages that confirm or explain, bottom center, out of the way. */
.toasts {
  position: fixed;
  left: 50%;
  bottom: var(--space-5);
  transform: translateX(-50%);
  display: grid;
  gap: var(--space-2);
  justify-items: center;
  width: min(92vw, 32rem);
  pointer-events: none;
  z-index: 50;
}

.toast {
  pointer-events: auto;
  padding: var(--space-2) var(--space-4);
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  animation: toast-in var(--dur-base) var(--ease-enter) both;
}

.toast[data-tone='warn'] {
  border-left-color: var(--warn);
}

.toast[data-tone='danger'] {
  border-left-color: var(--danger);
}

.toast.is-leaving {
  animation: toast-out var(--dur-quick) var(--ease-exit) both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(var(--travel));
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(var(--travel));
  }
}

/* A full-window notice over whatever screen is showing: connection trouble. */
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background: rgb(5 7 11 / 0.72);
  z-index: 40;
  animation: overlay-in var(--dur-base) var(--ease-standard) both;
}

.overlay[hidden] {
  display: none;
}

.overlay .panel {
  max-width: 26rem;
}

@keyframes overlay-in {
  from {
    opacity: 0;
  }
}
