/* barometricforecast.com — calm weather-app aesthetic.
   All colours live in custom properties on :root so light/dark mode and the
   chart (which reads them via getComputedStyle) stay in sync. */

:root {
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;

  /* surfaces & ink */
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);

  /* brand */
  --accent: #2a78d6;
  /* layered "sky depth": a bright glow upper-left, a whisper of blue
     lower-right, over the base gradient */
  --header-bg:
    radial-gradient(120% 170% at 18% -30%, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0) 55%),
    radial-gradient(130% 190% at 88% 130%, rgba(42, 120, 214, 0.16) 0%, rgba(42, 120, 214, 0) 58%),
    linear-gradient(160deg, #dcebfa 0%, #f2f7fc 100%);

  /* rate-of-change colours (validated for light surface) */
  --rate-calm: #2a78d6;
  --rate-shifting: #eda100;
  --rate-rapid: #d03b3b;

  /* chart chrome */
  --past-wash: rgba(137, 135, 129, 0.12);
  --now-line: #52514e;
  --model-band: rgba(42, 120, 214, 0.14);
  --day-highlight: rgba(42, 120, 214, 0.1);

  /* pressure band chips (diverging red ↔ blue around neutral) */
  --band-very-low: #b02524;
  --band-low: #e58585;
  --band-normal: #f0efec;
  --band-high: #86b6ef;
  --band-very-high: #1c5cab;

  /* creativelittle brand red (the "dotcom" in the footer credit) */
  --credit-red: #b32017;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.1);

    --accent: #3987e5;
    --header-bg:
      radial-gradient(120% 170% at 18% -30%, rgba(87, 144, 229, 0.25) 0%, rgba(87, 144, 229, 0) 55%),
      linear-gradient(160deg, #16222f 0%, #12161b 100%);

    --rate-calm: #3987e5;
    --rate-shifting: #c98500;
    --rate-rapid: #d03b3b;

    --past-wash: rgba(137, 135, 129, 0.14);
    --now-line: #c3c2b7;
    --model-band: rgba(57, 135, 229, 0.18);
    --day-highlight: rgba(57, 135, 229, 0.14);

    /* dark chips keep a light/dark step INSIDE each hue so Low vs Very Low
       and High vs Very High stay separable on the dark surface */
    --band-very-low: #9c2423;
    --band-low: #e58585;
    --band-normal: #383835;
    --band-high: #86b6ef;
    --band-very-high: #1c5cab;

    /* lighter than the light-theme red — #b32017 only hits ~2.6:1 on the
       dark page; this stays the same hue at ~5:1 */
    --credit-red: #e05545;

    color-scheme: dark;
  }
}

/* ---------- base ---------- */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--page);
}

.wrap {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1rem;
}

a { color: var(--accent); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.noscript-note {
  margin: 1.5rem auto;
  max-width: 46rem;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--rate-shifting);
  background: var(--surface);
  border-radius: 0.4rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- header ---------- */

.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 2.25rem 0 1.75rem;
  text-align: center;
}

/* icon + title lockup */
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
}

.site-logo {
  width: clamp(2.4rem, 5vw, 2.75rem);
  height: auto;
  filter: drop-shadow(0 1px 2px rgba(11, 11, 11, 0.15));
}

.site-title {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.6rem 0 0;
  color: var(--ink);
  opacity: 0.75;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

/* ---------- intro ---------- */

.intro {
  margin: 1.5rem auto;
  color: var(--ink-2);
  max-width: 46rem;
}

/* ---------- search / autocomplete ---------- */

/* "Action zone" panel in the summary card's language: surface + whisper
   shadow, no border at rest (card chrome stays reserved for the chart and
   map). The transparent border warms to the accent while anything inside
   has focus, without layout shift. */
.search-box {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  border: 1.5px solid transparent;
  border-radius: 0.75rem;
  transition: border-color 150ms ease;
}

.search-box:focus-within { border-color: var(--accent); }

.search-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.search-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.combobox {
  position: relative;
  flex: 1;
}

/* Quiet ghost button — used for Share and My location. Blue outline is
   reserved; these support, they don't shout. */
.ghost-btn {
  min-height: 3rem;               /* large touch target */
  padding: 0 1rem;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--ink-2);
  background: transparent;
  border: 1.5px solid var(--axis);
  border-radius: 0.6rem;
  cursor: pointer;
  white-space: nowrap;
}

