:root {
  color-scheme: dark;
  --ink: #eef7f6;
  --muted: #91a8aa;
  --dim: #60777a;
  --night: #070b11;
  --panel: #0e2027;
  --panel-soft: #0b1a20;
  --line: #213d45;
  --cyan: #5bd7d2;
  --amber: #f0b34d;
  --green: #8bd3a8;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--night); }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(180deg, #081018 0%, #0b0f14 18%, #091019 48%, #070b11 100%);
  position: relative;
  isolation: isolate;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

a { color: inherit; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 115%, rgba(255, 231, 160, 0.32) 0%, rgba(247, 190, 58, 0.16) 20%, rgba(247, 190, 58, 0.045) 42%, transparent 65%),
    radial-gradient(ellipse at 50% 100%, rgba(255, 213, 102, 0.09), transparent 62%);
  filter: blur(28px);
}

.site-header,
main,
footer {
  width: min(100% - 28px, 1380px);
  margin-inline: auto;
}

.site-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(145, 168, 170, 0.16);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  color: var(--cyan);
  font-family: Georgia, serif;
  font-size: 1rem;
}

.brand strong,
.brand small { display: block; }
.brand strong { font-family: Georgia, serif; font-size: 1.05rem; line-height: 1; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 0.64rem; letter-spacing: 0.11em; text-transform: uppercase; }

.site-nav { display: flex; align-items: center; gap: 4px; margin-inline: auto; }
.site-nav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-size: 0.82rem; text-decoration: none; white-space: nowrap; }
.site-nav a:hover, .site-nav a:focus-visible { color: var(--ink); background: var(--panel); }
.site-nav a[aria-current="page"] { color: var(--cyan); background: rgba(91, 215, 210, 0.08); }

.update-state {
  max-width: 155px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: right;
}

.pulse { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(139, 211, 168, 0.08); }

main { padding: 28px 0 64px; }

section + section { margin-top: 58px; }

.section-kicker,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.section-kicker h1 {
  margin: 0;
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.live-date {
  margin: 20px 0 3px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 650;
}

.catch-reading { display: flex; align-items: end; gap: 12px; }
.catch-value { font-family: Georgia, serif; font-size: clamp(5.8rem, 30vw, 8.5rem); line-height: 0.78; letter-spacing: -0.065em; color: var(--amber); }
.catch-unit { max-width: 78px; padding-bottom: 9px; color: var(--muted); font-size: 0.9rem; line-height: 1.15; }
.catch-range { margin: 26px 0 4px; font-size: 1.05rem; font-weight: 650; }
.catch-context { min-height: 23px; margin: 0; color: var(--muted); font-size: 0.9rem; }

.live-cards {
  display: grid;
  gap: 10px;
}

.today-card,
.signal {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: 0;
  padding: 22px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(14, 32, 39, 0.98), rgba(8, 21, 27, 0.94));
}

.forecast-animation { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; border-radius: inherit; }
.today-card, .mist-signal { box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 222, 148, 0.035); }

.today-card { min-height: 252px; }
.signal { min-height: 188px; }

.signal-label { display: block; color: var(--muted); font-size: 0.72rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; }
.moon-icon { display: block; width: 4.5rem; height: 4.5rem; margin: 20px 0 8px; }
.moon-icon svg, .day-moon svg { display: block; width: 100%; height: 100%; }
.moon-disc { fill: #14252c; }
.moon-light { fill: #e5c777; }
.moon-outline { fill: none; stroke: rgba(238, 247, 246, 0.28); stroke-width: 1.2; }
.moon-signal strong { display: block; font-size: 1.2rem; }
.mist-reading { display: flex; align-items: baseline; gap: 2px; }
.mist-reading strong { font-family: Georgia, serif; font-size: 2.4rem; font-weight: 500; line-height: 1; }
.mist-reading span { color: var(--muted); }
.mist-meter {
  --mist-percent: 0%;
  width: 110px;
  aspect-ratio: 1;
  margin: 18px auto 0;
  display: grid;
  place-items: center;
  position: relative;
  border-radius: 50%;
  background: conic-gradient(var(--cyan) var(--mist-percent), rgba(145, 168, 170, 0.16) 0);
}
.mist-meter::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--panel); }
.mist-meter .mist-reading { position: relative; z-index: 1; }

