/*
 * SoundingScope — Design Tokens
 *
 * Ported from the AutoOutlook.tech design system: a neo-brutalist "retro
 * weather terminal" aesthetic. Cream paper, ink black, hard offset shadows,
 * square corners, thick borders, and the SPC convective-outlook risk palette.
 *
 * Fonts (loaded via <link> in index.html): Inter (body), Space Grotesk
 * (display / uppercase headings), JetBrains Mono (labels, share string).
 */

:root {
  color-scheme: light;

  /* ----------------------------------------------------------------------
   * Brand palette (AutoOutlook tokens)
   * -------------------------------------------------------------------- */
  --paper: #f8f4ec;
  --ink: #111111;
  --navy: #0e1a3a;

  --signal-red: #ef3b2c;
  --signal-amber: #f7b500;
  --signal-orange: #ff8c00;
  --signal-lime: #9ad62a;
  --signal-cyan: #16c1ff;
  --signal-violet: #7a0177;

  /* SPC convective-outlook risk colors -> Storm_Risk_Level categories. */
  --risk-none: #c9c2b2;     /* neutral straw for "None" */
  --risk-thunderstorm: #5fa85f; /* tstm (general thunderstorm, SPC green) */
  --risk-marginal: #f7b500; /* mrgl */
  --risk-slight: #ff8c00;   /* slgt */
  --risk-enhanced: #ef3b2c; /* enh  */
  --risk-moderate: #b30000; /* mod  */
  --risk-high: #7a0177;     /* high */

  /* ----------------------------------------------------------------------
   * Semantic aliases
   * -------------------------------------------------------------------- */
  /* Elevation ladder (lightest -> darkest): card (paper) > sunk well > page.
     The page sits a touch deeper and warmer than the cards so the bright
     paper panels lift off it instead of sharing one flat tone. */
  --bg: #ebe4d3;                 /* deeper straw page behind the cards */
  --surface: var(--paper);       /* cards: the brightest paper surface */
  --surface-sunk: #e7dfcc;       /* recessed inset wells, darker than card */
  --text: var(--ink);
  --text-muted: rgba(17, 17, 17, 0.62);
  --text-faint: rgba(17, 17, 17, 0.40);
  --border: var(--ink);
  --accent: var(--signal-amber);
  --accent-ink: #15120a;         /* text/glyphs on accent surfaces — kept dark
                                    in BOTH themes so amber/lime fills stay legible */
  --success: var(--signal-lime);
  --danger: var(--signal-red);
  --dot-color: rgba(17, 17, 17, 0.06);   /* body dot-grid texture */
  --overlay: rgba(17, 17, 17, 0.45);     /* modal scrim */
  --hairline: rgba(17, 17, 17, 0.14);    /* subtle row separators */
  /* Hover wash on transparent controls — flips to a light wash in dark mode. */
  --hover-tint: rgba(17, 17, 17, 0.06);
  --hover-tint-strong: rgba(17, 17, 17, 0.12);

  /* ----------------------------------------------------------------------
   * Typography
   * -------------------------------------------------------------------- */
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Courier New", monospace;

  /* Type scale (px size / line-height). */
  --type-large-title-size: 34px;  --type-large-title-line: 38px;
  --type-title1-size: 28px;       --type-title1-line: 32px;
  --type-title2-size: 22px;       --type-title2-line: 26px;
  --type-headline-size: 16px;     --type-headline-line: 22px;
  --type-body-size: 15px;         --type-body-line: 22px;
  --type-subhead-size: 13px;      --type-subhead-line: 18px;
  --type-footnote-size: 11px;     --type-footnote-line: 16px;

  /* ----------------------------------------------------------------------
   * Borders, radii, shadows (brutalist: square + hard offset)
   * -------------------------------------------------------------------- */
  --border-w-thin: 2px;
  --border-w: 3px;
  --border-w-thick: 4px;

  --radius: 0px;        /* brutalist: square corners everywhere */
  --radius-pill: 0px;

  /* Shadow color is tokenized so dark mode can soften the hard offset. */
  --shadow-color: var(--ink);
  --shadow-sm: 3px 3px 0 0 var(--shadow-color);
  --shadow: 6px 6px 0 0 var(--shadow-color);
  --shadow-lg: 10px 10px 0 0 var(--shadow-color);
  --shadow-inset: inset 4px 4px 0 0 var(--shadow-color);

  /* ----------------------------------------------------------------------
   * Spacing — 8-pt grid
   * -------------------------------------------------------------------- */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --content-max-width: 680px;
  --content-max-width-wide: 1180px;
  --gutter: var(--space-5);

  /* ----------------------------------------------------------------------
   * Motion
   * -------------------------------------------------------------------- */
  --ease-standard: cubic-bezier(0.2, 0.85, 0.35, 1.05);
  --duration-fast: 140ms;
  --duration-standard: 200ms;
  --duration-slow: 280ms;
}