.ghost-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.location-input {
  width: 100%;
  min-height: 3rem;               /* large touch target */
  padding: 0.6rem 0.9rem;
  font-size: 1.05rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--axis);
  border-radius: 0.6rem;
}

.location-input::placeholder { color: var(--muted); }

.autocomplete-list {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  max-height: 18rem;
  overflow-y: auto;
}

.autocomplete-option {
  padding: 0.7rem 0.8rem;         /* large touch target */
  border-radius: 0.4rem;
  cursor: pointer;
}

.autocomplete-option:hover,
.autocomplete-option.active {
  background: var(--accent);
  color: #fff;
}

.autocomplete-empty {
  padding: 0.7rem 0.8rem;
  color: var(--muted);
}

.search-hint {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- forecast section ---------- */

.forecast { margin-top: 2rem; }

/* Name + controls share the top row; the summary spans below. On narrow
   screens the areas reorder so the summary (the answer) comes before the
   controls (the knobs). */
.forecast-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name controls"
    "summary summary";
  align-items: baseline;
  column-gap: 0.75rem;
}

.place-name {
  grid-area: name;
  margin: 0;
  font-size: 1.6rem;
}

.head-controls {
  grid-area: controls;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

/* Label-above field: identical rhythm for every control, every width. */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
}

.select {
  min-height: 3rem;               /* large touch target */
  padding: 0.4rem 0.7rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--axis);
  border-radius: 0.6rem;
}

/* Narrow screens: summary before controls, and the controls become a tidy
   two-column grid instead of ragged wrapping. */
@media (max-width: 40rem) {
  .forecast-head {
    grid-template-columns: 1fr;
    grid-template-areas:
      "name"
      "summary"
      "controls";
  }
  .head-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    margin-top: 1rem;
  }
  .head-controls .ghost-btn { grid-column: 1 / -1; }
  .head-controls .select { width: 100%; }
}

/* summary card: current reading + upcoming-swing message, one flat card */

.summary-card {
  grid-area: summary;
  margin: 1rem 0 0;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.summary-now {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1rem;
}

.stat-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
}

.stat-rate { color: var(--ink-2); }

/* Rate + state chip wrap as one unit, so the chip never drops alone. */
.stat-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.stat-updated {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
}

.swing-banner {
  margin: 0.6rem 0 0;
  padding: 0.1rem 0 0.1rem 0.85rem;
  border-left: 4px solid var(--rate-calm);
  font-weight: 500;
}

.banner-calm { border-left-color: var(--rate-calm); }
.banner-shifting { border-left-color: var(--rate-shifting); }
.banner-rapid { border-left-color: var(--rate-rapid); }

.stat-chip {
  padding: 0.15rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1.5px solid;
}

.chip-calm { color: var(--rate-calm); border-color: var(--rate-calm); }
.chip-shifting { color: var(--rate-shifting); border-color: var(--rate-shifting); }
.chip-rapid { color: var(--rate-rapid); border-color: var(--rate-rapid); }

/* one shared label style for every section caption */

.section-label {
  font-weight: 600;
  font-size: 0.9rem;
}

.section-hint { color: var(--muted); font-weight: 400; font-size: 0.85rem; }

/* forecast-window block: day chips + slider, one unit */

.window-block { margin: 1.5rem 0 0; }