.weather-details { margin-top: 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.weather-details summary { min-height: 50px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-weight: 650; list-style: none; }
.weather-details summary::-webkit-details-marker { display: none; }
.weather-details summary::after { content: "+"; color: var(--cyan); font-size: 1.25rem; }
.weather-details[open] summary::after { content: "−"; }
.weather-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 14px; padding: 10px 0 22px; }
.weather-item span, .weather-item strong { display: block; }
.weather-item span { color: var(--dim); font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase; }
.weather-item strong { margin-top: 2px; font-size: 1rem; }

.section-heading { display: block; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 2rem; font-weight: 500; line-height: 1; }

.next-days { display: grid; gap: 9px; }
.day-card { display: grid; grid-template-columns: 72px 1fr auto; align-items: center; gap: 12px; padding: 16px; border-radius: 16px; background: var(--panel-soft); }
.day-date strong, .day-date span { display: block; }
.day-date strong { font-size: 0.95rem; }
.day-date span { color: var(--muted); font-size: 0.75rem; }
.day-catch strong { display: block; font-family: Georgia, serif; font-size: 1.7rem; font-weight: 500; line-height: 1; }
.day-catch span { display: block; margin-top: 4px; color: var(--muted); font-size: 0.72rem; }
.day-signals { display: flex; align-items: center; gap: 10px; text-align: right; }
.day-moon { width: 2rem; height: 2rem; }
.day-mist strong, .day-mist span { display: block; }
.day-mist strong { font-size: 0.95rem; }
.day-mist span { color: var(--muted); font-size: 0.68rem; }

.season-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 12px; color: var(--muted); font-size: 0.76rem; }
.season-legend span { display: flex; align-items: center; gap: 6px; }
.season-legend i { width: 17px; height: 3px; display: inline-block; border-radius: 3px; }
.line-live { background: var(--amber); }
.line-baseline { background: var(--cyan); opacity: 0.65; }
.season-chart { width: 100%; }
.season-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.season-chart text { fill: var(--muted); font-family: inherit; font-size: 11px; }
.season-chart .grid { stroke: rgba(145, 168, 170, 0.13); stroke-width: 1; }
.season-chart .baseline-path { fill: none; stroke: var(--cyan); stroke-width: 2; opacity: 0.65; stroke-linecap: round; stroke-linejoin: round; }
.season-chart .live-path { fill: none; stroke: var(--amber); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.season-chart .range-band { fill: rgba(240, 179, 77, 0.13); }
.season-chart .today-line { stroke: var(--ink); stroke-width: 1; opacity: 0.45; }
.season-chart .axis-line { stroke: rgba(145, 168, 170, 0.28); stroke-width: 1; }
.season-chart .today-label { fill: var(--ink); font-weight: 650; }
.season-chart .season-year { fill: var(--ink); font-weight: 650; }
.season-chart .hover-overlay { fill: transparent; touch-action: none; }
.season-chart .hover-guide { stroke: rgba(238, 247, 246, 0.45); stroke-width: 1; }
.season-chart .hover-marker { stroke: var(--night); stroke-width: 2; }
.season-chart [hidden] { display: none; }
.season-chart .baseline-marker { fill: var(--cyan); }
.season-chart .live-marker { fill: var(--amber); }
.season-chart .hover-tooltip rect { fill: #13262d; stroke: var(--line); stroke-width: 1; }
.season-chart .hover-tooltip text { fill: var(--ink); font-size: 11px; }
.season-chart .hover-tooltip .hover-date { font-weight: 650; }

.empty-state { padding: 20px 0; color: var(--muted); }

footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0 22px; border-top: 1px solid rgba(145, 168, 170, 0.12); color: var(--dim); font-size: 0.72rem; }
.github-link { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); text-decoration: none; }
.github-link svg { width: 17px; height: 17px; fill: currentColor; }
.github-link:hover, .github-link:focus-visible { color: var(--ink); }

