/* Site-wide look: readable fonts, contrast, Kp scale, forecast cards on
   phones and the "now" card on the home page.
   Loaded on every page after the page styles; !important overrides the
   inline font on <body> and older per-page rules. */

:root {
  --font-text: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: 'Exo 2', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --panel: rgba(22, 36, 71, 0.88);
  --panel-border: rgba(255, 215, 0, 0.35);
  --gold: #FFD700;
}

/* Exo 2 (the display font, with Cyrillic) only for headings, branding, menu and buttons; a plain font for
   everything people read */
body,
input,
select,
textarea,
label,
p,
li,
td,
th,
.suggestion,
#holidayDetails {
  font-family: var(--font-text) !important;
}

h1,
h2,
h3,
.hero-title,
.features-title,
.nav-brand,
.nav-link,
.btn,
.month-header,
.orbit-button .label,
footer p {
  font-family: var(--font-display) !important;
}

td,
th {
  font-variant-numeric: tabular-nums;
}

/* Contrast: gold or white text sits on a dark panel, not on the light blue */
::placeholder {
  color: rgba(255, 255, 255, 0.6) !important;
  opacity: 1;
}

.nav-header {
  background: rgba(22, 36, 71, 0.95) !important;
}

#weatherTable,
#hourlyTable,
.calendar-table {
  background: var(--panel) !important;
}

.info-display,
#selected-city:not(:empty) {
  background: var(--panel);
  border-radius: 10px;
  padding: 8px 14px;
}

/* Big gold headings sit right on the light blue: a dark shadow keeps them
   readable (overrides the gold glow of some pages) */
h1,
.hero-title,
.features-title {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65), 0 2px 10px rgba(0, 0, 0, 0.35) !important;
}

/* Weather: the Kp line wraps instead of sticking out on narrow screens */
#kp-summary {
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
}

/* Kp index scale 0-9 (Weather page and home card) */
.kp-scale {
  display: inline-flex;
  gap: 2px;
  margin: 0 6px;
  vertical-align: middle;
}

.kp-scale span {
  width: 8px;
  height: 14px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
}

.kp-scale span.on:nth-child(-n+5) { background: #2ecc71; }
.kp-scale span.on:nth-child(n+6):nth-child(-n+7) { background: #f1c40f; }
.kp-scale span.on:nth-child(n+8) { background: #e74c3c; }

/* Home page: current weather for the saved place */
.now-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 14px;
  max-width: 560px;
  margin: 0 auto 10px;
  padding: 12px 18px;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: var(--panel);
  color: #ffffff;
  text-decoration: none;
  font-family: var(--font-text);
  transition: border-color 0.2s ease;
}

.now-card:hover {
  border-color: var(--gold);
}

.now-card[hidden] {
  display: none;
}

.now-card .now-place {
  color: var(--gold);
  font-weight: 600;
}

.now-card .now-temp {
  font-size: 1.6em;
  font-weight: 700;
}

.now-card .now-more {
  color: var(--gold);
  white-space: nowrap;
}

/* Phones: each forecast day as a card instead of a 7-column table row.
   Cells get their column name in data-label (set by weather-fixed.js). */
@media (max-width: 600px) {
  #weatherTable thead {
    display: none;
  }

  #weatherTable,
  #weatherTable tbody {
    display: block;
    width: 100%;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
  }

  #weatherTable tbody tr {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin: 0 0 12px;
    padding: 12px;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: var(--panel);
  }

  /* nothing to scroll sideways any more: hide the "→" hint */
  .table-container:has(#weatherTable)::after {
    display: none;
  }

  #weatherTable tbody td {
    display: block;
    border: none !important;
    box-shadow: none !important;
    background: none !important;
    padding: 4px !important;
    text-align: center;
    font-size: 1rem !important;
    color: #ffffff !important;
  }

  #weatherTable tbody td:nth-child(1),
  #weatherTable tbody td:nth-child(2) {
    grid-column: 1 / -1;
  }

  #weatherTable tbody td:nth-child(1) {
    text-align: center !important;
    color: var(--gold) !important;
    font-weight: 600;
  }

  /* Card order: day and date, icons, warnings, min/max, sun and moon,
     then the hourly button and the reliability status at the very bottom.
     The date and forecast cells dissolve so their parts can be ordered. */
  #weatherTable tbody td:nth-child(1),
  #weatherTable tbody td:nth-child(2) {
    display: contents;
  }

  #weatherTable tbody td:nth-child(1) br {
    display: none;
  }

  #weatherTable tbody .day-head {
    order: 1;
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 8px;
    padding: 4px;
    text-align: center;
    color: var(--gold);
    font-weight: 600;
  }

  #weatherTable tbody td:nth-child(2) > div:first-child {
    order: 2;
    grid-column: 1 / -1;
    text-align: center;
  }

  #weatherTable tbody td:nth-child(2) > .wx-warnings {
    order: 3;
    grid-column: 1 / -1;
  }

  #weatherTable tbody td:nth-child(3) { order: 4; }
  #weatherTable tbody td:nth-child(4) { order: 5; }
  #weatherTable tbody td:nth-child(5) { order: 6; }

  #weatherTable tbody td:nth-child(2) > div[onclick] {
    order: 7;
    grid-column: 1 / -1;
    text-align: center;
  }

  #weatherTable tbody td:nth-child(1) > .reliability {
    order: 8;
    grid-column: 1 / -1;
    display: table;
    margin: 2px auto 0;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  /* min and max: the two big numbers of the card, side by side */
  #weatherTable tbody td:nth-child(3),
  #weatherTable tbody td:nth-child(4) {
    font-size: 1.7rem !important;
    font-weight: 800;
    line-height: 1.1;
  }

  #weatherTable tbody td:nth-child(3) .temp-range,
  #weatherTable tbody td:nth-child(4) .temp-range {
    font-size: 1rem;
  }

  #weatherTable tbody td:nth-child(n+3)::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.7);
  }

  #weatherTable tbody td:nth-child(n+3) {
    font-weight: 600;
  }
}

.day-cards { margin: 12px 0; }
.day-cards { grid-template-columns: repeat(auto-fill, minmax(96px, 108px)); justify-content: center; max-width: 100%; padding: 0 8px; box-sizing: border-box; }
.day-card { font: inherit; cursor: pointer; width: 100%; min-width: 0; overflow: hidden; }
.day-card .wx-warnings { margin-top: 2px; }
.day-card .wx-warning { font-size: 0.7rem; padding: 1px 6px; white-space: normal; text-align: center; }
.day-card .reliability { white-space: normal; text-align: center; }
.day-card .dc-sun .moon-phase { display: block; }
.day-card > * { display: block; }
.day-card .dc-icons { text-align: center; }
.day-card .dc-line { font-size: 0.8rem; opacity: 0.9; }
.day-card .dc-sun { font-size: 0.78rem; text-align: center; }
.day-card .dc-sun .sm-time { display: block; }
.day-card .dc-line,
.day-card .dc-sun .sm-time,
.day-card .dc-sun .moon-phase {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  width: 100%;
  margin: 2px 0;
}
.day-card .dc-sun { width: 100%; text-align: left; }
.day-card .dc-icons { text-align: left; width: 100%; }
.day-card .wx-warnings { justify-content: flex-start; }
/* One icon size for the whole card: 28px, left-aligned */
.day-card .wx-medal,
.day-card .wx-medal.wx-medal-sm,
.day-card .wx-medal.wx-medal-md {
  width: 28px;
  height: 28px;
  min-width: 28px;
  margin: 0 6px 0 0;
  border-width: 1.5px;
  flex-shrink: 0;
}
.day-card .wx-medal svg,
.day-card .wx-medal.wx-medal-sm svg,
.day-card .wx-medal.wx-medal-md svg { width: 21px; height: 21px; }
.day-card .dc-icons .wx-medal { margin-bottom: 2px; }
.day-card .wx-warning .wx-medal { width: 20px; height: 20px; min-width: 20px; margin-right: 3px; }
.day-card .wx-warning .wx-medal svg { width: 14px; height: 14px; }
.day-card .temp-range,
.day-card .reliability { font-size: 0.7rem; font-weight: 600; opacity: 0.9; }
.day-card.selected { border-color: var(--gold); background: rgba(255, 215, 0, 0.14); }
.day-msg { grid-column: 1 / -1; text-align: center; }
@media (max-width: 600px) {
  .day-cards { grid-template-columns: repeat(2, 1fr); }
}

