/* El Médano wind — salt haze by day, basalt by night. Colour is spent on the wind itself. */

:root {
	color-scheme: light;
	--page: #edf1f2;
	--surface: #fbfcfc;
	--surface-2: #f2f5f6;
	--ink: #15191c;
	--ink-2: #48525a;
	--muted: #6f7980;
	--hair: #dce2e5;
	--axis: #c2cacf;
	--accent: #0a6c8c;          /* forecast: the Atlantic */
	--accent-wash: rgba(10, 108, 140, 0.13);
	--tide: #2c8796;
	--tide-wash: rgba(44, 135, 150, 0.12);
	--wave: #5f7591;
	--night: rgba(21, 25, 28, 0.05);
	--gust-wash: rgba(21, 25, 28, 0.1);
	--good: #0a8a0a;
	--calm-cell: #e6ecef;
	/* share of days / surfable hours: one hue, 0 recedes into the card, more surfable = stronger */
	--seq-0: #e6ecef; --seq-1: #b7d3f6; --seq-2: #5598e7; --seq-3: #1c5cab; --seq-4: #0d366b;
	--focus: #0a6c8c;
	--s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
	--s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
	--font: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
	--font-cond: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
	--gutter: 16px;
	--radius: 10px;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		color-scheme: dark;
		--page: #0c1013;
		--surface: #141a1e;
		--surface-2: #1a2227;
		--ink: #eef3f5;
		--ink-2: #a9b4bb;
		--muted: #7e8a92;
		--hair: #243037;
		--axis: #33414b;
		--accent: #4fb3d4;
		--accent-wash: rgba(79, 179, 212, 0.16);
		--tide: #58b9c6;
		--tide-wash: rgba(88, 185, 198, 0.14);
		--wave: #8ea2bd;
		--night: rgba(0, 0, 0, 0.28);
		--gust-wash: rgba(238, 243, 245, 0.12);
		--good: #2fc12f;
		--calm-cell: #1d272d;
		--seq-0: #1d272d; --seq-1: #184f95; --seq-2: #256abf; --seq-3: #3987e5; --seq-4: #9ec5f4;
		--focus: #4fb3d4;
		--s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
		--s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
	}
}

/* chosen in the header: night mode regardless of the system setting */
:root[data-theme="dark"] {
	color-scheme: dark;
	--page: #0c1013;
	--surface: #141a1e;
	--surface-2: #1a2227;
	--ink: #eef3f5;
	--ink-2: #a9b4bb;
	--muted: #7e8a92;
	--hair: #243037;
	--axis: #33414b;
	--accent: #4fb3d4;
	--accent-wash: rgba(79, 179, 212, 0.16);
	--tide: #58b9c6;
	--tide-wash: rgba(88, 185, 198, 0.14);
	--wave: #8ea2bd;
	--night: rgba(0, 0, 0, 0.28);
	--gust-wash: rgba(238, 243, 245, 0.12);
	--good: #2fc12f;
	--calm-cell: #1d272d;
	--seq-0: #1d272d; --seq-1: #184f95; --seq-2: #256abf; --seq-3: #3987e5; --seq-4: #9ec5f4;
	--focus: #4fb3d4;
	--s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
	--s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 132px; }
