/**
 * STORMSCAPE — Base styles
 * Reset, document defaults, typography primitives, focus treatment.
 */

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

* {
  margin: 0;
}

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

body {
  height: 100%;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-weight: var(--weight-regular);
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-synthesis-weight: none;
  overscroll-behavior: none;
}

/* The app owns the viewport; the page itself never scrolls. Individual panels
   scroll internally so the map is never pushed out of frame. */
body.is-app-shell {
  overflow: hidden;
}

img,
picture,
svg,
canvas {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
}

ul,
ol {
  list-style: none;
  padding: 0;
}

a {
  color: var(--accent-text);
  text-decoration-color: color-mix(in srgb, var(--accent-text) 40%, transparent);
  text-underline-offset: 0.2em;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--accent-hover);
}

/* --------------------------------------------------------------------------
   Typography primitives
   -------------------------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

/* The editorial voice. Used for the wordmark, hero copy, and the large figures
   in the metrics panel — anywhere the app is speaking rather than labelling. */
.display {
  font-family: var(--font-display);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
}

/* Small, wide, uppercase — section eyebrows and panel headers. The wide
   tracking is what keeps this from reading as generic dashboard chrome. */
.eyebrow {
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.prose {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  text-wrap: pretty;
}

.prose strong {
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
}

.prose em {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.08em;
  color: var(--text-primary);
}

.prose p + p {
  margin-top: var(--space-3);
}

/* Every number that can change must be tabular, or the layout twitches as
   digits swap width during animated counts. */
.numeric {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'zero' 1;
}

/* --------------------------------------------------------------------------
   Focus
   -------------------------------------------------------------------------- */
/* A double ring: a bright inner ring for contrast against dark chrome, and a
   dark outer halo so the ring survives on bright satellite imagery. */

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--focus-halo);
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Selection & scrollbars
   -------------------------------------------------------------------------- */

::selection {
  background: var(--accent-muted);
  color: var(--text-primary);
}

.scroll-region {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.scroll-region::-webkit-scrollbar {
  width: 10px;
}

.scroll-region::-webkit-scrollbar-track {
  background: transparent;
}

.scroll-region::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
  border: 3px solid transparent;
  background-clip: content-box;
}

.scroll-region::-webkit-scrollbar-thumb:hover {
  background: var(--text-disabled);
  background-clip: content-box;
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

/* Visible to screen readers only. Used for live regions and state narration. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: var(--z-modal);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  box-shadow: var(--shadow-lg);
  transform: translateY(calc(-100% - var(--space-4)));
  transition: transform var(--duration-normal) var(--ease-out);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */
/* Durations are already zeroed in tokens.css. This additionally stops any
   infinite ambient animation — the drifting clouds, the pulsing live dot, the
   lightning flash — which is the part that actually causes discomfort. */

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