/*
Theme Name: Seastate
Theme URI: https://seastate.wp.philiprehberger.com/
Author: Philip Rehberger
Description: Live California marine conditions. Per-demo child of the shared _chassis parent.
Template: _chassis
Version: 1.0.0
Text Domain: seastate
*/

/* ---------------------------------------------------------------------------
   Seastate front end.

   Every value here is server-rendered. There is no JavaScript on this page in
   Phase 2 -- the Interactivity API arrives in Phase 3 -- so nothing below is
   waiting on hydration to look finished.
   --------------------------------------------------------------------------- */

:root {
	--sea-deep:    #0b1f33;
	--sea-mid:     #123a5a;
	--sea-line:    #4e9cd0;
	--sea-fill:    rgba(78, 156, 208, 0.18);
	--sea-sand:    #f3ede3;
	--sea-ink:     #0d1b25;
	--sea-muted:   #5b7488;
	--sea-accent:  #e8743b;
	--sea-stale:   #8a7a55;
}

/* Reachable by screen readers, invisible on screen. Used for the chart's data
   table -- an SVG path is unreadable to assistive tech no matter how it is
   labeled, so the numbers exist twice. */
.seastate-visually-hidden {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0);
	white-space: nowrap; border: 0;
}

/* ---------- figures ---------- */

.seastate-conditions__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 1px;
	/* The 1px gap draws the rules, so this color shows only BETWEEN cells --
	   and in any trailing slot the last row does not fill. Using the card
	   color rather than the rule color means a partial row ends cleanly
	   instead of parking a gray rectangle where a ninth metric would go. */
	background: #fff;
	box-shadow: 0 0 0 1px rgba(13, 27, 37, 0.12) inset;
	border: 1px solid rgba(13, 27, 37, 0.12);
	border-radius: 8px;
	overflow: hidden;
}

.seastate-figure {
	outline: 1px solid rgba(13, 27, 37, 0.08);
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	padding: 1rem 1.1rem;
	background: #fff;
	min-height: 104px;
}

.seastate-figure__label {
	font-size: 0.72rem;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	font-weight: 700;
	color: var(--sea-muted);
}

.seastate-figure__value {
	font-size: 2rem;
	font-weight: 700;
	line-height: 1.05;
	color: var(--sea-ink);
	font-variant-numeric: tabular-nums;
}

.seastate-figure__unit {
	font-size: 0.95rem;
	font-weight: 600;
	margin-left: 0.15em;
	color: var(--sea-muted);
}

.seastate-figure__meta {
	font-size: 0.74rem;
	color: var(--sea-muted);
}

/* A stale or absent reading is marked by WORDS as well as by color -- the meta
   line says "no data since 2:10 pm", not just a faded number. Color alone
   would vanish for a color-blind reader and in grayscale. */
.seastate-figure.is-stale .seastate-figure__value,
.seastate-figure--empty .seastate-figure__value--empty {
	color: var(--sea-stale);
	opacity: 0.75;
}

.seastate-figure.is-stale .seastate-figure__meta,
.seastate-figure--empty .seastate-figure__meta {
	color: var(--sea-stale);
	font-style: italic;
}

/* ---------- chart ---------- */

.seastate-chart { margin: 0; }

.seastate-chart__svg {
	width: 100%;
	height: auto;
	aspect-ratio: 720 / 260;
	background: #fff;
	border: 1px solid rgba(13, 27, 37, 0.12);
	border-radius: 8px;
}