@media (max-width: 899px) {
  .site-header { flex-wrap: wrap; padding-block: 16px 10px; gap: 14px; }
  .site-nav { order: 3; width: 100%; justify-content: center; }
  .site-nav a { padding: 8px 10px; }
  .update-state { margin-left: auto; }
}

@media (min-width: 640px) {
  .site-header { min-height: 82px; }
  main { padding-top: 42px; }
  .weather-grid { grid-template-columns: repeat(4, 1fr); }
  .next-days { grid-template-columns: repeat(3, 1fr); }
  .day-card { grid-template-columns: 1fr; align-items: start; min-height: 188px; }
  .day-signals { justify-content: space-between; text-align: left; }
}

@media (min-width: 900px) {
  .site-header,
  main,
  footer { width: min(100% - 64px, 1380px); }

  .live-cards { grid-template-columns: 1.65fr 1fr 1fr; }
  .today-card,
  .signal { min-height: 310px; padding: 30px; }
  .today-card { display: flex; flex-direction: column; }
  .today-card .catch-context { margin-top: auto; }
  .moon-icon { width: 6.5rem; height: 6.5rem; margin-top: 34px; }
  .moon-signal strong { font-size: 1.4rem; }
  .mist-signal { display: flex; flex-direction: column; }
  .mist-reading strong { font-size: 3.4rem; }
  .mist-meter { width: 140px; margin-top: auto; }
  .weather-details { margin-inline: 2px; }
  .season-chart { padding: 10px 20px 20px; border-radius: 24px; background: var(--panel-soft); }
}