body {
	margin: 0;
	background: var(--page);
	color: var(--ink);
	font: 400 16px/1.45 var(--font);
	font-feature-settings: "lnum";
}
h1, h2, h3 { margin: 0; line-height: 1.15; }
p { margin: 0; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* ---------- header ---------- */
.top {
	position: sticky; top: 0; z-index: 20;
	background: color-mix(in srgb, var(--page) 92%, transparent);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--hair);
	padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 0;
}
.top-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; max-width: 1180px; margin: 0 auto; }
.spot h1 { font: 700 26px/1 var(--font-cond); letter-spacing: -0.01em; }
.spot-sub { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.live { font-size: 13px; color: var(--ink-2); text-align: right; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
@media (max-width: 440px) { /* phones: "3 min ago" next to the dot; the full sentence stays for screen readers */
	.live-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.theme-toggle {
	flex: none; width: 40px; height: 40px; display: grid; place-items: center; padding: 0;
	border: 1px solid var(--hair); border-radius: 50%; background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--axis); }
.theme-toggle svg { width: 19px; height: 19px; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live.fresh::before { background: var(--good); }
.live.stale::before { background: #d08a19; }

.tabs { display: flex; gap: 2px; max-width: 1180px; margin: 8px auto 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
	padding: 8px 10px 9px; font-weight: 600; font-size: 15px; color: var(--ink-2);
	text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a.on { color: var(--ink); border-bottom-color: var(--ink); }

.filters {
	display: flex; align-items: center; gap: 10px; max-width: 1180px; margin: 0 auto;
	padding: 6px 0 8px; border-top: 1px solid var(--hair);
}
.thr-label { font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.segmented { display: inline-flex; flex-wrap: wrap; max-width: 100%; background: var(--surface-2); border-radius: 8px; padding: 2px; }
.segmented button {
	border: 0; background: none; padding: 4px 10px; border-radius: 6px; font-weight: 600; font-size: 14px;
	color: var(--ink-2); cursor: pointer; min-width: 44px; min-height: 30px; white-space: nowrap;
	font-variant-numeric: tabular-nums;
}
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--hair); }
@media (pointer: coarse) { .segmented button { min-height: 36px; } } /* fingers, not cursors */
@media (max-width: 360px) { /* the smallest phones: everything in the sticky header on one line each */
	.segmented button { padding: 4px 6px; min-width: 0; }
	.thr-label { font-size: 13px; }
	.filters { gap: 8px; }
	.tabs a { padding: 8px 7px 9px; font-size: 14px; }
}

main { max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter) 40px; }

/* ---------- now: the instrument ---------- */
.now {
	display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px;
	grid-template-areas: "gauge" "recent" "facts";
	padding: 20px 0 24px; border-bottom: 1px solid var(--hair);
}
@media (min-width: 860px) {
	.now { grid-template-columns: 340px minmax(0, 1fr); grid-template-areas: "gauge recent" "facts facts"; align-items: center; }
}
.gauge { grid-area: gauge; }
.recent { grid-area: recent; min-width: 0; }
.facts { grid-area: facts; }
.recent-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.recent-head h3 { font: 700 18px/1.1 var(--font-cond); }
.seg-small button { min-width: 40px; min-height: 30px; padding: 2px 8px; font-size: 13px; }
.recent-stats { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 14px; color: var(--ink-2); margin: 6px 0 4px; }
.recent-stats b { color: var(--ink); font-weight: 600; }
.recent-stats i { display: inline-block; width: 14px; height: 0; border-top: 2.5px solid var(--ink); vertical-align: middle; margin-right: 6px; }
.recent-stats i.k-gust { border-top: 2px solid var(--s2); }
.recent-stats i.k-fc { border-top: 2.5px dashed var(--accent); }
.recent-stats .next { flex-basis: 100%; }
.recent-chart svg { display: block; touch-action: pan-y; }
.t-thr { font-weight: 700; }
.t-tick.cur { fill: var(--ink); font-weight: 700; }
.scale-grad, .scale-bins { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font: 500 12px var(--font-cond); color: var(--muted); margin-top: 8px; }
.scale-grad { gap: 8px; }
.scale-grad i { width: 140px; height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--seq-0), var(--seq-1), var(--seq-2), var(--seq-3), var(--seq-4)); }
.scale-bins span { display: inline-flex; align-items: center; gap: 5px; }
.scale-bins i { width: 16px; height: 10px; border-radius: 2px; }
.scale-bins .scale-note { margin-left: 4px; }
.heat-note { margin-top: 6px; }
.credit { font-size: 12px; color: var(--muted); margin-top: 4px; }
.credit a { color: inherit; }
.t-end { font: 600 12px var(--font-cond); fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.t-end.strong { font: 700 14px var(--font-cond); fill: var(--ink); }

.gauge { display: flex; align-items: center; gap: 18px; }
.dial { width: 156px; height: 156px; flex: none; }
.dial .ring { fill: none; stroke: var(--hair); stroke-width: 10; }
.dial .ring-val { fill: none; stroke-width: 10; stroke-linecap: round; }
.dial .tick { stroke: var(--axis); stroke-width: 1.5; }
.dial .card { fill: var(--muted); font: 600 11px var(--font); }
.dial .arrow { fill: var(--ink); }
.dial .spread { fill: var(--accent-wash); }

.reading .speed { font: 700 64px/0.9 var(--font-cond); letter-spacing: -0.02em; }
.reading .unit { font: 600 18px var(--font-cond); color: var(--ink-2); margin-left: 4px; }
.reading .gust { font: 600 20px/1.2 var(--font-cond); color: var(--ink-2); margin-top: 4px; }
.reading .dirtext { font-size: 15px; color: var(--ink-2); margin-top: 2px; }
.reading .trend { font-size: 14px; margin-top: 8px; color: var(--ink-2); }
.trend .up { color: var(--ink); font-weight: 600; }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--hair); }
@media (min-width: 560px) { .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 0; } }
.fact { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--hair); }
@media (min-width: 560px) { .fact { border-bottom: 0; border-left: 1px solid var(--hair); padding: 2px 14px; } }
.fact h3 { font: 600 14px var(--font); color: var(--ink-2); margin-bottom: 4px; }
.fact .big { font: 700 26px/1.05 var(--font-cond); }
.fact .small { font-size: 14px; color: var(--ink-2); margin-top: 3px; }
.fact .bar { height: 6px; background: var(--surface-2); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.fact .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.check-line { grid-column: 1 / -1; font-size: 14px; color: var(--ink-2); padding-top: 4px; }
.check-line strong { color: var(--ink); }

/* ---------- blocks ---------- */
.block { padding: 26px 0 8px; border-bottom: 1px solid var(--hair); }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 12px; }
.block-head h2 { font: 700 22px/1.1 var(--font-cond); }
.block-note { font-size: 14px; color: var(--ink-2); max-width: 62ch; }
h3.sub { font: 700 17px/1.2 var(--font-cond); margin: 22px 0 8px; }
.prose { font-size: 15px; color: var(--ink-2); max-width: 68ch; }
.prose strong { color: var(--ink); font-weight: 600; }