.daily-strip {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;        /* room for the scrollbar */
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

/* right-edge fade only when the strip actually overflows */
.daily-strip.can-scroll {
  mask-image: linear-gradient(90deg, #000 calc(100% - 2.5rem), transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 2.5rem), transparent);
}

.day-chip {
  flex: none;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  min-width: 3.4rem;
  min-height: 3.4rem;             /* large touch target */
  padding: 0.4rem 0.5rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 0.6rem;
  cursor: pointer;
}

.day-chip[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.day-chip-name { font-weight: 600; font-size: 0.85rem; }
.day-chip-date { font-size: 0.8rem; color: var(--muted); }

.day-chip-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  margin-top: 0.15rem;
}

.day-calm .day-chip-dot { background: var(--rate-calm); }
.day-shifting .day-chip-dot { background: var(--rate-shifting); }
.day-rapid .day-chip-dot { background: var(--rate-rapid); }

/* legend (lives inside the "How to read this chart" details) */

.legend-block { margin: 0.75rem 0 0.25rem; }

#legend-unit { color: var(--muted); font-weight: 400; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.legend-swatch {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 0.25rem;
  border: 1px solid var(--border);
  flex: none;
}

.band-very-high { background: var(--band-very-high); }
.band-high { background: var(--band-high); }
.band-normal { background: var(--band-normal); }
.band-low { background: var(--band-low); }
.band-very-low { background: var(--band-very-low); }

.legend-name { font-weight: 600; }
.legend-range { color: var(--ink-2); }

/* slider (inside the window block) */

.days-slider {
  display: block;
  width: 100%;
  margin: 0.35rem 0 0.15rem;
  accent-color: var(--accent);
  height: 2rem;                    /* generous hit area */
  cursor: pointer;
}

.slider-ends {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
}

/* chart */

.chart-wrap {
  position: relative;
  height: 22rem;
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}

.chart-key {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem 1rem;
  margin: 0.6rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-2);
}

.chart-help { margin-top: 0.5rem; }

.chart-help summary {
  cursor: pointer;
  padding: 0.5rem 0.25rem;        /* large touch target */
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-2);
}

.chart-help p {
  margin: 0.4rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-2);
  max-width: 46rem;
}

.rate-key { font-weight: 600; white-space: nowrap; }
.rate-key::before {
  content: '';
  display: inline-block;
  width: 1rem;
  height: 0.2rem;
  border-radius: 2px;
  margin-right: 0.3rem;
  vertical-align: middle;
}
.rate-key-calm::before { background: var(--rate-calm); }
.rate-key-shifting::before { background: var(--rate-shifting); }
.rate-key-rapid::before { background: var(--rate-rapid); }

/* status line */

.status {
  margin-top: 0.75rem;
  color: var(--ink-2);
}

/* No reserved space when there's no message — the map follows directly. */
.status:empty { display: none; }

/* ---------- map ---------- */

.map-section { margin-top: 1.5rem; }

.map-section h2 {
  font-size: 1.35rem;
  margin: 0 0 0.6rem;
}

.map {
  height: 26rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  overflow: hidden;          /* clip the iframe to the rounded corners */
  background: var(--surface);
}

.map iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* translated legend for the map's fixed hPa colour scale
   (shown only when a non-hPa unit is selected; centered under the credit) */

.map-units {
  margin: 0.75rem 0 0;
  text-align: center;
}

.map-units-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-2);
}

.map-units-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.map-units-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  min-width: 4.2rem;
  padding: 0.35rem 0.6rem;
  border-radius: 0.4rem;
  font-variant-numeric: tabular-nums;
}

.map-units-val { font-weight: 600; font-size: 0.9rem; }
.map-units-hpa { font-size: 0.75rem; }

/* Chips are tinted with the map's own scale colours (theme-independent),
   so text colour follows the chip, not the site theme. The soft shadow on
   white text echoes the labels on Windy's colourbar. */
.chip-ink-light .map-units-val,
.chip-ink-light .map-units-hpa {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.chip-ink-light .map-units-hpa { opacity: 0.85; }

.chip-ink-dark .map-units-val,
.chip-ink-dark .map-units-hpa { color: #20201d; }
.chip-ink-dark .map-units-hpa { opacity: 0.75; }

.map-note {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- FAQ ---------- */

.faq { margin-top: 2.5rem; }

.faq h2 { font-size: 1.35rem; }

/* flat list with hairline dividers — card chrome is reserved for
   the chart and the map */
.faq details {
  border-bottom: 1px solid var(--grid);
  padding: 0 0.25rem;
}

.faq details:first-of-type { border-top: 1px solid var(--grid); }

.faq summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.85rem 0;             /* large touch target */
}

.faq p {
  margin: 0 0 1rem;
  color: var(--ink-2);
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: 3rem;
  padding: 1.75rem 0 2.25rem;
  border-top: 1px solid var(--border);
  color: var(--ink-2);
  font-size: 0.92rem;
  text-align: center;
}

.credit-dot { color: var(--credit-red); }

.data-credit {
  margin-top: 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ---------- unofficial-copy notice (injected by main.js off-domain) ---------- */

.copy-notice {
  margin: 0;
  padding: 0.7rem 1rem;
  text-align: center;
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
