/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --navy-900: #060f1f;
  --navy-800: #0a1628;
  --navy-700: #12213a;

  --color-bg: #ffffff;
  --color-surface: #f1f5fb;
  --color-card: #ffffff;
  --color-text: #0f1c2e;
  --color-text-muted: #55677f;
  --color-border: #dde5f0;

  --color-accent: #38bdf8;
  --color-accent-dark: #0284c7;
  --color-accent-soft: #e0f2fe;

  --color-low: #16a34a;
  --color-mid: #f59e0b;
  --color-high: #ef4444;

  --shadow-card: 0 14px 40px rgba(9, 22, 43, 0.10);
  --shadow-lift: 0 22px 60px rgba(6, 15, 31, 0.28);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Three states, not two. The bare :root above is the complete light palette.
   The media query covers visitors on "system" who have never chosen, and is
   guarded so an explicit light choice still wins on a dark OS. The last block
   lets the toggle win in the other direction. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #0a1628;
    --color-surface: #0f1d33;
    --color-card: #14233d;
    --color-text: #e8eef7;
    --color-text-muted: #9ab0ca;
    --color-border: #24344f;
    --color-accent-soft: #12293f;
    --shadow-card: 0 14px 40px rgba(0, 0, 0, 0.4);
  }
}

:root[data-theme="dark"] {
    --color-bg: #0a1628;
    --color-surface: #0f1d33;
    --color-card: #14233d;
    --color-text: #e8eef7;
    --color-text-muted: #9ab0ca;
    --color-border: #24344f;
    --color-accent-soft: #12293f;
    --shadow-card: 0 14px 40px rgba(0, 0, 0, 0.4);
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 780px; }

h1, h2, h3 { color: var(--color-text); line-height: 1.2; font-weight: 800; letter-spacing: -0.025em; }
h1 { font-size: clamp(31px, 5.4vw, 52px); margin: 0 0 16px; font-weight: 900; }
h2 { font-size: clamp(23px, 3.4vw, 31px); margin: 0 0 16px; }
h3 { font-size: 19px; margin: 28px 0 10px; font-weight: 700; }
p  { margin: 0 0 16px; }

a { color: var(--color-accent-dark); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) a { color: var(--color-accent); } }
:root[data-theme="dark"] a { color: var(--color-accent); }

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

.skip-link {
  position: absolute; left: -999px; top: auto;
  background: var(--color-accent); color: var(--navy-900);
  padding: 12px 18px; border-radius: var(--radius-sm); z-index: 100; font-weight: 700;
}
.skip-link:focus { left: 16px; top: 16px; }

:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }

/* ---------- Header ---------- */
.site-header {
  background: var(--navy-900);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky; top: 0; z-index: 50;
}

.header-inner {
  max-width: 1080px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}

.brand {
  display: flex; align-items: center; gap: 10px; min-height: 44px;
  font-weight: 700; font-size: 18px; text-decoration: none; color: #fff;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(145deg, var(--color-accent), var(--color-accent-dark));
  color: #fff; font-size: 18px;
}

.primary-nav { display: flex; gap: 24px; }
.primary-nav a {
  text-decoration: none; color: #a9bdd4;
  font-size: 15px; font-weight: 600; transition: color .15s;
}
.primary-nav a:hover { color: #fff; }

/* Light/dark switch. Shows the icon of the theme you would switch TO. */
.theme-toggle {
  width: 44px; height: 44px; flex: none; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18); border-radius: var(--radius-sm);
  background: transparent; color: #cfe0f2; cursor: pointer;
  font-size: 18px; line-height: 1;
  transition: background .15s, border-color .15s;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.34); }
.theme-toggle .icon-dark { display: none; }
.theme-toggle .icon-light { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-dark { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-dark { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-light { display: none; }
}

.header-actions { display: flex; align-items: center; gap: 10px; }

.nav-toggle {
  display: none; width: 44px; height: 44px; padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18); border-radius: var(--radius-sm);
  background: transparent; cursor: pointer; position: relative;
}
.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  position: absolute; left: 11px; width: 20px; height: 2px;
  background: #fff; content: "";
}
.nav-toggle-bar { top: 21px; }
.nav-toggle-bar::before { top: -6px; left: 0; }
.nav-toggle-bar::after  { top: 6px;  left: 0; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(1100px 460px at 50% -12%, #1c3559 0%, transparent 66%),
    linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 100%);
  padding: 74px 0 130px;
  text-align: center;
}