/* Weather: warning badges in the date cell */
.wx-warnings {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin-top: 6px;
}

/* Badges: gradient pills with a thin gold edge and a soft shadow */
.wx-warning {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 215, 0, 0.45);
  background: linear-gradient(180deg, #e74c3c, #922b21);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.wx-warning.wx-wind { background: linear-gradient(180deg, #f39c12, #a04000); }
.wx-warning.wx-rain { background: linear-gradient(180deg, #5dade2, #1b4f72); }
.wx-warning.wx-snow { background: linear-gradient(180deg, #d6eaf8, #5d6d7e); color: #17202a; text-shadow: none; }
.wx-warning.wx-frost { background: linear-gradient(180deg, #aed6f1, #2e86c1); color: #0b2239; text-shadow: none; }
.wx-warning.wx-heat { background: linear-gradient(180deg, #ff7043, #922b21); }
.wx-warning.wx-fog { background: linear-gradient(180deg, #d5dbdb, #717d7e); color: #17202a; text-shadow: none; }
.wx-warning.wx-drizzle { background: linear-gradient(180deg, #85c1e9, #2874a6); }
.wx-warning.wx-thunder { background: linear-gradient(180deg, #af7ac5, #4a235a); }

/* Weather: bigger, bolder text in the forecast tables for easier reading */
#weatherTable tbody td,
#hourlyTable tbody td {
  font-size: 1.08rem;
  font-weight: 600;
}

#weatherTable th,
#hourlyTable th {
  font-size: 1.02rem;
  font-weight: 700;
}

/* Min and max temperature: the main numbers of the daily table */
#weatherTable tbody td:nth-child(3),
#weatherTable tbody td:nth-child(4) {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
}

#weatherTable tbody td:nth-child(3) .temp-range,
#weatherTable tbody td:nth-child(4) .temp-range {
  font-size: 1.05rem;
  font-weight: 600;
}

.wx-warning {
  font-size: 0.92rem;
  font-weight: 700;
  padding: 3px 10px;
}

.reliability {
  font-size: 0.92rem;
  font-weight: 700;
}

.temp-range,
.rain-chance {
  font-size: 0.92rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.moon-phase {
  font-size: 1rem;
  font-weight: 600;
}

/* Weather: round medallion icons (weather-icons.js) */

/* Medallions are always round, also inside buttons and cells */
.wx-medal {
  border-radius: 50% !important;
}

/* Table content is centred in every column, desktop and phone */
#weatherTable th,
#weatherTable td,
#hourlyTable th,
#hourlyTable td {
  text-align: center !important;
  vertical-align: middle;
}

.wx-medal.wx-medal-md {
  width: 34px;
  height: 34px;
  margin: 0 3px 0 0;
  border-width: 1.5px;
}

.wx-medal.wx-medal-md svg {
  width: 27px;
  height: 27px;
}

.sm-time {
  white-space: nowrap;
}

.wx-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin: 0 3px;
  border-radius: 50%;
  vertical-align: middle;
  border: 2px solid #c9a227;
  background: var(--bg);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.35), inset 0 0 14px rgba(0, 0, 0, 0.45);
}

.wx-medal svg {
  width: 30px;
  height: 30px;
}

.wx-medal.wx-medal-sm {
  width: 22px;
  height: 22px;
  margin: 0 4px 0 0;
  border-width: 1px;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4);
}

.wx-medal.wx-medal-sm svg {
  width: 16px;
  height: 16px;
}

/* Weather: sunrise, sunset and moon phase */
.moon-phase {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.9em;
  opacity: 0.9;
}

/* Weather: 3-day Kp forecast */
.kp-forecast {
  max-width: 760px;
  margin: 12px auto;
  padding: 12px 16px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  color: #ffffff;
  text-align: center;
}

.kp-forecast h2,
.kp-forecast h3 {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 1.05rem;
}

.kp-days {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.kp-day-name {
  color: var(--gold);
  font-weight: 600;
  text-transform: capitalize;
}

.kp-day-status {
  font-size: 0.85em;
  opacity: 0.85;
}

.kp-g-scale {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 8px;
  background: #c0392b;
  color: #ffffff;
  font-weight: 700;
}

/* Weather: hourly temperature chart */
.hourly-chart {
  max-width: 900px;
  margin: 10px auto 16px;
  padding: 10px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
}

.hourly-chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.hourly-chart text {
  fill: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  font-family: var(--font-text);
}

.hourly-chart .chart-grid { stroke: rgba(255, 255, 255, 0.15); }
.hourly-chart .chart-line { fill: none; stroke: var(--gold); stroke-width: 2.5; }
.hourly-chart .chart-dot { fill: var(--gold); }
.hourly-chart .chart-rain { fill: rgba(52, 152, 219, 0.55); }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 14px;
  margin-top: 6px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
}

.legend-line,
.legend-rain {
  display: inline-block;
  width: 18px;
  margin-right: -8px;
}

.legend-line { height: 3px; background: var(--gold); }
.legend-rain { height: 10px; background: rgba(52, 152, 219, 0.55); }

@media (max-width: 600px) {
  /* Sun & Moon spans the whole forecast card */
  #weatherTable tbody td:nth-child(5) {
    grid-column: 1 / -1;
  }

  .kp-days {
    gap: 6px;
    font-size: 0.9rem;
  }

  .hourly-chart text {
    font-size: 16px;
  }
}

/* No connection: the service worker shows the last saved data */
.offline-notice {
  position: fixed;
  left: 50%;
  bottom: calc(var(--footer-height, 40px) + 12px);
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 8px 16px;
  border-radius: 10px;
  background: #b03a2e;
  color: #ffffff;
  font-family: var(--font-text);
  font-size: 0.9rem;
  text-align: center;
  z-index: 10001;
}

.offline-notice[hidden] {
  display: none;
}

/* Holidays: "Add to calendar" under the list */
.holiday-ics {
  display: block;
  margin: 14px auto 0;
}

/* Weather: how certain the forecast is (forecast-precision.js) */
.reliability {
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Reliability shown as a small gold-edged pill */
.reliability {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 215, 0, 0.3);
  background: rgba(10, 18, 40, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.reliability.rel-high { color: #7dffb0; border-color: rgba(46, 204, 113, 0.6); background: linear-gradient(180deg, rgba(46, 204, 113, 0.28), rgba(10, 60, 35, 0.55)); }
.reliability.rel-medium { color: #ffe27a; border-color: rgba(241, 196, 15, 0.6); background: linear-gradient(180deg, rgba(241, 196, 15, 0.25), rgba(70, 55, 5, 0.55)); }
.reliability.rel-low { color: #ffb199; border-color: rgba(255, 138, 101, 0.6); background: linear-gradient(180deg, rgba(255, 138, 101, 0.25), rgba(80, 35, 20, 0.55)); }
.reliability.rel-rough { color: rgba(255, 255, 255, 0.8); border-color: rgba(255, 255, 255, 0.3); }


.temp-range,
.rain-chance {
  margin-top: 2px;
  font-size: 0.78rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.75);
}

.model-compare {
  max-width: 760px;
  margin: 12px auto;
  padding: 10px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  color: #ffffff;
}

.model-compare summary,
.kp-outlook summary {
  cursor: pointer;
  color: var(--gold);
  font-weight: 600;
}

.model-compare table {
  width: 100%;
  margin-top: 10px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.model-compare th,
.model-compare td {
  padding: 6px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
  color: #ffffff;
}

.model-compare th small {
  font-weight: 400;
  opacity: 0.7;
}

.model-note,
.outlook-note {
  margin: 8px 0 0;
  font-size: 0.82rem;
  opacity: 0.8;
}

/* Weather: solar wind now and 27-day outlook (space-weather.js) */
.space-weather {
  max-width: 760px;
  margin: 12px auto;
  padding: 12px 16px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  color: #ffffff;
  text-align: center;
}

.space-weather[hidden] {
  display: none;
}

.solar-wind h3 {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 1.05rem;
}

.solar-wind-values {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 18px;
}

.solar-wind-status {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
}

.solar-wind-status.wind-calm { background: rgba(46, 204, 113, 0.2); color: #7dffb0; }
.solar-wind-status.wind-watch { background: rgba(241, 196, 15, 0.2); color: #ffe066; }
.solar-wind-status.wind-storm { background: #c0392b; color: #ffffff; }

.kp-outlook {
  margin-top: 12px;
  text-align: left;
}

.outlook-days {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}

.outlook-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 30px;
  padding: 3px 0;
  border-radius: 6px;
  font-size: 0.75rem;
  line-height: 1.2;
}

.outlook-day .outlook-kp { font-weight: 700; font-size: 0.9rem; }
.outlook-day .outlook-date { opacity: 0.8; }
.outlook-day.kp-calm { background: rgba(46, 204, 113, 0.35); }
.outlook-day.kp-active { background: rgba(241, 196, 15, 0.55); color: #162447; }
.outlook-day.kp-storm { background: #c0392b; }

/* Weather: aurora chance under the 3-day Kp forecast */
.aurora-chance {
  margin-top: 10px;
  font-size: 0.88rem;
  opacity: 0.9;
}

/* Recent and favorite places as one-tap buttons (js/city-search.js, home) */
.recent-places {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.recent-places[hidden],
.home-favorites[hidden] {
  display: none;
}

.recent-place {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid rgba(255, 215, 0, 0.45);
  border-radius: 14px;
  background: rgba(22, 36, 71, 0.6);
  color: var(--gold);
  font-family: var(--font-text);
  font-size: 0.85em;
  text-decoration: none;
  cursor: pointer;
}

.recent-place:hover {
  background: rgba(255, 215, 0, 0.2);
}

.recent-place.favorite-place {
  border-color: var(--gold);
  background: rgba(255, 215, 0, 0.18);
  font-weight: 600;
}

.favorite-toggle[aria-pressed="true"] {
  text-decoration: none;
  opacity: 1;
}

/* Home: favorite places under the current weather */
.home-favorites {
  max-width: 560px;
  margin: 0 auto 10px;
  text-align: center;
}

.home-favorites-title {
  margin-bottom: 6px;
  color: var(--gold);
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.home-favorites-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

/* ---- Print: black on white, thin gray lines, nothing interactive ----
   The screen design is gold on dark blue; on white paper gold text and
   lines fade, and dark panels waste ink. */
/* Magnetic storms page (/magnitni-buri/, js/storm-page.js) */
.storm-page h1,
.info-page h1 {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 1.6rem;
  text-align: center;
}

.storm-intro {
  max-width: 760px;
  margin: 0 auto 8px;
  text-align: center;
  line-height: 1.5;
}

.storm-now-value {
  display: block;
  margin: 4px 0;
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.1;
}

.storm-now-value.kp-calm { color: #2ecc71; }
.storm-now-value.kp-active { color: #f1c40f; }
.storm-now-value.kp-storm { color: #e74c3c; }

.storm-now-status {
  margin: 8px 0 0;
  font-size: 1.05rem;
}

.storm-updated,
.storm-alerts-status {
  margin: 8px 0 0;
  font-size: 0.8rem;
  opacity: 0.75;
}

.storm-chart { margin-top: 12px; }

.storm-alerts p,
.widget-embed p { line-height: 1.5; }

.storm-faq,
.info-card {
  max-width: 760px;
  margin: 20px auto;
  padding: 4px 16px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  color: #ffffff;
  line-height: 1.6;
}

.storm-faq h2,
.info-card h2 {
  margin: 18px 0 6px;
  color: var(--gold);
  font-size: 1.15rem;
}

.storm-faq a,
.info-card a { color: var(--gold); }

.info-card li { margin: 4px 0; }
.info-updated { font-size: 0.85rem; opacity: 0.75; }

/* About and privacy links in the footer */
.footer-link { color: inherit; white-space: nowrap; }
.footer-link:hover { color: var(--gold); }

.kp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.kp-table th,
.kp-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  text-align: left;
}

.kp-table th { color: var(--gold); }

.widget-embed textarea {
  box-sizing: border-box;
  width: 100%;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  color: #ffffff;
  font-family: Consolas, monospace;
  font-size: 0.8rem;
  resize: none;
}

/* City weather pages (/vremeto/, js/city-forecast.js) and Bulgarian holidays (/praznici/) */
.breadcrumbs {
  margin: 0 0 4px;
  font-size: 0.85rem;
  text-align: center;
  opacity: 0.85;
}

.breadcrumbs a,
.storm-intro a,
.storm-updated a { color: var(--gold); }

.city-now .now-icon { font-size: 2.2rem; }

.city-days {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
}

.city-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.city-day { text-decoration: none; color: inherit; text-align: center; cursor: pointer; border: 1px solid transparent; }
.city-day:hover { border-color: var(--gold); background: rgba(255, 255, 255, 0.1); }
.city-day .kp-day-name { color: var(--gold); font-weight: 700; }
.city-day-date { font-size: 0.75rem; opacity: 0.75; }
.city-day-icon { font-size: 1.6rem; }
.city-day-temp { font-weight: 800; font-size: 1.2rem; color: #fff; }
.city-day-hourly { margin-top: 4px; font-size: 0.72rem; color: var(--gold); }
.city-day-rain,
.city-day-wind { font-size: 0.8rem; opacity: 0.85; }

.city-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 14px 0;
}

.city-actions .btn { text-decoration: none; }

.city-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.city-links .recent-place { text-decoration: none; }

.city-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  max-width: 900px;
  margin: 16px auto;
}

.city-tile {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  color: #ffffff;
  text-decoration: none;
}

.city-tile:hover { border-color: var(--gold); }
.city-tile-name { color: var(--gold); font-weight: 600; }
.city-tile-temp { white-space: nowrap; }

.holiday-table tr.weekend td:nth-child(2) { color: var(--gold); }

.holiday-note {
  display: block;
  font-size: 0.8rem;
  opacity: 0.75;
}

/* One background over the whole page: the page scripts set a gradient on
   body, which used to repeat every screen height on long pages. Fixed to the
   screen where supported; elsewhere stretched over the full page height. */
html {
  height: auto !important;
  min-height: 100%;
}

body {
  height: auto !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
  background-attachment: fixed !important;
}

/* Wide screens: a tighter header so the links and selectors fit in one row
   (when they still don't, /js/mobile-nav.js switches to the menu button) */
@media (min-width: 769px) {
  .nav-header .nav-links { gap: 6px !important; }
  .nav-header .nav-link {
    padding: 2px 10px !important;
    font-size: 0.85rem !important;
  }
  .nav-header .header-selectors { gap: 10px !important; }
  .nav-header .header-selectors .form-group { gap: 6px !important; }
  .nav-header .header-selectors select {
    width: 112px !important;
    min-width: 0 !important;
    padding: 4px 6px !important;
  }
}

/* Main destinations of the selected country, under the place search */
.destination-places { margin-top: 6px; }
/* In the page forms: its own row over the whole form width */
.destination-places.destination-row {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0 0 6px;
}
.destination-title {
  align-self: center;
  margin-right: 2px;
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Phones: one row that scrolls sideways */
@media (max-width: 768px) {
  .destination-places {
    flex-wrap: nowrap;
    overflow-x: auto;
    /* its buttons must not widen the form */
    contain: inline-size;
    width: 100%;
    min-width: 0;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .destination-places::-webkit-scrollbar { display: none; }
  .destination-places > * { flex: none; }
  .form-group:has(.destination-places) { min-width: 0; }
}

/* After "Load" the page scrolls to the result: leave room for the fixed header */
#weatherTable,
#hourlyTableBlock,
#calendar,
#mapContainer {
  scroll-margin-top: calc(var(--header-height, 60px) + 12px);
}

/* Phones: the planets only orbit. Their pulsing glow (animated box-shadow on 5
   moving elements + the sun) repainted every frame and, with the fixed header,
   smeared the page on some phones after a layout change (e.g. language switch). */
@media (max-width: 768px) {
  #weather-orbit-btn,
  #magnetic-orbit-btn,
  #maps-orbit-btn,
  #moon-orbit-btn,
  #holliday-calendar-btn {
    animation-name: orbit !important;
  }

  .sun-center {
    animation: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .orbit-button,
  .sun-center,
  .sun-center::before,
  .sun-center::after {
    animation: none !important;
  }
}

/* Maps: full screen button on the map */
.map-fullscreen-button {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 30;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 215, 0, 0.75);
  border-radius: 8px;
  background: rgba(14, 24, 48, 0.88);
  color: #FFD700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.map-fullscreen-button:hover,
.map-fullscreen-button:focus,
.map-fullscreen-button:active {
  /* keep the look (the general button hover is gold and grows) */
  transform: none;
  background: rgba(14, 24, 48, 0.88);
  color: #FFD700;
  box-shadow: none;
}

.map-fullscreen-button:focus-visible { outline: 2px solid #FFD700; outline-offset: 2px; }

/* The map over the whole screen (above the header and the footer) */
.map-container.map-fullscreen {
  position: fixed !important;
  inset: 0;
  z-index: 3000;
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  min-height: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  animation: none !important;
}

.map-container.map-fullscreen iframe { border-radius: 0; }

.map-fullscreen-open,
.map-fullscreen-open body { overflow: hidden !important; }

/* The map has its own full screen on the page: not in print */
@media print {
  .map-fullscreen-button { display: none !important; }
}

/* "Install as an app" button (js/mobile-nav.js) */
.install-app {
  position: fixed;
  left: 12px;
  bottom: 56px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  max-width: calc(100% - 80px);
}

.install-app[hidden],
.install-app-info[hidden] { display: none !important; }

.install-app-button {
  margin: 0;
  padding: 8px 14px;
  border: 1px solid rgba(255, 215, 0, 0.8);
  border-radius: 999px;
  background: rgba(14, 24, 48, 0.95);
  color: #FFD700;
  font: 600 13px/1.2 'Exo 2', 'Segoe UI', sans-serif;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transform: none !important;
}

.install-app-button:hover,
.install-app-button:focus {
  background: rgba(14, 24, 48, 0.95);
  color: #FFD700;
  transform: none !important;
}

.install-app-close {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 215, 0, 0.6);
  border-radius: 50%;
  background: #162447;
  color: #FFD700;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.install-app { position: fixed; }

.install-app-info {
  margin: 0;
  max-width: 280px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 215, 0, 0.45);
  border-radius: 10px;
  background: rgba(14, 24, 48, 0.97);
  color: #ffffff;
  font-size: 13px;
  line-height: 1.45;
}


/* Weather form: city and number of days on one row (also on phones) */
.form-container.weather-form {
  grid-template-columns: minmax(0, 1fr) 104px !important;
  column-gap: 12px !important;
}

.weather-form > .form-group { min-width: 0; }
.weather-form > .form-group.latitude,
.weather-form > .form-group.longitude,
.weather-form > .destination-row,
.weather-form > .buttons-container {
  grid-column: 1 / -1;
}

.weather-form .form-group.days input { width: 100%; }

/* Coordinates, share and favorite links: one row */
.place-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 16px;
}

.place-actions .coords-toggle + .coords-toggle { margin-left: 0; }

.weather-form > .place-actions {
  grid-column: 1 / -1;
  margin-top: -8px;
}

/* Interval above the hourly table */
.hourly-interval {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: #FFD700;
  font-weight: 600;
}

.hourly-interval select {
  width: auto;
  min-width: 80px;
  margin: 0;
  padding: 6px 10px;
}

@media print {
  .hourly-interval { display: none !important; }
}

/* City pages: monthly climate table */
.table-scroll { overflow-x: auto; }
.climate-table { font-size: 0.85rem; }
.climate-table th,
.climate-table td { padding: 6px 4px; }
.climate-table th:not(:first-child),
.climate-table td:not(:first-child) { text-align: center; }
.climate-table td:not(:first-child) { white-space: nowrap; }
.climate-table td:first-child { text-transform: capitalize; }
.city-climate p { line-height: 1.6; }

/* Divider between the popular places and the recently picked ones */
.places-divider {
  flex: 0 0 1px;
  align-self: center;
  width: 1px;
  height: 1.8em;
  margin: 0 6px;
  background: rgba(255, 215, 0, 0.55);
}
/* A place chip with its ✕ (favorites and recently picked places) */
.place-chip {
  display: inline-flex;
  align-items: center;
}
.place-chip .recent-place {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.place-remove {
  margin: 0;
  padding: 0 7px;
  height: 100%;
  min-height: 28px;
  border: 1px solid rgba(255, 215, 0, 0.45);
  border-left: none;
  border-radius: 0 14px 14px 0;
  background: rgba(22, 36, 71, 0.6);
  color: #FFD700;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  transform: none !important;
}
.place-remove:hover,
.place-remove:focus {
  background: rgba(255, 215, 0, 0.25);
  color: #FFD700;
  transform: none !important;
}

/* Legend for the reliability labels, above the forecast table */
.reliability-legend {
  max-width: 900px;
  margin: 0 auto 14px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 12px;
  background: rgba(14, 24, 48, 0.85);
  color: #ffffff;
  font-size: 0.9rem;
  line-height: 1.45;
}
.legend-title { color: #FFD700; font-weight: 700; margin-bottom: 8px; }
.legend-row { display: flex; gap: 10px; align-items: baseline; margin: 4px 0; }
.legend-row .reliability { flex: 0 0 auto; min-width: 9.5em; }
.legend-text { opacity: 0.95; }
.legend-how { margin: 10px 0 0; font-size: 0.85em; opacity: 0.8; }
@media (max-width: 600px) {
  .legend-row { flex-direction: column; gap: 2px; }
}

/* Weather page: link to the magnetic storms page */
.storms-link { color: var(--gold); font-weight: 600; }

/* The header used to fade in and animate every change on each page load
   (it blinked when moving between pages) */
.nav-header {
  animation: none !important;
  transition: none !important;
}

/* A language other than Bulgarian (the language of the HTML): the page stays
   hidden until /js/mobile-nav.js sees it translated, instead of showing the
   Bulgarian text first. Shown after 2 s at the latest, even if a script fails. */
html.i18n-pending body {
  visibility: hidden;
  animation: i18n-reveal 0s linear 2s forwards;
}

@keyframes i18n-reveal {
  to { visibility: visible; }
}

/* Home: the hero shows at once (its fade-in kept the main text invisible
   for over a second) and reads well on every background */
.hero-title,
.hero-subtitle {
  animation: none !important;
  opacity: 1 !important;
}

.hero-subtitle,
.features-description {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.hero-section { padding: 8px 15px !important; margin: 0 auto !important; }
.hero-title { margin: 0 0 8px !important; }
.hero-subtitle { max-width: 640px; margin: 0 auto 14px !important; }
/* the buttons stick out of the orbit by half their size */
.circular-nav { margin: 52px auto 58px !important; }
.features-section { margin: 10px auto 30px !important; }

/* Home: orbit buttons on a dark glass disc, so the labels read on any
   background (the blue planet used to vanish on the blue background) */
.orbit-container { border: 2px dashed rgba(255, 215, 0, 0.45) !important; }

#weather-orbit-btn,
#magnetic-orbit-btn,
#maps-orbit-btn,
#moon-orbit-btn,
#holliday-calendar-btn {
  width: 88px;
  height: 88px;
  margin-left: -44px;
  margin-top: -44px;
  background: rgba(14, 24, 48, 0.78);
  border: 2px solid rgba(255, 215, 0, 0.6);
}

#weather-orbit-btn { border-color: rgba(0, 170, 255, 0.9); }
#maps-orbit-btn { border-color: rgba(255, 165, 0, 0.9); }
#holliday-calendar-btn { border-color: rgba(255, 100, 150, 0.9); }
#magnetic-orbit-btn { border-color: rgba(180, 110, 255, 0.95); }
#moon-orbit-btn { border-color: rgba(120, 150, 255, 0.95); }

/* Five planets evenly around the 60 s orbit (every 12 s) */
#weather-orbit-btn { animation-delay: 0s, 0s !important; }
#magnetic-orbit-btn {
  animation: orbit 60s linear infinite, stormAura 2.4s ease-in-out infinite;
  animation-delay: -12s, 0s;
  box-shadow: 0 0 25px rgba(180, 110, 255, 0.8), 0 0 50px rgba(180, 110, 255, 0.4);
}
#magnetic-orbit-btn:hover { animation-play-state: paused; }
#holliday-calendar-btn { animation-delay: -24s, 0s !important; }
#moon-orbit-btn {
  animation: orbit 60s linear infinite, moonAura 2.8s ease-in-out infinite;
  animation-delay: -36s, 0s;
  box-shadow: 0 0 25px rgba(110, 140, 255, 0.8), 0 0 50px rgba(110, 140, 255, 0.4);
}
#moon-orbit-btn:hover { animation-play-state: paused; }
#maps-orbit-btn { animation-delay: -48s, 0s !important; }

@keyframes moonAura {
  0%, 100% { box-shadow: 0 0 20px rgba(110, 140, 255, 0.6), 0 0 40px rgba(110, 140, 255, 0.3); }
  50% { box-shadow: 0 0 35px rgba(110, 140, 255, 1), 0 0 70px rgba(110, 140, 255, 0.5); }
}

@keyframes stormAura {
  0%, 100% { box-shadow: 0 0 20px rgba(180, 110, 255, 0.6), 0 0 40px rgba(180, 110, 255, 0.3); }
  50% { box-shadow: 0 0 35px rgba(180, 110, 255, 1), 0 0 70px rgba(180, 110, 255, 0.5); }
}

#weather-orbit-label,
#magnetic-orbit-label,
#maps-orbit-label,
#moon-orbit-label,
#holiday-calendar-label {
  font-family: var(--font-text) !important;
  font-size: 12px !important;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

@media (max-width: 768px) {
  .hero-section { padding: 4px 10px !important; }
  .circular-nav { margin: 44px auto 48px !important; }

  #weather-orbit-btn,
  #magnetic-orbit-btn,
  #maps-orbit-btn,
  #moon-orbit-btn,
  #holliday-calendar-btn {
    width: 74px;
    height: 74px;
    margin-left: -37px;
    margin-top: -37px;
  }

  #weather-orbit-label,
  #magnetic-orbit-label,
  #maps-orbit-label,
  #moon-orbit-label,
  #holiday-calendar-label {
    font-size: 10.5px !important;
    letter-spacing: 0;
  }
}

/* Home: links to the city pages */
.home-cities {
  max-width: 900px;
  margin: 20px auto;
  text-align: center;
}

.home-cities h2 { color: var(--gold); font-size: 1.15rem; }
.home-cities .city-links { justify-content: center; }

@media print {
  @page {
    margin: 12mm;
  }

  html,
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  /* min-height: 100vh (for the fixed footer on screen) is a whole extra
     page on paper */
  body {
    padding-bottom: 0 !important;
    min-height: 0 !important;
    height: auto !important;
  }

  /* Long tables may continue on the next page (older rules kept each
     table in one piece, so it always started on a new page) */
  body #weatherTable,
  body #hourlyTable {
    break-inside: auto !important;
    page-break-inside: auto !important;
  }

  /* "body ..." outranks the !important phone rules in mobile.css, which
     otherwise show the fixed header on every page, over the content */
  body .nav-header {
    display: none !important;
  }

  body .container {
    margin-top: 0 !important;
  }

  /* scroll boxes can't split across pages: the table jumped to the next
     page and got cut off */
  .table-container,
  #hourlyTableBlock {
    overflow: visible !important;
    max-height: none !important;
  }

  /* menus, forms, buttons, banners and collapsed sections stay on screen */
  .nav-header,
  footer,
  .form-container,
  .btn,
  .holiday-ics,
  .cc-banner,
  .cc-settings,
  .offline-notice,
  .recent-places,
  #citySuggestions,
  #weatherTable td div[onclick],
  .table-container::after,
  details:not([open]) {
    display: none !important;
  }

  /* panels: white with a thin gray frame */
  .info-display,
  #selected-city,
  .kp-forecast,
  .space-weather,
  .model-compare,
  .hourly-chart,
  .now-card,
  #calendar,
  #holidayDetails {
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #999999 !important;
    box-shadow: none !important;
  }

  /* gold text becomes black */
  h1,
  h2,
  h3,
  #selected-city,
  #local-time,
  #kp-summary,
  #kp-summary a,
  .kp-day-name,
  .now-place,
  .model-compare summary,
  .kp-outlook summary,
  .month-header,
  .holiday-list .holiday-date,
  #weatherTable td,
  #weatherTable th,
  #hourlyTable td,
  #hourlyTable th {
    color: #000000 !important;
    text-shadow: none !important;
  }

  .temp-range,
  .rain-chance,
  .kp-day-status,
  .aurora-chance,
  .model-note,
  .outlook-note,
  .moon-phase {
    color: #333333 !important;
  }

  /* tables: white cells, thin gray lines */
  #weatherTable,
  #hourlyTable,
  .calendar-table,
  .model-compare table {
    background: #ffffff !important;
    border-collapse: collapse !important;
    box-shadow: none !important;
  }

  #weatherTable th,
  #weatherTable td,
  #hourlyTable th,
  #hourlyTable td,
  .calendar-table th,
  .calendar-table td,
  .model-compare th,
  .model-compare td {
    background: #ffffff !important;
    border: 1px solid #999999 !important;
    box-shadow: none !important;
  }

  #weatherTable th,
  #hourlyTable th,
  .calendar-table th,
  .model-compare th {
    background: #eeeeee !important;
  }

  .holiday-list li {
    border-bottom-color: #cccccc !important;
  }

  .holiday-list li.official .holiday-name {
    color: #b03a2e !important;
  }

  /* colors that carry meaning are kept, a bit darker for paper */
  .kp-scale span,
  .wx-warning,
  .kp-g-scale,
  .outlook-day,
  .solar-wind-status,
  .hourly-chart .chart-rain {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .kp-scale span:not(.on) {
    background: #dddddd !important;
  }

  .reliability.rel-high { color: #1e8449 !important; }
  .reliability.rel-medium { color: #9a7d0a !important; }
  .reliability.rel-low { color: #b03a2e !important; }
  .reliability.rel-rough { color: #555555 !important; }

  .solar-wind-status {
    border: 1px solid #999999;
  }

  .solar-wind-status.wind-calm { background: #e9f7ef !important; color: #1e8449 !important; }
  .solar-wind-status.wind-watch { background: #fef9e7 !important; color: #9a7d0a !important; }

  /* chart: dark line and labels */
  .hourly-chart text { fill: #000000 !important; }
  .hourly-chart .chart-grid { stroke: #cccccc !important; }
  .hourly-chart .chart-line { stroke: #9a7d0a !important; }
  .hourly-chart .chart-dot { fill: #9a7d0a !important; }
  .chart-legend { color: #000000 !important; }
  .legend-line { background: #9a7d0a !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* don't split a row or the chart across pages */
  tr,
  .hourly-chart,
  .kp-forecast,
  .space-weather {
    break-inside: avoid;
  }
}
/* Reserve the height of the loaded forecast so the sections below
   (climate, links) do not jump when it arrives (layout shift) */
.city-forecast { min-height: 590px; }
@media (max-width: 640px) {
  .city-forecast { min-height: 1090px; }
}

/* Sky (/nebeto/): medallion icons in the style of the forecast */
.sky-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.sky-head h2 { margin: 0; }
.wx-medal.wx-medal-xl {
  width: 64px;
  height: 64px;
  min-width: 64px;
  margin: 0;
  border-width: 2px;
  animation: skyGlow 4.5s ease-in-out infinite;
}
.wx-medal.wx-medal-xl svg { width: 46px; height: 46px; }
@keyframes skyGlow {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 215, 0, 0.35), inset 0 0 14px rgba(0, 0, 0, 0.45); }
  50% { box-shadow: 0 0 24px rgba(255, 215, 0, 0.7), inset 0 0 14px rgba(0, 0, 0, 0.45); }
}
.sky-name { display: flex; align-items: center; gap: 10px; }
.sky-name .wx-medal { flex-shrink: 0; margin: 0; width: 42px; height: 42px; }
.sky-name .wx-medal svg { width: 32px; height: 32px; }
.sky-table tbody tr:hover { background: rgba(255, 215, 0, 0.06); }
.sky-eclipse { display: flex; align-items: center; gap: 12px; margin: 16px 0 6px; }
.sky-eclipse h3 { margin: 0; }
@media (prefers-reduced-motion: reduce) {
  .wx-medal.wx-medal-xl { animation: none; }
}
@media (max-width: 640px) {
  .wx-medal.wx-medal-xl { width: 52px; height: 52px; min-width: 52px; }
  .wx-medal.wx-medal-xl svg { width: 38px; height: 38px; }
}

/* The footer sits at the end of the page instead of floating over the content:
   the body reserves its room (mobile.css) and the footer is placed in that room. */
body { position: relative; box-sizing: border-box; padding-bottom: calc(var(--footer-height, 40px) + 40px) !important; }
body footer {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  height: auto !important;
  min-height: var(--footer-height, 40px);
  margin-top: 0 !important;
  box-sizing: border-box;
}
@media print { body footer { position: static !important; } }

/* Premium look (all pages).
   1. Gold only for what matters: the main title, the main action, the selected item.
      Everything else is a quiet light grey-blue.
   2. Exo 2 (the display font, with Cyrillic) only for the logo, the page title and the planets; Inter for the rest.
   3. Panels: hairline border, soft shadow and a translucent dark glass instead of a gold outline
   (no backdrop-filter: it glitches over the fixed gradient background).
   Loaded after the other styles, so it only has to override them. */

:root {
  --font-text: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ink: #f2f4fa;
  --ink-soft: #b9c2d9;
  --line: rgba(255, 255, 255, 0.12);
  --glass: rgba(16, 24, 52, 0.58);
  --glass-strong: rgba(14, 22, 48, 0.78);
  --shadow-soft: 0 10px 30px rgba(4, 8, 24, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --panel: var(--glass-strong);
  --panel-border: var(--line);
  --card-bg: var(--glass);
  --card-border: var(--line);
}

/* ---- 2. type ---- */
html body,
html body input,
html body select,
html body textarea,
html body label,
html body p,
html body li,
html body td,
html body th,
html body h2,
html body h3,
html body .nav-link,
html body .btn,
html body .month-header,
html body footer p {
  font-family: var(--font-text) !important;
}

html body h2,
html body h3 {
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--ink) !important;
  text-shadow: none !important;
}

html body .nav-link,
html body .btn {
  font-weight: 600;
  letter-spacing: 0.01em;
}

html body .btn { text-transform: none; }

html body .features-title { color: var(--ink) !important; font-family: var(--font-text) !important; font-weight: 700; letter-spacing: -0.02em; }
html body .hero-subtitle,
html body .features-description { color: var(--ink-soft) !important; line-height: 1.65; }

/* ---- 1. gold only where it matters ---- */
html body .form-group label,
html body .hourly-interval,
html body .now-card .now-place,
html body .home-cities h2,
html body .kp-day-name,
html body .city-day-date,
html body .city-day-hourly,
html body .day-details-toggle,
html body .dc-line,
html body .dc-sun,
html body .dc-cond { color: var(--ink-soft) !important; }

html body .now-card .now-place { font-weight: 600; letter-spacing: 0.02em; }
html body .kp-day-name { color: var(--ink) !important; font-weight: 650; }
html body .dc-cond { color: var(--ink) !important; }

/* ---- 3. panels ---- */
html body .form-container,
html body .now-card,
html body .info-display,
html body #selected-city:not(:empty),
html body .day-card,
html body .city-day,
html body .day-skel,
html body .features-section,
html body .home-cities,
html body #weatherTable,
html body #hourlyTable tbody tr {
  border: 1px solid var(--line) !important;
  border-radius: 16px;
  background: var(--glass) !important;
  box-shadow: var(--shadow-soft) !important;
}

html body .info-display { border-radius: 14px; }
html body .now-card { background: var(--glass-strong) !important; }
html body .day-card:hover,
html body .city-day:hover { border-color: rgba(255, 215, 0, 0.55) !important; transform: translateY(-2px); }
html body .day-card,
html body .city-day { transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease; }
html body .day-card.selected { border-color: rgba(255, 215, 0, 0.75) !important; background: rgba(255, 215, 0, 0.1) !important; }

/* the current temperature is the figure of the page: big and light */
html body .now-card .now-temp { font-weight: 300; letter-spacing: -0.03em; }
html body .now-block .now-temp { font-size: 3.2em; }
html body .now-card .now-desc,
html body .now-card .now-meta { color: var(--ink-soft); }

/* forms: quiet fields, gold only when focused */
html body .form-group input,
html body .form-group select {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background-color: rgba(10, 16, 40, 0.55) !important;
}
html body .form-group input:focus,
html body .form-group select:focus {
  border-color: rgba(255, 215, 0, 0.8);
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.15);
}
html body .weather-form .form-summary { border-color: var(--line); border-radius: 12px; }

/* city and month pills, quick links: quiet until hovered */
html body .recent-place,
html body .home-quicklinks a {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-weight: 500;
}
html body .recent-place:hover,
html body .home-quicklinks a:hover {
  border-color: rgba(255, 215, 0, 0.7);
  background: rgba(255, 215, 0, 0.1);
  color: #fff;
}

/* buttons: the main one stays gold, the shadow is softer */
html body .btn { border-radius: 10px; box-shadow: 0 4px 14px rgba(4, 8, 24, 0.28); }
html body .btn-primary { box-shadow: 0 6px 18px rgba(255, 200, 0, 0.22); }

/* header and footer: hairlines instead of glow */
html body .nav-header { background: rgba(14, 22, 48, 0.82) !important; border-bottom: 1px solid var(--line); box-shadow: 0 6px 24px rgba(4, 8, 24, 0.25); }
html body footer { background: rgba(14, 22, 48, 0.82) !important; border-top: 1px solid var(--line) !important; box-shadow: none !important; }
html body footer p { color: var(--ink-soft) !important; }

@media (prefers-reduced-motion: reduce) {
  html body .day-card, html body .city-day { transition: none; }
  html body .day-card:hover, html body .city-day:hover { transform: none; }
}

/* the place line and the storms link under the form: quiet, not gold */
html body #selected-city { color: var(--ink) !important; font-weight: 600; background: none !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; }
html body .info-display { padding: 10px 16px; }
html body .storms-link { color: var(--ink-soft) !important; text-decoration-color: rgba(255, 255, 255, 0.3); font-weight: 500; }
html body .storms-link:hover { color: #fff !important; }
html body #local-time { color: var(--ink-soft); }

/* collapsible sections (model comparison) and the print button */
html body details { border: 1px solid var(--line) !important; border-radius: 14px; background: var(--glass) !important; box-shadow: var(--shadow-soft) !important; }
html body details > summary { color: var(--ink) !important; font-weight: 600; }
html body .btn:not(.btn-primary):not(.btn-location) { border: 1px solid rgba(255, 255, 255, 0.2) !important; background: rgba(255, 255, 255, 0.07) !important; color: var(--ink) !important; }

/* Forms fit the screen: inside a centring parent a grid with auto-fit columns shrank to its widest
   layout (3 columns) and stuck out of a narrow screen, which gave a sideways scroll */
.form-container { width: 100%; box-sizing: border-box; }
.map-container { box-sizing: border-box; max-width: 100%; }

/* ---- premium details: spacing rhythm, temperature bar, hover hint, motion, grain, empty states ---- */
:root { --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; }

/* panels follow the same vertical steps (16px between panels, 32px between sections) */
html body .form-container,
html body .now-card,
html body .info-display,
html body details { margin-block: var(--s4); }
html body .features-section,
html body .home-cities { margin-block: var(--s6); }

/* where the day sits between the coldest and the warmest of the period */
.dc-range {
  position: relative;
  display: block;
  height: 4px;
  margin: 6px auto 4px;
  width: 80%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}
.dc-range i {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #5cc8ff, #ffd54a 60%, #ff9a4a);
}

/* "Hourly forecast →" is always shown at the bottom of the day card, as a small button:
   a tester did not know that the cards open the hours (it showed only when pointed at) */
.city-day-hourly {
  margin-top: auto;
  padding: 3px 9px;
  border: 1px solid rgba(255, 215, 0, 0.5);
  border-radius: 999px;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}
.city-day:hover .city-day-hourly,
.city-day:focus-visible .city-day-hourly { background: var(--gold); color: #1b1b2f !important; }
/* a gap above the button when the card is full (two badges above it) */
.city-day > :has(+ .city-day-hourly) { margin-bottom: 7px; }

/* motion: the content rises in, buttons lift, nothing for those who asked for less */
@keyframes wpRise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .container > * { animation: wpRise 0.45s ease backwards; }
  .container > :nth-child(2) { animation-delay: 0.04s; }
  .container > :nth-child(3) { animation-delay: 0.08s; }
  .container > :nth-child(4) { animation-delay: 0.12s; }
  .container > :nth-child(n+5) { animation-delay: 0.16s; }
  html body .btn { transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease; }
  html body .btn:hover { transform: translateY(-1px); }
  html body .btn:active { transform: none; }
}

/* a fine grain over the gradient takes the plastic look off the colour */
html::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.055;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPScxNjAnIGhlaWdodD0nMTYwJz48ZmlsdGVyIGlkPSduJz48ZmVUdXJidWxlbmNlIHR5cGU9J2ZyYWN0YWxOb2lzZScgYmFzZUZyZXF1ZW5jeT0nMC45JyBudW1PY3RhdmVzPScyJyBzdGl0Y2hUaWxlcz0nc3RpdGNoJy8+PGZlQ29sb3JNYXRyaXggdmFsdWVzPScwIDAgMCAwIDEgIDAgMCAwIDAgMSAgMCAwIDAgMCAxICAwIDAgMCAwLjkgMCcvPjwvZmlsdGVyPjxyZWN0IHdpZHRoPScxMDAlJyBoZWlnaHQ9JzEwMCUnIGZpbHRlcj0ndXJsKCNuKScvPjwvc3ZnPg==");
}
@media print { html::after { display: none; } }

/* empty and error messages: a quiet card with an icon instead of a bare line */
.day-msg {
  padding: 22px 16px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  background: rgba(16, 24, 52, 0.5);
  color: var(--ink-soft);
}
.day-msg::before { content: "🌤"; display: block; margin-bottom: 6px; font-size: 1.8rem; }
.day-msg .day-retry { margin-top: 12px; }

/* ---- round 3: folding forms (maps, holidays), calmer titles, storms, scroll hints, skeletons ---- */

/* the form folds into one line once the result is shown (see js/form-fold.js) */
.form-container .form-summary {
  display: none;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.form-container .form-summary:hover { border-color: rgba(255, 215, 0, 0.6); }
.form-container .form-summary .fs-change { color: var(--gold); white-space: nowrap; }
.form-container.collapsed { padding: 10px; }
.form-container.collapsed > .form-summary { display: flex; }
.form-container.collapsed > :not(.form-summary) { display: none !important; }

/* page titles: two lines at most on a phone */
html body .container > h1 { font-size: clamp(1.4rem, 5.4vw, 2.1rem); line-height: 1.2; text-wrap: balance; }

/* storms: the Kp figure as a round gauge, the legend as three coloured chips */
.storm-now-value {
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  margin: 8px auto;
  border: 3px solid currentColor;
  border-radius: 50%;
  font-size: 2.6rem;
  font-weight: 300;
  letter-spacing: -0.03em;
  box-shadow: 0 0 24px -4px currentColor, inset 0 0 18px -8px currentColor;
}
.chart-legend { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 8px; margin-top: 10px; font-size: 0.8rem; color: var(--ink-soft); }
.chart-legend-head { flex: 1 0 100%; text-align: center; }
.chart-key { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, 0.05); }
.chart-key::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.chart-key.key-calm::before { color: #2ecc71; }
.chart-key.key-active::before { color: #f1c40f; }
.chart-key.key-storm::before { color: #e74c3c; }

/* wide tables: a soft edge shows there is more to the side */
.table-scroll {
  background:
    linear-gradient(to right, rgba(16, 24, 52, 0.95) 30%, rgba(16, 24, 52, 0)) left center / 28px 100% no-repeat local,
    linear-gradient(to left, rgba(16, 24, 52, 0.95) 30%, rgba(16, 24, 52, 0)) right center / 28px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0)) left center / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0)) right center / 12px 100% no-repeat scroll;
}
@media (max-width: 600px) {
  .sky-table th:first-child, .sky-table td:first-child { position: sticky; left: 0; z-index: 1; background: rgba(16, 24, 52, 0.96); }
}

/* loading placeholders (storms, city pages) as shimmering blocks */
@keyframes wpShimmer { to { background-position: -200% 0; } }
.storm-loading {
  min-height: 110px;
  margin: 0;
  border-radius: 12px;
  color: transparent !important;
  background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.16) 50%, rgba(255,255,255,0.06) 75%) 0 0 / 200% 100%;
  animation: wpShimmer 1.3s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .storm-loading { animation: none; } }

/* the clear button inside the city field */
.form-group.city input { padding-right: 36px; }
.city-clear {
  position: absolute;
  right: 8px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
  font-size: 12px;
  line-height: 24px;
  cursor: pointer;
  z-index: 2;
}
.city-clear:hover { background: rgba(255, 255, 255, 0.24); }
.city-clear[hidden] { display: none; }

/* data tables: hairlines instead of the bright yellow grid of the old table rule */
html body .kp-table th, html body .kp-table td,
html body .climate-table th, html body .climate-table td,
html body .holiday-table th, html body .holiday-table td,
html body .model-compare th, html body .model-compare td {
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
html body .kp-table, html body .climate-table, html body .holiday-table, html body .model-compare table { border: 1px solid rgba(255, 255, 255, 0.14); }
html body .kp-table, html body .climate-table, html body .holiday-table, html body .model-compare table,
html body .kp-table th, html body .kp-table td, html body .climate-table th, html body .climate-table td,
html body .holiday-table th, html body .holiday-table td, html body .model-compare th, html body .model-compare td { box-shadow: none; }

/* ---- round 4a: desktop layout, focus, page transitions, compact header selectors ---- */

/* one column width for the forecast page: form, "now" block and the info line */
html body .info-display { max-width: 800px; margin-inline: auto; }
html body .now-block { max-width: 800px; }
/* the place is already in the "Now in ..." block */
.info-display.has-now #selected-city { display: none; }
/* the cards follow the number of days: three days stay compact, seven or more use the full width */
#dayCards.day-cards {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  max-width: min(100%, calc(var(--n, 3) * 215px));
}

/* keyboard focus: a clear ring everywhere, and a link to skip the menu */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
.skip-link {
  position: absolute;
  left: 8px;
  top: -64px;
  z-index: 10001;
  padding: 8px 14px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: #0e1630;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 8px; }

/* smooth change between pages (Chrome, Edge, Safari); the header and footer stay still */
@view-transition { navigation: auto; }
.nav-header { view-transition-name: site-header; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.22s; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* header selectors on wide screens: the icon and the box, the word stays for screen readers */
@media (min-width: 769px) {
  html:not(.nav-compact) body .nav-header .header-selectors .form-group { position: relative; padding-left: 20px; }
  html:not(.nav-compact) body .nav-header .header-selectors .form-group label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  html:not(.nav-compact) body .nav-header .header-selectors .form-group::before { top: 50%; transform: translateY(-50%); }
  html:not(.nav-compact) body .nav-header .header-selectors select { width: 100px !important; }
}
.form-group.units::before { content: "🌡️"; }

/* ---- round 4b: chart read-out, moon grid, nearby cities, favorites, imperial units in the hourly strip ---- */

/* hourly chart: the hour you point at, and the current hour */
.hourly-chart { position: relative; }
.chart-hover-line { stroke: rgba(255, 255, 255, 0.55); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.chart-now-line { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 4 3; pointer-events: none; }
.chart-now-label { fill: var(--gold); font-size: 10px; font-weight: 700; pointer-events: none; }
.chart-tip {
  position: absolute;
  top: 4px;
  transform: translateX(-50%);
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 16, 40, 0.92);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
}
.chart-tip[hidden] { display: none; }

/* moon calendar: a month grid with the phase of every day */
.moon-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin: 12px 0 18px; }
.moon-grid[hidden] { display: none; }
.mg-head { padding: 4px 0; text-align: center; font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); text-transform: capitalize; }
.mg-day {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}
.mg-num { font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); }
.mg-icon { font-size: 1.5rem; line-height: 1.1; }
.mg-pct { font-size: 0.7rem; color: var(--ink-soft); }
.mg-key { border-color: rgba(255, 215, 0, 0.55); background: rgba(255, 215, 0, 0.08); }
.mg-today { box-shadow: 0 0 0 2px var(--gold); }
@media (max-width: 480px) { .moon-grid { gap: 3px; } .mg-icon { font-size: 1.15rem; } .mg-pct { display: none; } }

/* other cities nearby (city pages) */
.city-nearby h2 { margin-top: 0; }
.nearby-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.nearby-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.nearby-card:hover { border-color: rgba(255, 215, 0, 0.6); transform: translateY(-2px); }
.nearby-name { font-weight: 600; }
.nearby-temp { display: inline-flex; align-items: center; gap: 4px; font-size: 1.15rem; font-weight: 300; }

/* favorites on the home page show the temperature */
.favorite-place .fav-temp { margin-left: 4px; font-weight: 300; opacity: 0.9; }

/* units in the sideways hourly strip */
html[data-units="imperial"] #hourlyTable tbody td:nth-child(5)::after { content: " in"; }
html[data-units="imperial"] #hourlyTable tbody td:nth-child(7)::after { content: " mph"; }
html body .info-display { min-height: 0 !important; }
html body .nearby-card .nearby-name { color: var(--ink); }

/* Bigger click areas (round 5): the look stays, the hit area grows */
.nav-header .nav-link, .footer-link, .storms-link { position: relative; }
.nav-header .nav-link::after, .footer-link::after, .storms-link::after { content: ""; position: absolute; inset: -9px -4px; }
html body .day-details-toggle { min-height: 40px; }

/* the line about how the forecast is made */
.forecast-note { margin: 10px auto 0; text-align: center; font-size: 0.75rem; color: var(--ink-soft, #c9cde6); opacity: 0.85; }
@media print { .forecast-note { display: none; } }

/* ---- forecast page: no jumps while it loads ----
   The "now" block, the 3/7/14 days row and the details switch are added by the scripts above
   the day cards. Until each of them is there, the cards keep its room as a top margin
   (heights measured on the page; the row of days wraps on phones). */
#main-content { --room-now: 154px; --room-quick: 50px; --room-toggle: 52px; }
@media (max-width: 600px) { #main-content { --room-quick: 104px; } }
#main-content:has(#nowBlock:not([hidden])) { --room-now: 0px; }
#main-content:has(#quickDays) { --room-quick: 0px; }
#main-content:has(#dayDetailsToggle) { --room-toggle: 0px; }
#dayCards.day-cards { margin-top: calc(12px + var(--room-now) + var(--room-quick) + var(--room-toggle)); }
/* the loading cards are as tall as the real ones (short cards on phones, with details on wide screens) */
#dayCards .day-skel { min-height: 253px; }
@media (min-width: 700px) { #dayCards .day-skel { min-height: 420px; } }
.weather-form .form-summary { min-height: 43px; }

/* ---- home and storms: room for the blocks that are filled when the data arrives ---- */
/* home: the "now" card keeps its place while it loads (it is [hidden] until then) */
#nowCard[hidden] { display: flex !important; visibility: hidden; min-height: 103px; }
@media (max-width: 600px) { #nowCard[hidden] { min-height: 155px; } }
/* storms: the Kp gauge */
#stormNow { min-height: 245px; }

/* Wind warnings above the city forecast (js/city-forecast.js, build-forecast.js) */
.city-alerts { display: flex; flex-direction: column; gap: 8px; max-width: 794px; margin: 12px auto 0; box-sizing: border-box; }
.city-alerts[hidden] { display: none; }
.city-alert { margin: 0; padding: 10px 14px; border-radius: 10px; font-weight: 600; color: #1a1a2e; text-align: left; }
.city-alert-yellow { background: #ffd54f; }
.city-alert-orange { background: #ff9800; }
.city-alert-red { background: #e53935; color: #ffffff; }
.city-day-gusts { color: #ffb74d; opacity: 1; font-weight: 600; }
.wind-gust { opacity: 0.75; font-size: 0.9em; }
.wind-gust-strong { color: #ffb74d; opacity: 1; font-weight: 600; }
