/* wxmap.pro map: the house style on top of the globe kit and the marine wind
   page's own CSS (both loaded first, unchanged), and the cyclone phase space
   panel section and card. tokens.css already gives --bg, --text, --accent and the
   rest; here the glass surfaces get their light and dark values, and the few
   globe-kit colours written for a dark page only are re-pointed at tokens. The
   forecast colours on the map itself are the same in both themes. */

:root {
  --surface: rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --surface-raised: rgba(14, 34, 54, 0.04);
  --surface-hover: rgba(14, 34, 54, 0.08);
  --shadow: 0 8px 24px rgba(14, 34, 54, 0.16);
  --sky: radial-gradient(ellipse at 50% 45%, #e9f1f6 0%, #d5e3ed 55%, #c3d5e2 90%);
  --scrim: rgba(14, 34, 54, 0.35);
  --line-swatch: #43566b;
  --font: var(--sans);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: rgba(10, 20, 32, 0.86);
    --surface-solid: #0e1b29;
    --surface-raised: rgba(255, 255, 255, 0.045);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --sky: radial-gradient(ellipse at 50% 45%, #14284a 0%, #0a1528 45%, #050a14 80%);
    --scrim: rgba(3, 7, 15, 0.6);
    --line-swatch: #e4ecf3;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --surface: rgba(10, 20, 32, 0.86);
  --surface-solid: #0e1b29;
  --surface-raised: rgba(255, 255, 255, 0.045);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --sky: radial-gradient(ellipse at 50% 45%, #14284a 0%, #0a1528 45%, #050a14 80%);
  --scrim: rgba(3, 7, 15, 0.6);
  --line-swatch: #e4ecf3;
  color-scheme: dark;
}

/* ---------- globe kit colours re-pointed at tokens ---------- */
body { font-family: var(--sans); }
#map { background: var(--sky); }
.boot { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; color: var(--text-2); font: 500 14px var(--sans); }
.icon-btn-primary, .icon-btn-primary:hover { color: var(--on-accent); }
.btn[aria-expanded="true"], .product[aria-checked="true"] { border-color: var(--accent); }
.chip[data-state="error"] { color: var(--err); border-color: var(--err); }
.chip[data-state="warn"] { color: var(--warn); }
.switch { background: var(--border-strong); }
input[type="range"]::-webkit-slider-runnable-track { background: var(--border-strong); }
input[type="range"]::-moz-range-track { background: var(--border-strong); }
.readout .note-line { color: var(--text); }
.scrim, .sheet, .dialog::backdrop { background: var(--scrim); }
.maplibregl-ctrl-scale, .maplibregl-ctrl-attrib.maplibregl-compact { background: var(--surface); }
.swatch-isobars { background: var(--line-swatch); }
.swatch-edges { border-top-color: var(--line-swatch); box-shadow: 0 4px 0 -1px var(--line-swatch); }
.swatch-track { border-top-color: var(--line-swatch); }

/* ---------- this site's name in the top bar ---------- */
a.brand { color: var(--text); text-decoration: none; }
.brand h1 { font: 600 17px/1.1 var(--display); letter-spacing: 0.01em; }
.brand .tld { color: var(--text-3); font-weight: 500; }
/* the valid time matters more than the wordmark: where the bar is too tight for
   both, the brand shrinks to the mark (still the link home) instead of sliding
   under the valid time */
.topbar .brand { flex: none; }
@media (max-width: 1700px) { .topbar .brand-text { display: none; } }
.topbar-actions .theme { flex: none; }
/* phones follow the system theme; the top bar has no room for the switch */
@media (max-width: 760px) { .topbar-actions .theme { display: none; } }

/* ---------- cyclone phase space: panel section ---------- */
/* the markers are the cyclone page's (glyphs.js): red warm, blue cold lower core */
.swatch-cps {
  background: transparent; border-radius: 50%; width: 12px; height: 12px;
  border: 3px solid; border-color: #e0362c #e0362c #2f74e0 #2f74e0;
}
.cps-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cps-list button {
  width: 100%; display: grid; grid-template-columns: 14px minmax(0, 1fr) auto auto; gap: 8px; align-items: center;
  padding: 5px 6px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); text-align: left; cursor: pointer; font-size: 12px;
}
.cps-list button:hover { background: var(--surface-hover); }
.cps-list button[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent); }
.cps-list .glyph { margin: -2px; }
/* the gray ring where the field's class differs, as on the cyclone page */
.glyph-alt { display: inline-flex; flex: none; border-radius: 50%; box-shadow: 0 0 0 1px rgba(5, 10, 20, .9), 0 0 0 2.2px #8b97a8; }
.glyph-alt .glyph { margin: -4px; }
.cps-list .glyph-alt { justify-self: center; }
.cps-key {
  list-style: none; margin: 8px 0 0; padding: 6px 0 0; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 1px; font-size: 11px; color: var(--text-3);
}
.cps-key li { display: flex; align-items: center; gap: 2px; }
.cps-key span { margin-left: 6px; }
.cps-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cps-where { color: var(--text-3); font: 11px var(--mono); }
.cps-list b { font: 500 11.5px var(--mono); font-variant-numeric: tabular-nums; color: var(--text-2); min-width: 6ch; text-align: right; }
.cps-empty { color: var(--text-3); font-size: 12px; padding: 4px 0; }

/* ---------- cyclone phase space: card ---------- */
.cps-card {
  position: absolute; z-index: 13;
  top: calc(var(--topbar-h) + var(--gap) * 2); right: 56px;
  width: 380px; max-height: calc(100% - var(--topbar-h) - var(--timeline-h) - 200px);
  overflow-y: auto; padding: 12px 14px 14px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
}
.cps-head { display: flex; align-items: flex-start; gap: 8px; }
.cps-head > div { flex: 1; min-width: 0; }
.cps-title { font: 600 17px/1.2 var(--display); margin: 0; }
.cps-sub { color: var(--text-3); font-size: 11.5px; margin: 2px 0 0; }
.cps-now { color: var(--text-2); font-size: 12px; margin: 0; }
.cps-now b { color: var(--text); font: 600 12px var(--mono); }

/* the cube (jkrek17.github.io/cyclone/space3d.js, run by cube.js); these rules follow the cyclone
   page's style.css. Its view is drawn light on dark, so it keeps a dark ground in
   both themes. */
.cps-cube { min-width: 0; }
.s3d { display: grid; gap: 6px; min-width: 0; }
.s3d-read {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 0 10px;
  min-height: 32px; margin: 0; font-size: 11px; line-height: 16px; color: var(--text-2);
}
.s3d-h { font: 600 11px/16px var(--mono); color: var(--text); }
.s3d-at { font: 11px/16px var(--font); color: var(--text-3); }
.s3d-c { display: inline-flex; align-items: center; gap: 4px; min-width: 0; white-space: nowrap; }
.s3d-c .glyph { flex: none; margin: -4px; }
.s3d-key .glyph { flex: none; margin: -3px -3px -3px -5px; }
.s3d-v { grid-column: 1 / -1; display: flex; gap: 12px; white-space: nowrap; }
.s3d-t b { font: 11px/16px var(--mono); color: var(--text); font-weight: 600; }
.s3d-t sub, .s3d-t sup, .s3d-note sub, .s3d-note sup { font-size: 8px; }
.s3d-u { color: var(--text-3); }
/* the margin to the nearest class wall, and this hour's raw class where the held one differs */
.s3d-mg { grid-column: 1 / -1; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s3d-mg .s3d-raw { color: var(--text-3); }
.margin { white-space: nowrap; }
.margin.near::before { content: ''; display: inline-block; width: 6px; height: 6px; margin: 0 5px 0 0; border-radius: 1px; background: #e8a33d; transform: rotate(45deg); vertical-align: 1px; }
.s3d-canvas {
  display: block; width: 100%; max-width: 100%; aspect-ratio: 1; border-radius: var(--radius-sm);
  background: #0f1829;
  touch-action: none; cursor: grab; -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.s3d-canvas.grabbing { cursor: grabbing; }
.s3d-canvas.on-dot { cursor: pointer; }
.s3d-canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.s3d-key {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px;
  margin: 0; padding: 0; list-style: none; font-size: 11px; line-height: 16px; color: var(--text-2);
}
.s3d-key li { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; }
.s3d-key b { font: 600 11px/16px var(--mono); color: var(--text); }
.s3d-note { margin: 2px 0 0; font-size: 11px; line-height: 16px; color: var(--text-3); }

@media (max-width: 1120px) {
  .cps-card { width: 340px; }
}
@media (max-width: 760px) {
  .cps-card {
    top: auto; right: var(--gap); left: var(--gap); width: auto;
    bottom: calc(var(--timeline-h) + var(--gap) * 2); max-height: 58%;
  }
}
