@font-face {
  font-family: "Fraunces";
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
  src: url("fonts/fraunces-variable.woff2") format("woff2-variations"), url("fonts/fraunces-variable.woff2") format("woff2");
}

:root {
  /* daylight (default / prefers-color-scheme: light) */
  --bg: #eef5f5;
  --panel: #ffffff;
  --panel-raised: #f6fafa;
  --border: #d8e6e6;
  --text: #0c2530;
  --muted: #587478;
  --accent: #0e8f7f;
  --accent-dim: rgba(14, 143, 127, 0.1);

  --green: #16a34a;
  --green-bg: #e5f6ea;
  --blue: #0284c7;
  --blue-bg: #e2f2fb;
  --yellow: #b45309;
  --yellow-bg: #fbf0dd;
  --orange: #c2410c;
  --orange-bg: #fbe8dc;
  --red: #dc2626;
  --red-bg: #fbe1e1;

  --shadow: 0 1px 2px rgba(12, 37, 48, 0.05), 0 8px 24px rgba(12, 37, 48, 0.06);
  --radius-lg: 22px;
  --radius-md: 16px;
  --font-display: "Fraunces", ui-serif, Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #071019;
    --panel: #0e2029;
    --panel-raised: #12262f;
    --border: #1c3944;
    --text: #eaf6f5;
    --muted: #7fa0a6;
    --accent: #39e0c7;
    --accent-dim: rgba(57, 224, 199, 0.12);

    --green: #4ade80;
    --green-bg: rgba(74, 222, 128, 0.13);
    --blue: #38bdf8;
    --blue-bg: rgba(56, 189, 248, 0.13);
    --yellow: #fbbf24;
    --yellow-bg: rgba(251, 191, 36, 0.13);
    --orange: #fb923c;
    --orange-bg: rgba(251, 146, 60, 0.13);
    --red: #f87171;
    --red-bg: rgba(248, 113, 113, 0.13);

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.4);
  }
}

:root[data-theme="dark"] {
  --bg: #071019;
  --panel: #0e2029;
  --panel-raised: #12262f;
  --border: #1c3944;
  --text: #eaf6f5;
  --muted: #7fa0a6;
  --accent: #39e0c7;
  --accent-dim: rgba(57, 224, 199, 0.12);

  --green: #4ade80;
  --green-bg: rgba(74, 222, 128, 0.13);
  --blue: #38bdf8;
  --blue-bg: rgba(56, 189, 248, 0.13);
  --yellow: #fbbf24;
  --yellow-bg: rgba(251, 191, 36, 0.13);
  --orange: #fb923c;
  --orange-bg: rgba(251, 146, 60, 0.13);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.13);

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  background-image: radial-gradient(circle at 15% -10%, var(--accent-dim), transparent 45%);
  background-repeat: no-repeat;
}

main {
  max-width: 460px;
  margin: 0 auto;
  padding: 18px 16px 56px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px 4px;
}

.site-header .brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.site-header h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.01em;
  margin: 0;
}

.site-header .location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.page-nav {
  display: flex;
  justify-content: flex-end;
  margin: -6px 0 -2px;
}

.page-nav a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 2px;
}

.page-nav a:hover {
  text-decoration: underline;
}

.page-nav a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

/* ---------- shared card chrome ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.rise {
  opacity: 0;
  transform: translateY(10px);
  animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- stat tiles ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

/* .panel supplies background/border/shadow; this only adds tile-specific layout */
.stat-tile {
  position: relative;
  border-radius: var(--radius-md);
  padding: 14px 14px 12px;
  overflow: hidden;
}

.stat-tile::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--accent);
  opacity: 0.55;
}

.stat-tile .stat-head {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.stat-tile .stat-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  stroke: var(--muted);
}

.stat-tile .stat-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.stat-tile .stat-value {
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
  letter-spacing: -0.01em;
}

:root:not([data-theme="light"]) .stat-tile .stat-value {
  text-shadow: 0 0 18px var(--accent-dim);
}
:root[data-theme="dark"] .stat-tile .stat-value {
  text-shadow: 0 0 18px var(--accent-dim);
}

.stat-tile .stat-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

.mini-compass {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

/* ---------- rating panel ---------- */

.rating-card {
  padding: 22px 18px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.gauge-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 108px;
  height: 108px;
}

.gauge-wrap svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gauge-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 7;
}

.gauge-arc {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.gauge-tick {
  stroke: var(--border);
  stroke-width: 1.5;
}

.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.1rem;
  line-height: 1;
}

.rating-body {
  min-width: 0;
}

.rating-body .label {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  text-wrap: balance;
  margin: 0 0 3px;
  letter-spacing: -0.01em;
}

.rating-body .score-line {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 6px;
  font-variant-numeric: tabular-nums;
}

.rating-body .score-line strong {
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
}

.rating-body .as-of {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}

.wetsuit-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
}

/* ---------- section headers ---------- */

section h2 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

section h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- why this score ---------- */

.breakdown {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.breakdown-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.83rem;
}

.breakdown-row .name {
  flex: 0 0 100px;
  color: var(--muted);
}

.breakdown-row .bar-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.breakdown-row .bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.breakdown-row .value {
  flex: 0 0 30px;
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

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

.forecast-scroller {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.forecast-day {
  scroll-snap-align: start;
  flex: 0 0 104px;
  border-radius: var(--radius-md);
  padding: 12px 10px;
  text-align: center;
}

.forecast-day .date {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.forecast-day .metric {
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.forecast-day .metric-label {
  font-size: 0.65rem;
  color: var(--muted);
}

/* ---------- history ---------- */

.history-list {
  padding: 4px 16px;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.history-row:last-child {
  border-bottom: none;
}

.h-icon {
  flex: 0 0 auto;
  font-size: 1.4rem;
  line-height: 1;
  width: 28px;
  text-align: center;
}

.h-main {
  flex: 1 1 auto;
  min-width: 0;
}

.h-date {
  font-weight: 700;
  font-size: 0.88rem;
}

.h-sub {
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.h-temp {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.h-pill {
  flex: 0 0 auto;
  min-width: 30px;
  text-align: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8rem;
}

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

footer {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  padding-top: 6px;
}

.error-banner {
  background: var(--orange-bg);
  color: var(--orange);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 0.9rem;
  font-weight: 600;
}