/* CSS-only falling snow — no images, no external assets */
.snowfall {
  position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    radial-gradient(2px 2px at 12% 10%, #fff, transparent),
    radial-gradient(2px 2px at 32% 40%, #fff, transparent),
    radial-gradient(1px 1px at 55% 20%, #fff, transparent),
    radial-gradient(2px 2px at 72% 60%, #fff, transparent),
    radial-gradient(1px 1px at 88% 30%, #fff, transparent),
    radial-gradient(2px 2px at 5%  70%, #fff, transparent),
    radial-gradient(1px 1px at 45% 85%, #fff, transparent),
    radial-gradient(2px 2px at 65% 5%,  #fff, transparent),
    radial-gradient(1px 1px at 92% 78%, #fff, transparent);
  background-size: 340px 340px;
  animation: snowdrift 15s linear infinite;
}
@keyframes snowdrift {
  from { background-position: 0 0; }
  to   { background-position: 44px 340px; }
}
@media (prefers-reduced-motion: reduce) { .snowfall { animation: none; } }

.hero .container { position: relative; }

.hero-eyebrow {
  display: inline-block;
  font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--color-accent);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  padding: 6px 14px; border-radius: 999px; margin: 0 0 20px;
}

.hero h1 { color: #fff; }

.hero-question {
  font-family: var(--font-body);
  font-size: clamp(20px, 3.2vw, 30px);
  font-weight: 700; letter-spacing: -.02em; line-height: 1.2;
  color: var(--color-accent);
  margin: 0 0 14px;
}

.hero-sub {
  max-width: 660px; margin: 0 auto;
  font-size: clamp(15px, 2.1vw, 18px); color: #b9cde4;
}

/* Time-sensitive banner on the "today" page. */
.today-status {
  max-width: 660px; margin: 22px auto 0;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md);
  padding: 13px 18px;
  font-size: 15px; color: #cfe4f7;
}
.today-status a { color: #fff; text-decoration: underline; }

/* ---------- Calculator ---------- */
/* pulled up so the cards float over the dark hero */
.calculator-section { padding: 0 0 56px; margin-top: -86px; position: relative; z-index: 2; }

.calculator-grid {
  display: grid; gap: 22px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  align-items: start;
}

.calculator-card,
.results-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 26px;
}

.field { margin-bottom: 18px; }

.field label {
  display: block; font-weight: 600; font-size: 14px; margin-bottom: 7px;
}

.field input,
.field select {
  width: 100%; padding: 13px 14px; font-size: 16px; font-family: inherit;
  color: var(--color-text); background: var(--color-bg);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
}
.field input:focus, .field select:focus { border-color: var(--color-accent); }

.input-row { display: flex; gap: 10px; }
.input-row input { flex: 1 1 auto; min-width: 0; }

.field-hint {
  margin: 6px 0 0; font-size: 13px; color: var(--color-text-muted);
}

.btn-primary {
  width: 100%; padding: 16px 18px; font-size: 15px; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase;
  font-family: inherit; color: #fff;
  background: linear-gradient(145deg, var(--color-accent), var(--color-accent-dark));
  border: 0; border-radius: var(--radius-md); cursor: pointer;
  transition: filter .12s, transform .12s;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
  flex: 0 0 auto; padding: 13px 15px; font-size: 14px; font-weight: 600;
  font-family: inherit; color: var(--color-accent-dark);
  background: var(--color-accent-soft);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  cursor: pointer; white-space: nowrap;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-secondary { color: var(--color-accent); } }
:root[data-theme="dark"] .btn-secondary { color: var(--color-accent); }

.status {
  margin: 14px 0 0; font-size: 14px; font-weight: 600;
  color: var(--color-text-muted);
}
.status-error { color: var(--color-high); }

/* ---------- Results ---------- */
.results-card h2 { margin-bottom: 4px; font-size: 20px; }

.place-name {
  font-size: 14px; font-weight: 600; color: var(--color-text-muted);
  margin-bottom: 10px;
}

/* circular gauge */
.gauge-wrap {
  position: relative; width: 210px; height: 210px; margin: 18px auto 22px;
}
.gauge-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge-ring circle { fill: none; stroke-width: 15; stroke-linecap: round; }
.gauge-track { stroke: var(--color-surface); }
.gauge-fill {
  stroke: var(--color-low);
  stroke-dasharray: 540.354;
  stroke-dashoffset: 540.354;
  transition: stroke-dashoffset .9s cubic-bezier(.22, 1, .36, 1), stroke .4s;
}
.gauge-fill[data-level="mid"]  { stroke: var(--color-mid); }
.gauge-fill[data-level="high"] { stroke: var(--color-high); }

.gauge-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 0 24px;
}
.chance-value {
  font-size: 50px; font-weight: 900; line-height: 1;
  letter-spacing: -0.04em; color: var(--color-text);
}
.chance-label {
  font-size: 13px; font-weight: 600; color: var(--color-text-muted); margin-top: 8px;
}

.metric-list {
  list-style: none; margin: 0 0 8px; padding: 0;
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
}
.metric-list li {
  background: var(--color-surface); border-radius: var(--radius-md);
  padding: 11px 12px; display: flex; flex-direction: column; gap: 2px;
}
.metric-label { font-size: 11px; color: var(--color-text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.metric-value { font-size: 18px; font-weight: 800; }

.breakdown h3 { font-size: 15px; margin: 24px 0 8px; text-transform: uppercase; letter-spacing: .07em; color: var(--color-text-muted); }

.note-list { margin: 0; padding-left: 20px; font-size: 14px; color: var(--color-text-muted); }
.note-list li { margin-bottom: 6px; }

.confidence {
  margin: 20px 0 0; padding-top: 14px;
  border-top: 1px solid var(--color-border);
  font-size: 13px; color: var(--color-text-muted);
}

/* ---------- City grid on regional hubs ---------- */
.city-grid {
  display: grid; gap: 9px;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  margin: 0 0 18px;
}
/* Chips are <a> once the city has its own page, <button> until then. */
.city-chip {
  display: block;
  font-family: inherit; font-size: 15px; font-weight: 600; text-align: left;
  padding: 12px 14px; cursor: pointer; text-decoration: none;
  color: var(--color-text);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color .12s, background .12s;
}
.city-chip:hover { border-color: var(--color-accent); background: var(--color-accent-soft); }
.city-chip span {
  display: block; font-size: 12px; font-weight: 400; color: var(--color-text-muted);
  margin-top: 2px;
}

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; margin: 0 0 18px; }

.data-table, .breakdown-table {
  width: 100%; border-collapse: collapse; font-size: 15px;
}
.breakdown-table { font-size: 14px; }

.data-table th, .data-table td,
.breakdown-table th, .breakdown-table td {
  text-align: left; padding: 11px 12px;
  border-bottom: 1px solid var(--color-border);
}
.data-table th, .breakdown-table th {
  background: var(--color-surface); font-weight: 700; white-space: nowrap;
}
.data-table td:first-child { font-weight: 600; }

/* ---------- Info sections ---------- */
.info-section { padding: 52px 0; }
.info-section-alt { background: var(--color-surface); }
.info-section p { color: var(--color-text-muted); }
.info-section p strong, .info-section li strong { color: var(--color-text); }

.check-list { margin: 0 0 16px; padding-left: 20px; }
.check-list li { margin-bottom: 10px; color: var(--color-text-muted); }

.step-list { margin: 0 0 16px; padding-left: 22px; }
.step-list li { margin-bottom: 12px; color: var(--color-text-muted); }

/* ---------- FAQ ---------- */
.faq-section { padding: 52px 0; }

.faq-section details {
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  margin-bottom: 10px; background: var(--color-card);
}
/* Padding sits on the summary, not the details, so the whole row is the tap
   target rather than a 26px line of text with dead space around it. */
.faq-section summary {
  padding: 15px 19px; cursor: pointer;
  font-weight: 700; font-size: 16px; list-style: none;
}
.faq-section summary::-webkit-details-marker { display: none; }
.faq-section summary::after { content: " +"; color: var(--color-accent); font-weight: 700; }
.faq-section details[open] summary::after { content: " \2212"; }
.faq-section details p { margin: 0; padding: 0 19px 16px; color: var(--color-text-muted); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy-900); color: #8ba3bd;
  padding: 34px 0; text-align: center; margin-top: 20px;
}
.site-footer nav { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.site-footer a {
  font-size: 15px; color: #a9bdd4; text-decoration: none;
  display: inline-block; padding: 10px 6px;
}
.site-footer a:hover { color: #fff; }
.footer-note {
  margin: 14px 0 0; font-size: 13px; color: #63788f;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .calculator-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .container { padding: 0 18px; }
  .header-inner { padding: 12px 18px; flex-wrap: wrap; }
  .nav-toggle { display: block; }

  .primary-nav {
    display: none; width: 100%; flex-direction: column; gap: 0;
    padding-top: 10px;
  }
  .primary-nav.is-open { display: flex; }
  .primary-nav a {
    padding: 14px 2px; border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .hero { padding: 48px 0 110px; }
  .calculator-section { margin-top: -74px; }
  .calculator-card, .results-card { padding: 20px; }
  .input-row { flex-direction: column; }
  .btn-secondary { width: 100%; }
  .info-section, .faq-section { padding: 38px 0; }
  .gauge-wrap { width: 180px; height: 180px; }
  .chance-value { font-size: 42px; }
}