@media (min-width: 1100px) {
  .next-days { grid-template-columns: repeat(5, 1fr); }
  .day-card { min-height: 176px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

/* Forecast sandbox ------------------------------------------------------ */
.sandbox-mode .live-section { position: sticky; top: 0; z-index: 2; padding-block: 10px; background: var(--night); }
.sandbox-mode .live-cards { grid-template-columns: 1.8fr 1fr; }
.sandbox-mode .today-card, .sandbox-mode .signal { min-height: 200px; padding: 22px; }
.sandbox-mode .live-date { margin-top: 12px; }
.sandbox-mode .catch-value { font-size: clamp(3.5rem, 12vw, 6rem); }
.sandbox-mode .catch-range { margin-top: 18px; font-size: 0.95rem; }
.sandbox-mode .catch-context { font-size: 0.78rem; }
.sandbox-mode .mist-meter { width: 105px; margin-top: 16px; }
.sandbox-controls { margin-top: 30px; }
.sandbox-controls h2 { margin: 0; font-family: Georgia, serif; font-size: 2rem; font-weight: 500; }
.sandbox-intro p, .sandbox-note { color: var(--muted); font-size: 0.85rem; }
.calendar-heading, .weather-heading { display: flex; flex-wrap: wrap; align-items: end; gap: 16px; margin-block: 24px 12px; }
.calendar-heading label { display: grid; gap: 6px; color: var(--muted); font-size: 0.8rem; }
.sandbox-controls select, .sandbox-controls button { min-height: 44px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; }
.sandbox-controls select { font-size: 16px; }
.date-stepper { display: flex; gap: 8px; }
.date-stepper button { width: 44px; padding: 0; font-size: 1.5rem; }
.date-stepper button:disabled { opacity: 0.35; cursor: default; }
.sandbox-controls button { cursor: pointer; font-size: 0.82rem; }
.sandbox-controls button:hover, .sandbox-controls button:focus-visible { border-color: var(--cyan); }
.sandbox-calendar { overflow-x: auto; padding-block: 8px; }
.sandbox-calendar svg { display: block; width: 100%; min-width: 720px; }
.sandbox-calendar text { fill: var(--muted); font: 11px system-ui, sans-serif; }
.calendar-guide { stroke: rgba(238, 247, 246, 0.2); pointer-events: none; }
.december-guide { stroke: rgba(238, 247, 246, 0.8); stroke-dasharray: 2 4; pointer-events: none; }
.sandbox-calendar .new-moon { fill: white; stroke: #14252c; stroke-width: 0.4; font-size: 14px; pointer-events: none; }
.selected-day { fill: rgba(255,255,255,0.13); stroke: white; stroke-width: 2; pointer-events: none; }
.calendar-hit { fill: transparent; cursor: crosshair; }
.calendar-row:focus-visible .calendar-hit { stroke: var(--amber); stroke-width: 2; }
.calendar-key { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 0.74rem; color: var(--muted); }
.calendar-key i { width: 100px; height: 9px; background: linear-gradient(90deg, #142838, #2d939e, #f6cb5b, #f3854d); }
.calendar-key span:last-child { margin-left: 10px; }
.weather-heading { justify-content: space-between; margin-top: 44px; }
.sandbox-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.scenario-weather { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.effect-card { min-width: 0; padding: 18px; border-radius: 16px; background: var(--panel-soft); }
.effect-heading { display: flex; justify-content: space-between; gap: 10px; font-size: 0.86rem; }
.effect-heading > span { font-weight: 650; }
.effect-heading output { color: var(--amber); font-variant-numeric: tabular-nums; }
.effect-plot { width: 100%; margin-top: 12px; touch-action: none; cursor: ew-resize; }
.effect-plot text { fill: var(--muted); font: 11px system-ui, sans-serif; }
.effect-grid { stroke: var(--line); }
.effect-reference { stroke: var(--muted); stroke-dasharray: 3 4; }
.effect-curve { fill: none; stroke: var(--cyan); stroke-width: 2; }
.effect-band { fill: rgba(91, 215, 210, 0.12); }
.histogram-bar { fill: rgba(145, 168, 170, 0.35); }
.effect-selection { stroke: var(--amber); stroke-width: 2; }
.effect-handle { fill: var(--amber); stroke: var(--night); stroke-width: 2; }
.effect-hit { fill: transparent; }
.model-version a { color: var(--cyan); }
@media (min-width: 1100px) { .scenario-weather { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 639px) {
  .calendar-heading label { flex: 1; min-width: 130px; }
  .calendar-heading select { width: 100%; }
  .scenario-weather { grid-template-columns: 1fr; }
  .sandbox-mode .today-card, .sandbox-mode .signal { padding: 16px; min-height: 170px; }
  .sandbox-mode .mist-meter { width: 80px; }
  .sandbox-mode .catch-unit { font-size: 0.72rem; }
  .sandbox-mode .catch-context { display: none; }
  .sandbox-mode .catch-range { font-size: 0.76rem; }
  .sandbox-mode .live-date { font-size: 0.8rem; }
}

#calendar-expand { display: inline-flex; align-items: center; gap: 14px; color: var(--cyan); border-radius: 999px; background: rgba(91, 215, 210, 0.06); }
#calendar-expand svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 150ms ease; }
#calendar-expand[aria-expanded="true"] svg { transform: rotate(180deg); }
.effect-plot:focus-visible { outline: 1px solid var(--amber); outline-offset: 3px; border-radius: 8px; }

.season-modal { width: min(480px, calc(100% - 36px)); padding: 32px; border: 1px solid var(--line); border-radius: 22px; color: var(--ink); background: var(--panel); box-shadow: 0 24px 90px rgba(0, 0, 0, 0.45); }
.season-modal::backdrop { background: rgba(7, 17, 23, 0.65); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.season-modal form { margin: 0; }
.modal-close { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.5rem; cursor: pointer; }
.modal-close:hover { color: var(--ink); background: var(--panel-soft); }
.modal-kicker { color: var(--cyan); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.season-modal h2 { margin: 14px 0 18px; font-family: Georgia, serif; font-size: 2rem; line-height: 1.1; font-weight: 500; }
.season-modal p { color: var(--muted); font-size: 0.9rem; line-height: 1.6; }
.modal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 24px; }
.modal-primary, .modal-secondary { padding: 10px 14px; border-radius: 9px; font: inherit; font-size: 0.82rem; text-decoration: none; cursor: pointer; }
.modal-primary { display: flex; align-items: center; gap: 12px; color: var(--night); background: var(--cyan); font-weight: 650; }
.modal-secondary { border: 1px solid var(--line); color: var(--muted); background: transparent; }
.modal-primary:hover { background: #87e5e1; }
.modal-secondary:hover { color: var(--ink); border-color: var(--muted); }