/* ---------- timeline ---------- */
.layer-toggles { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip {
	display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--hair); background: var(--surface);
	border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink-2); min-height: 30px;
}
.chip[aria-pressed="true"] { color: var(--ink); border-color: var(--ink-2); }
.chip .key { width: 14px; height: 0; border-top: 2px solid currentColor; border-radius: 1px; }
.chip .key.band { height: 8px; border: 0; background: var(--accent-wash); border-top: 2px solid var(--accent); }

.timeline { position: relative; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); }
.tl-scroll { overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: thin; border-radius: var(--radius); }
.tl-scroll svg { display: block; touch-action: pan-x pan-y; }
.tl-body { position: relative; }
.tl-axis { position: absolute; left: 0; top: 0; pointer-events: none; }
.wg-more { display: inline-block; }
.wg-more[open] { flex-basis: 100%; }
.wg-more > summary { list-style: none; display: inline-flex; }
.wg-more > summary::-webkit-details-marker { display: none; }
.wg-more[open] > summary { color: var(--ink); border-color: var(--ink-2); }
.wg-more > .layer-toggles { margin: 8px 0 0; }
.tl-readout {
	position: sticky; left: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px;
	padding: 8px 12px; min-height: 40px; font-size: 14px; color: var(--ink-2);
	border-bottom: 1px solid var(--hair); background: var(--surface); border-radius: var(--radius) var(--radius) 0 0;
}
.tl-readout b { color: var(--ink); font: 700 17px var(--font-cond); }
.tl-readout .when { color: var(--ink); font-weight: 600; }
svg text { font-family: var(--font); }
.t-daylabel { font: 600 13px var(--font); fill: var(--ink); }
.t-daylabel.muted { fill: var(--muted); font-weight: 500; }
.t-tick { font: 500 11px var(--font-cond); fill: var(--muted); font-variant-numeric: tabular-nums; }
.t-lane { font: 600 11px var(--font); fill: var(--muted); }
.t-cell { font: 600 12px var(--font-cond); font-variant-numeric: tabular-nums; }
.t-cell-g { font: 500 10px var(--font-cond); font-variant-numeric: tabular-nums; }
.t-tide { font: 600 10.5px var(--font-cond); fill: var(--ink-2); }
.t-now { font: 700 11px var(--font); fill: var(--ink); }

