/* Weer Ouddorp — coastal weather board.
   Palette slots come from the validated data-viz reference instance:
   series 1 blue, series 2 orange. Dark steps are chosen for the dark
   surface, not flipped from light. */

:root {
  color-scheme: light;
  --surface-0: #f4f4f1;
  --surface-1: #fcfcfb;
  --surface-2: #efeee9;
  --line:      #dedcd4;
  --line-soft: #e9e7e0;
  --text-1:    #0b0b0b;
  --text-2:    #52514e;
  --text-3:    #7c7a73;
  --series-1:  #2a78d6;
  --series-2:  #eb6834;
  --accent:    #1c5cab;
  --accent-ink:#0d366b;
  --good:      #008300;
  --warn:      #eda100;
  --crit:      #e34948;
  --grid:      #e7e5de;
  --band:      #cde2fb;
  --shadow:    0 1px 2px rgba(15,18,22,.05), 0 6px 18px -10px rgba(15,18,22,.18);
  --radius:    14px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #121211;
    --surface-1: #1a1a19;
    --surface-2: #222220;
    --line:      #33332f;
    --line-soft: #2a2a27;
    --text-1:    #ffffff;
    --text-2:    #c3c2b7;
    --text-3:    #8f8e85;
    --series-1:  #3987e5;
    --series-2:  #d95926;
    --accent:    #3987e5;
    --accent-ink:#9ec5f4;
    --good:      #4aa54a;
    --warn:      #c98500;
    --crit:      #e66767;
    --grid:      #2b2b28;
    --band:      #184f95;
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 22px -12px rgba(0,0,0,.7);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #121211;
  --surface-1: #1a1a19;
  --surface-2: #222220;
  --line:      #33332f;
  --line-soft: #2a2a27;
  --text-1:    #ffffff;
  --text-2:    #c3c2b7;
  --text-3:    #8f8e85;
  --series-1:  #3987e5;
  --series-2:  #d95926;
  --accent:    #3987e5;
  --accent-ink:#9ec5f4;
  --good:      #4aa54a;
  --warn:      #c98500;
  --crit:      #e66767;
  --grid:      #2b2b28;
  --band:      #184f95;
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 22px -12px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-1);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.011em; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 2px; }

.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }

.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;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface-0) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 11px 0;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none;
  border-radius: 10px; color: #fff;
  background: linear-gradient(150deg, var(--series-1), var(--accent-ink));
}
.brand-text h1 { font-size: 16px; line-height: 1.2; }
.brand-text p { font-size: 11.5px; color: var(--text-3); letter-spacing: .01em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.updated { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

.btn-icon {
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface-1); color: var(--text-2); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.btn-icon:hover { color: var(--text-1); border-color: var(--text-3); }
.btn-icon:active { transform: scale(.94); }
.btn-icon.spin svg { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn {
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface-1);
  color: var(--text-2); font: inherit; font-size: 13px; padding: 6px 12px;
  cursor: pointer; transition: border-color .15s, color .15s;
}
.btn:hover { color: var(--text-1); border-color: var(--text-3); }

:where(button, a, [tabindex]):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px;
}

/* ---------- layout ---------- */

main { padding: 20px 0 56px; display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--surface-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 14px;
}
.card-head h2 { font-size: 15px; }
.card-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; max-width: 62ch; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.banner {
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line));
  background: color-mix(in srgb, var(--warn) 9%, var(--surface-1));
  color: var(--text-1); border-radius: 11px; padding: 10px 14px; font-size: 13px;
}

/* ---------- hero ---------- */