/* ------------------------------------------------------------------------
 * Dark theme — invert paper/ink so the brutalist treatment still reads.
 * Toggled via data-theme="dark" on the root element (Settings → Dark mode).
 * ---------------------------------------------------------------------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  /* Elevation ladder (darkest -> lightest): page < sunk well < card.
     Cards are the lightest surface so they lift off the deeper page instead
     of dissolving into it the way a single flat tone did. */
  --bg: #121110;        /* deepest: the page behind the cards */
  --paper: #221f19;     /* warm dark "paper" — the card surface */
  --ink: #f3efe6;       /* light "ink": text, borders, shadows */
  --surface: var(--paper);
  --surface-sunk: #18160f;  /* recessed wells, darker than the card */
  --text-muted: rgba(243, 239, 230, 0.66);
  --text-faint: rgba(243, 239, 230, 0.40);
  --dot-color: rgba(243, 239, 230, 0.06);
  --overlay: rgba(0, 0, 0, 0.66);
  --hairline: rgba(243, 239, 230, 0.16);
  --hover-tint: rgba(243, 239, 230, 0.08);
  --hover-tint-strong: rgba(243, 239, 230, 0.15);
  /* Soften the hard offset shadow so bright cream edges read as depth,
     not glare, against the dark page. */
  --shadow-color: rgba(243, 239, 230, 0.42);
}

/* ------------------------------------------------------------------------
 * Base elements
 * ---------------------------------------------------------------------- */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  font-weight: 400;
  color: var(--text);
  background-color: var(--bg);
  /* Faint ink dot-grid texture (AutoOutlook signature). */
  background-image: radial-gradient(var(--dot-color) 1px, transparent 1px);
  background-size: 18px 18px;
  background-position: 0 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

/* ------------------------------------------------------------------------
 * Typography utility classes
 * ---------------------------------------------------------------------- */
.type-large-title {
  font-family: var(--font-display);
  font-size: var(--type-large-title-size);
  line-height: var(--type-large-title-line);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.type-title1 {
  font-family: var(--font-display);
  font-size: var(--type-title1-size);
  line-height: var(--type-title1-line);
  font-weight: 700;
  text-transform: uppercase;
}
.type-title2 {
  font-family: var(--font-display);
  font-size: var(--type-title2-size);
  line-height: var(--type-title2-line);
  font-weight: 700;
}
.type-headline {
  font-family: var(--font-display);
  font-size: var(--type-headline-size);
  line-height: var(--type-headline-line);
  font-weight: 700;
}
.type-body {
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
}
.type-subhead {
  font-size: var(--type-subhead-size);
  line-height: var(--type-subhead-line);
}
.type-footnote {
  font-family: var(--font-mono);
  font-size: var(--type-footnote-size);
  line-height: var(--type-footnote-line);
}

/* ------------------------------------------------------------------------
 * Layout container
 * ---------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--content-max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
  box-sizing: border-box;
}

/* ------------------------------------------------------------------------
 * Focus ring — ink outline + paper ring, visible on any surface (AA).
 * ---------------------------------------------------------------------- */
*:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--paper);
}

/* ------------------------------------------------------------------------
 * Reduced motion
 * ---------------------------------------------------------------------- */
@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;
  }
}