.seastate-chart__grid  { stroke: rgba(13, 27, 37, 0.10); stroke-width: 1; }
.seastate-chart__area  { fill: var(--sea-fill); stroke: none; }
.seastate-chart__line  { fill: none; stroke: var(--sea-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.seastate-chart__ylabel { fill: var(--sea-muted); font-size: 11px; text-anchor: end; }
.seastate-chart__xlabel { fill: var(--sea-muted); font-size: 11px; }
.seastate-chart__xlabel--end { text-anchor: end; }

.seastate-chart figcaption {
	font-size: 0.8rem;
	color: var(--sea-muted);
	margin-top: 0.5rem;
	font-weight: 600;
}

.seastate-chart--empty .seastate-chart__empty {
	padding: 3rem 1rem;
	text-align: center;
	color: var(--sea-muted);
	font-style: italic;
	background: #fff;
	border: 1px dashed rgba(13, 27, 37, 0.2);
	border-radius: 8px;
}

/* ---------- map ---------- */

.seastate-map svg {
	width: 100%;
	height: auto;
	max-height: 70vh;
	background: var(--sea-deep);
	border-radius: 8px;
}

.seastate-map__coast {
	fill: none;
	stroke: var(--sea-line);
	stroke-width: 1.4;
	vector-effect: non-scaling-stroke;
}

.seastate-map__marker circle {
	fill: var(--sea-accent);
	stroke: #fff;
	stroke-width: 2;
}

.seastate-map__marker text {
	fill: #dbe7f0;
	font-size: 13px;
	font-weight: 600;
}

.seastate-map__marker.is-active circle { r: 9; stroke: var(--sea-sand); stroke-width: 3; }

/* Shape, not just color: a station with no current reading is an open ring.
   Survives grayscale, color blindness, and a printed page. */
.seastate-map__marker.is-dark circle { fill: none; stroke: var(--sea-muted); stroke-width: 2; }
.seastate-map__marker.is-dark text   { fill: var(--sea-muted); }

.seastate-map__marker:focus-visible circle { stroke: var(--sea-sand); stroke-width: 3; }

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

/* ---------- status panel ---------- */

.seastate-status__headline {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	padding: 1.2rem 1.4rem;
	background: #fff;
	border: 1px solid rgba(13, 27, 37, 0.12);
	border-radius: 8px;
	margin-bottom: 1.8rem;
}

.seastate-status__label {
	font-size: 0.72rem;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	font-weight: 700;
	color: var(--sea-muted);
}

.seastate-status__value {
	font-size: 1.8rem;
	font-weight: 700;
	line-height: 1.1;
	color: var(--sea-ink);
}

.seastate-status__meta { font-size: 0.82rem; color: var(--sea-muted); }

.seastate-status__headline.is-stale .seastate-status__value { color: var(--sea-stale); }
.seastate-status__headline.is-stale .seastate-status__meta  { color: var(--sea-stale); font-style: italic; }

.seastate-status__table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 1.8rem;
	background: #fff;
	border: 1px solid rgba(13, 27, 37, 0.12);
	border-radius: 8px;
	overflow: hidden;
	font-size: 0.88rem;
}

.seastate-status__table caption {
	caption-side: top;
	text-align: left;
	font-size: 0.72rem;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	font-weight: 700;
	color: var(--sea-muted);
	padding: 0 0 0.5rem;
}

.seastate-status__table th,
.seastate-status__table td {
	text-align: left;
	padding: 0.6rem 0.9rem;
	border-bottom: 1px solid rgba(13, 27, 37, 0.08);
}

.seastate-status__table thead th {
	font-size: 0.7rem;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--sea-muted);
	background: rgba(13, 27, 37, 0.03);
}

.seastate-status__table tbody tr:last-child th,
.seastate-status__table tbody tr:last-child td { border-bottom: 0; }

.seastate-status__table tbody th { font-weight: 600; color: var(--sea-ink); }

/* The word carries the state; the color only reinforces it. "ok" and "FAILED"
   are legible in grayscale and to a color-blind reader without the swatch. */
.seastate-status__table .is-ok      { color: #1d6f42; font-weight: 700; }
.seastate-status__table .is-failed  { color: #a3231d; font-weight: 700; }
.seastate-status__table .is-unknown { color: var(--sea-muted); font-style: italic; }

.seastate-status__table td { font-variant-numeric: tabular-nums; }

/* ---------- station cards ---------- */

.seastate-station-card {
	background: #fff;
	border: 1px solid rgba(13, 27, 37, 0.12);
	border-radius: 8px;
	padding: 1.2rem 1.4rem;
	margin-bottom: 0.9rem;
}

.seastate-station-card h2 { margin: 0 0 0.35rem; }
.seastate-station-card a  { text-decoration: none; }
.seastate-station-card a:hover { text-decoration: underline; }

.seastate-conditions__title {
	font-size: 1.5rem;
	margin: 0 0 0.7rem;
}

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

.seastate-header {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 1.5rem;
	padding: 1rem 0;
}

.seastate-header__nav ul {
	display: flex;
	flex-wrap: wrap;
	gap: 1.1rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.seastate-header__nav a {
	font-size: 0.9rem;
	color: var(--sea-muted);
	text-decoration: none;
}

.seastate-header__nav a:hover,
.seastate-header__nav a:focus-visible { color: var(--sea-ink); text-decoration: underline; }