.hero {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 20px; align-items: center;
  background:
    radial-gradient(120% 140% at 88% 8%, color-mix(in srgb, var(--series-1) 12%, transparent), transparent 62%),
    var(--surface-1);
}
.hero-main { display: flex; align-items: center; gap: 16px; min-width: 0; }
.hero-icon { width: 76px; height: 76px; flex: none; color: var(--series-1); }
.hero-icon svg { width: 100%; height: 100%; }
.hero-temp {
  font-size: clamp(46px, 10vw, 66px); line-height: .96; font-weight: 600;
  letter-spacing: -.035em;
}
.hero-temp .deg { font-size: .40em; font-weight: 500; color: var(--text-3); margin-left: 3px; letter-spacing: 0; }
.hero-cond { font-size: 16px; font-weight: 550; margin-top: 7px; }
.hero-sub { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.skel-num { color: var(--text-3); }

.hero-side {
  display: flex; align-items: center; gap: 16px;
  border-left: 1px solid var(--line-soft); padding-left: 20px;
}
.windrose { width: 108px; height: 108px; flex: none; }
.windrose svg { width: 100%; height: 100%; }
.wind-big { font-size: 27px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.wind-big .unit { font-size: 13px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.wind-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.shore {
  display: inline-block; margin-top: 8px; font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; letter-spacing: .01em;
  border: 1px solid var(--line); color: var(--text-2); background: var(--surface-2);
}
.shore[data-kind="on"]    { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, var(--line)); background: color-mix(in srgb, var(--good) 9%, var(--surface-1)); }
.shore[data-kind="off"]   { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 40%, var(--line)); background: color-mix(in srgb, var(--crit) 9%, var(--surface-1)); }
.shore[data-kind="cross"] { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 42%, var(--line)); background: color-mix(in srgb, var(--warn) 10%, var(--surface-1)); }

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

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile {
  background: var(--surface-1); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 13px 14px; box-shadow: var(--shadow);
}
.tile-k {
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-3); display: flex; align-items: center; gap: 6px;
}
.tile-v { font-size: 23px; font-weight: 600; letter-spacing: -.02em; margin-top: 7px; line-height: 1.15; }
.tile-v .unit { font-size: 12.5px; font-weight: 500; color: var(--text-3); margin-left: 2px; letter-spacing: 0; }
.tile-n { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.meter { margin-top: 9px; height: 4px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 3px; background: var(--series-1); }

/* ---------- charts ---------- */

.chart-card .figure { margin: 0; }
.plot { position: relative; width: 100%; }
.plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.fig-cap { font-size: 11.5px; color: var(--text-3); margin-top: 9px; }

.grid-line { stroke: var(--grid); stroke-width: 1; }
.axis-text { fill: var(--text-3); font-size: 11px; }
.axis-text.strong { fill: var(--text-2); font-weight: 600; }
.now-line { stroke: var(--text-3); stroke-width: 1.5; stroke-dasharray: 3 3; opacity: .75; }
.now-tag { fill: var(--text-2); font-size: 10.5px; font-weight: 600; }
.series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.series-area { stroke: none; }
.past-dim { opacity: .42; }
.crosshair { stroke: var(--text-3); stroke-width: 1; opacity: .5; }
.dot { stroke: var(--surface-1); stroke-width: 2; }
.bar { fill: var(--series-1); }

.range { display: flex; gap: 2px; background: var(--surface-2); border-radius: 9px; padding: 3px; }
.range button {
  border: 0; background: transparent; color: var(--text-3); font: inherit; font-size: 12px;
  font-weight: 550; padding: 4px 11px; border-radius: 7px; cursor: pointer;
}
.range button.is-on { background: var(--surface-1); color: var(--text-1); box-shadow: var(--shadow); }

.legend { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.legend i { width: 12px; height: 3px; border-radius: 2px; flex: none; }

.tooltip {
  position: fixed; z-index: 60; pointer-events: none; opacity: 0;
  transform: translate(-50%, -114%); transition: opacity .1s;
  background: var(--surface-1); color: var(--text-1);
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 28px -12px rgba(0,0,0,.45);
  padding: 8px 11px; font-size: 12.5px; min-width: 128px; white-space: nowrap;
}
.tooltip.on { opacity: 1; }
.tip-t { font-size: 11px; color: var(--text-3); margin-bottom: 5px; font-weight: 600; letter-spacing: .02em; }
.tip-r { display: flex; align-items: center; gap: 7px; justify-content: space-between; }
.tip-r + .tip-r { margin-top: 3px; }
.tip-r b { font-weight: 600; }
.tip-key { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.tip-key i { width: 9px; height: 3px; border-radius: 2px; flex: none; }

/* ---------- hourly ---------- */

.hourly {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px;
  scroll-snap-type: x proximity; scrollbar-width: thin;
}
.hour {
  flex: none; width: 74px; text-align: center; scroll-snap-align: start;
  border: 1px solid var(--line-soft); border-radius: 11px; padding: 10px 6px;
  background: var(--surface-1);
}
.hour.is-now { border-color: var(--series-1); background: color-mix(in srgb, var(--series-1) 7%, var(--surface-1)); }
.hour-t { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.hour-i { width: 26px; height: 26px; margin: 6px auto 4px; color: var(--series-1); }
.hour-i svg { width: 100%; height: 100%; }
.hour-v { font-size: 15px; font-weight: 600; }
.hour-p { font-size: 11px; color: var(--series-1); margin-top: 2px; min-height: 15px; font-weight: 550; }
.hour-w { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ---------- daily ---------- */

.daily { display: flex; flex-direction: column; }
.day {
  display: grid; grid-template-columns: 92px 34px 1fr 148px 96px;
  gap: 14px; align-items: center; padding: 11px 4px;
  border-top: 1px solid var(--line-soft);
}
.day:first-child { border-top: 0; }
.day-n { font-size: 13.5px; font-weight: 550; }
.day-n small { display: block; font-size: 11px; color: var(--text-3); font-weight: 400; }
.day-i { width: 28px; height: 28px; color: var(--series-1); }
.day-i svg { width: 100%; height: 100%; }
.day-range { display: flex; align-items: center; gap: 10px; }
.day-lo, .day-hi { font-size: 13px; width: 34px; flex: none; }
.day-lo { color: var(--text-3); text-align: right; }
.day-hi { font-weight: 600; }
.day-track { flex: 1; height: 5px; border-radius: 3px; background: var(--surface-2); position: relative; min-width: 40px; }
.day-fill { position: absolute; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--series-1), var(--series-2)); }
.day-wind { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.day-wind svg { flex: none; color: var(--text-3); }
.day-rain { font-size: 12.5px; color: var(--text-2); text-align: right; }
.day-rain small { color: var(--text-3); }

/* ---------- sea / sun ---------- */

.pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pair { border: 1px solid var(--line-soft); border-radius: 11px; padding: 12px; }
.pair-k { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.pair-v { font-size: 20px; font-weight: 600; margin-top: 6px; letter-spacing: -.02em; }
.pair-v .unit { font-size: 12px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.pair-n { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.sunbox { display: flex; flex-direction: column; gap: 12px; }
.sun-arc { width: 100%; }
.sun-arc svg { display: block; width: 100%; height: auto; overflow: visible; }
.sun-times { display: flex; justify-content: space-between; font-size: 13px; }
.sun-times div { display: flex; flex-direction: column; gap: 2px; }
.sun-times span { font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.sun-times b { font-size: 17px; font-weight: 600; letter-spacing: -.02em; }

/* ---------- table ---------- */

.table-scroll { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.data th, table.data td { padding: 7px 10px; text-align: right; white-space: nowrap; border-top: 1px solid var(--line-soft); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th { color: var(--text-3); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; border-top: 0; }
table.data tbody tr.now td { background: color-mix(in srgb, var(--series-1) 8%, transparent); font-weight: 600; }

.foot { color: var(--text-3); font-size: 12px; padding-top: 4px; }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .hero-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--line-soft); padding-top: 16px; }
  .day { grid-template-columns: 80px 28px 1fr 78px; row-gap: 6px; }
  .day-wind { display: none; }
}
@media (max-width: 520px) {
  .wrap { width: calc(100% - 22px); }
  .card { padding: 15px; }
  .updated { display: none; }
  .day { grid-template-columns: 74px 26px 1fr 66px; }
  .day-lo, .day-hi { width: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .topbar-actions, .range, .tooltip { display: none; }
  .card { break-inside: avoid; box-shadow: none; }
}