/* ---------- day list ---------- */
.daylist { list-style: none; margin: 0; padding: 0; max-width: 860px; }
.daylist .empty { padding: 12px 0; }
.daylist .earlier { margin-top: 10px; padding: 14px 0 0; border-top: 1px solid var(--hair); font: 600 14px var(--font); color: var(--ink-2); }
.daylist .earlier + .day { border-top: 0; }
.day { padding: 12px 0 8px; border-top: 1px solid var(--hair); }
.day:first-child { border-top: 0; }
.day.past { opacity: 0.85; }
.day-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 12px; }
.day-name { font: 700 19px/1.15 var(--font-cond); }
.day-name span { font: 500 13px var(--font); color: var(--ink-2); margin-left: 7px; }
.day-surf { font-size: 15px; color: var(--ink); }
.day-surf b { font-weight: 700; }
.day-surf .none { color: var(--muted); }
.day-meta { font-size: 13px; color: var(--ink-2); margin: 1px 0 7px; }
.cells, .axis { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 2px; }
.cell { height: 52px; min-width: 0; border-radius: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-variant-numeric: tabular-nums; }
.cell.none { visibility: hidden; }
.cell.off { opacity: 0.4; }
.cell.obs { box-shadow: inset 0 3px 0 var(--ink); }
.cell .w { font: 700 16px/1 var(--font-cond); }
.cell .g { font: 500 11px/1 var(--font-cond); font-style: normal; opacity: 0.85; }
.cell .arrow-i, .cell .noarrow { display: block; width: 11px; height: 11px; }
.axis { margin-top: 3px; font: 500 10px var(--font-cond); color: var(--muted); }
.axis span { text-align: center; }
@media (min-width: 700px) { .cell { height: 60px; } .cell .w { font-size: 19px; } .cell .g { font-size: 12px; } .axis { font-size: 11px; } .day-name { font-size: 21px; } }
.tide-row { position: relative; height: 30px; margin-top: 4px; }
.tide-row svg { display: block; width: 100%; height: 30px; }
.tide-row .tl { position: absolute; top: 0; transform: translateX(-50%); font: 600 10.5px/1 var(--font-cond); color: var(--ink-2); white-space: nowrap; }
.arrow-i { display: inline-block; width: 12px; height: 12px; vertical-align: -1px; }

/* ---------- tables + small charts ---------- */
.seg-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 10px; font-size: 14px; color: var(--ink-2); }
.tablewrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 520px; }
table.data th { text-align: left; font-weight: 600; color: var(--ink-2); padding: 8px 10px 6px 0; border-bottom: 1px solid var(--axis); white-space: nowrap; }
table.data td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--hair); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.num, table.data th.num { text-align: right; }
table.data tr.super td { font-weight: 600; }
table.data tr.base td { color: var(--ink-2); }
.swatch { display: inline-block; width: 14px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 8px; }
.weightbar { display: inline-block; height: 6px; border-radius: 3px; background: var(--accent); vertical-align: middle; margin-left: 6px; }
.chart { width: 100%; overflow-x: auto; }
.chart svg { display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-2); margin: 6px 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 0; border-top: 2px solid; }
.legend i.box { height: 10px; border: 0; border-radius: 2px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 32px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.scale { display: flex; align-items: center; gap: 2px; font: 500 11px var(--font-cond); color: var(--muted); margin-top: 6px; }
.scale i { width: 22px; height: 8px; border-radius: 2px; }
.empty { padding: 18px 0; color: var(--ink-2); font-size: 15px; }
.cal { display: block; }

/* ---------- tooltip ---------- */
.tip {
	position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--ink);
	border: 1px solid var(--hair); border-radius: 8px; padding: 8px 10px; font-size: 13px; line-height: 1.35;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12); max-width: 240px;
}
.tip b { font: 700 16px var(--font-cond); }

/* ---------- footer ---------- */
.foot { max-width: 1180px; margin: 0 auto; padding: 18px var(--gutter) calc(30px + env(safe-area-inset-bottom)); font-size: 13px; color: var(--ink-2); }
.foot p { margin-top: 6px; max-width: 80ch; }
.foot .jobs { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; }
.foot .ok::before, .foot .bad::before, .foot .warn::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; background: var(--good); }
.foot .warn::before { background: #d08a19; }
.foot .bad::before { background: #d03b3b; }

.loading main { opacity: 0.6; transition: opacity 0.2s; }
@media (max-width: 599px) { .tl-readout { min-height: 84px; align-content: flex-start; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
