/* tides.nz — stylesheet.
   Tokens taken from the Tides design system. One file for the whole site so
   it caches once across all 294 pages.

   Fonts are Hanken Grotesk subset to Latin plus the Māori macrons the port
   names need (āēīōū), three weights, WOFF2: 22 KB total against 1,116 KB for
   the full family. The Lobster Two wordmark is an inline SVG path rather
   than a 211 KB font loaded to render five letters. */

@font-face {
  font-family: "Hanken Grotesk";
  src: url("/assets/fonts/HankenGrotesk-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("/assets/fonts/HankenGrotesk-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("/assets/fonts/HankenGrotesk-900.woff2") format("woff2");
  font-weight: 900; font-style: normal; font-display: swap;
}

:root {
  --tide-black: #07100f;
  --tide-black-soft: #0d1a18;
  --tide-ink: #10201d;
  --tide-teal-900: #04302f;
  --tide-teal-700: #0a5a5e;
  --tide-teal-600: #0d7a80;
  --tide-teal-500: #12a0a3;
  --tide-cyan-400: #2fc7cf;
  --tide-cyan-300: #6fdde0;
  --tide-cyan-100: #c9f5f3;
  --tide-yellow-500: #f0d94a;
  --tide-yellow-400: #f6e878;
  --gray-300: #aab5b2;
  --gray-500: #6f7c79;

  --bg-canvas: var(--tide-black);
  --surface-card: var(--tide-black-soft);
  --surface-card-alt: rgba(255, 255, 255, .04);
  --border-subtle: rgba(255, 255, 255, .12);
  --border-strong: rgba(255, 255, 255, .28);
  --text-primary: #fff;
  --text-secondary: var(--gray-300);
  --text-tertiary: var(--gray-500);
  --accent-primary: var(--tide-cyan-400);
  --accent-secondary: var(--tide-yellow-500);
  --focus-ring: var(--tide-cyan-300);

  --font-body: "Hanken Grotesk", system-ui, -apple-system, sans-serif;
  --fw-regular: 400;
  --fw-semibold: 600;
  --fw-black: 900;

  --text-h1: 2.25rem;
  --text-h2: 1.75rem;
  --text-h3: 1.375rem;
  --text-body: 1rem;
  --text-body-s: .875rem;
  --text-label: .8125rem;
  --text-mono-stat: 3.5rem;
  --lh-tight: 1.05;
  --lh-heading: 1.15;
  --lh-body: 1.5;
  --ls-caps: .06em;

  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px;
  --space-10: 40px; --space-12: 48px; --space-16: 64px;

  --radius-sm: 8px; --radius-md: 14px; --radius-lg: 20px; --radius-pill: 999px;
  --container-max: 1040px;

  --shadow-card: 0 8px 24px rgba(0, 0, 0, .45);
  --shadow-glow-cyan: 0 0 32px rgba(47, 199, 207, .35);
  --gradient-wave: linear-gradient(180deg, var(--tide-cyan-300) 0%,
                    var(--tide-teal-500) 45%, var(--tide-teal-700) 100%);
  --ease-standard: cubic-bezier(.4, 0, .2, 1);
  --duration-base: 200ms;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--container-max); margin: 0 auto; padding: 0 var(--space-6) var(--space-16); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

a { color: var(--accent-primary); }

:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.skip {
  position: absolute; left: -9999px; top: 0; background: var(--accent-primary);
  color: var(--tide-black); padding: var(--space-3) var(--space-4); z-index: 10;
  font-weight: var(--fw-semibold);
}
.skip:focus { left: 0; }

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

header.site {
  max-width: var(--container-max); margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-5);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-8);
}

.brand {
  display: inline-flex; align-items: center; color: var(--text-primary);
  text-decoration: none; flex-shrink: 0;
}
.brand svg { width: 104px; height: auto; display: block; }
.brand:hover { color: var(--tide-cyan-100); }

.site-nav { display: flex; align-items: center; gap: var(--space-5); }
.site-nav a {
  color: var(--text-secondary); text-decoration: none;
  font-size: var(--text-body-s); font-weight: var(--fw-semibold);
  transition: color var(--duration-base) var(--ease-standard);
}
.site-nav a:hover { color: var(--accent-primary); }

.nav-cta {
  background: var(--accent-primary); color: var(--tide-black) !important;
  padding: 10px var(--space-4); border-radius: var(--radius-pill);
  white-space: nowrap;
}
.nav-cta:hover { background: var(--tide-cyan-300); }

/* --- typography ------------------------------------------------------- */

h1 {
  font-size: clamp(1.9rem, 5vw, var(--text-h1));
  font-weight: var(--fw-black); line-height: var(--lh-heading);
  letter-spacing: -.02em; margin-bottom: var(--space-2);
}

h2 {
  font-size: var(--text-body); font-weight: var(--fw-semibold);
  line-height: var(--lh-heading); margin-bottom: var(--space-4);
}

.lede { color: var(--text-tertiary); font-size: var(--text-body-s); margin-bottom: var(--space-8); }

.coords {
  color: var(--text-tertiary); font-size: var(--text-body-s);
  font-weight: var(--fw-regular); margin-left: var(--space-3);
}

.crumbs { font-size: var(--text-label); color: var(--text-tertiary); margin-bottom: var(--space-4); }
.crumbs a { color: var(--text-tertiary); text-decoration: none; }
.crumbs a:hover { color: var(--accent-primary); }
.crumbs span { margin: 0 6px; }

.note {
  font-size: var(--text-body-s); color: var(--text-secondary);
  background: var(--surface-card-alt); border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4); margin-bottom: var(--space-5);
}

/* --- panels ----------------------------------------------------------- */

.panel {
  background: var(--surface-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: var(--space-6);
  margin-bottom: var(--space-5);
}

/* --- today: the big stat cards ---------------------------------------- */

.next-tide {
  display: inline-flex; align-items: center; gap: var(--space-2);
  background: var(--surface-card-alt); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill); padding: 10px var(--space-4);
  font-size: var(--text-body-s); color: var(--text-secondary);
  margin-bottom: var(--space-5);
}
.next-tide strong { color: var(--accent-primary); font-weight: var(--fw-semibold); }

.today-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--space-5); margin-bottom: var(--space-8);
}

.today-item {
  position: relative; background: var(--surface-card);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6); overflow: hidden;
  box-shadow: var(--shadow-card);
}

.t-kind {
  display: block; font-size: var(--text-label); color: var(--text-secondary);
  font-weight: var(--fw-semibold); margin-bottom: var(--space-4);
}

.t-time {
  position: absolute; top: var(--space-5); right: var(--space-5);
  background: var(--accent-secondary); color: var(--tide-black);
  font-size: var(--text-label); font-weight: var(--fw-semibold);
  padding: 3px 10px; border-radius: var(--radius-pill);
}

.t-h {
  display: block; font-size: var(--text-mono-stat); font-weight: var(--fw-black);
  line-height: var(--lh-tight); letter-spacing: -.03em;
}
.t-h small {
  font-size: 1.25rem; font-weight: var(--fw-semibold);
  color: var(--text-tertiary); margin-left: 4px;
}

/* --- tide graph ------------------------------------------------------- */

/* The SVG is bounded rather than overflow:visible. With visible overflow a
   label near the top of the plot can paint outside the graph's own box and
   land on top of the tide cards above it. The viewBox has enough padding for
   every label, so clipping costs nothing. */
.graph-wrap { position: relative; }
.tide-graph {
  width: 100%; height: 220px; display: block; overflow: hidden;
}
.tide-graph .grid { stroke: rgba(255, 255, 255, .07); stroke-width: 1; }
.tide-graph .axis { fill: var(--text-tertiary); font-size: 11px; }
.tide-graph .tide-line {
  fill: none; stroke: var(--accent-primary); stroke-width: 2.5;
  stroke-linejoin: round; stroke-linecap: round;
}
.tide-graph .tide-fill { fill: var(--accent-primary); opacity: .12; }
.tide-graph .tide-dot { fill: var(--accent-primary); }
.tide-graph .tide-label {
  fill: var(--text-secondary); font-size: 11px; font-weight: var(--fw-semibold);
}

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

table.tides { width: 100%; border-collapse: collapse; }

table.tides th[scope="row"] {
  text-align: left; vertical-align: top; white-space: nowrap; width: 1%;
  padding: var(--space-4) var(--space-5) var(--space-4) 0;
  border-top: 1px solid var(--border-subtle); font-weight: var(--fw-semibold);
}
table.tides tr:first-child th, table.tides tr:first-child td { border-top: 0; }
table.tides td { padding: var(--space-4) 0; border-top: 1px solid var(--border-subtle); }

.wd { display: block; font-size: var(--text-body-s); }
.dt { display: block; font-size: var(--text-label); color: var(--text-tertiary); font-weight: var(--fw-regular); }

.tide-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); gap: var(--space-3); }
.tide-item { display: flex; flex-direction: column; line-height: 1.35; }

.tide-kind {
  font-size: 11px; text-transform: uppercase; letter-spacing: var(--ls-caps);
  font-weight: var(--fw-semibold); color: var(--text-tertiary);
}
.tide-item.high .tide-kind { color: var(--accent-primary); }
.tide-time { font-size: var(--text-body); font-weight: var(--fw-semibold); }
.tide-h { font-size: var(--text-label); color: var(--text-secondary); }
.tide-h small { opacity: .65; margin-left: 1px; }
.tide-item.empty { color: var(--text-tertiary); font-size: var(--text-body-s); }

/* --- sun & moon ------------------------------------------------------- */

.sunmoon-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: var(--space-4); }
.sm-item { display: flex; flex-direction: column; gap: 2px; }
.sm-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: var(--ls-caps);
  font-weight: var(--fw-semibold); color: var(--text-tertiary);
}
.sm-value { font-size: var(--text-h3); font-weight: var(--fw-black); letter-spacing: -.02em; }

.moon-phase {
  margin-top: var(--space-5); padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-body-s); color: var(--text-secondary);
  display: flex; align-items: center; gap: var(--space-3);
}
.moon-dot {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  background: linear-gradient(90deg, var(--tide-ink) 0 50%, var(--tide-yellow-400) 50%);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}

/* --- app CTA ---------------------------------------------------------- */

.cta {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-6); flex-wrap: wrap;
}
.cta h2 { margin-bottom: var(--space-3); }
.cta-line { font-size: var(--text-h3); font-weight: var(--fw-black); line-height: 1.2; }
.cta-line.accent { color: var(--accent-primary); }
.cta p { color: var(--text-secondary); font-size: var(--text-body-s); margin-top: var(--space-3); max-width: 46ch; }

/* Badge and rating stack together as one unit, so the social proof sits
   directly under the thing it is vouching for. */
.cta-action {
  display: flex; flex-direction: column; align-items: center;
  gap: var(--space-3); flex-shrink: 0;
}

.rating {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.stars { width: 80px; height: 15px; display: block; flex: none; }
.stars .star-bg { fill: rgba(255, 255, 255, .18); }
.stars .star-fg { fill: var(--accent-secondary); }
.rating-text {
  font-size: var(--text-label); color: var(--text-secondary);
  white-space: nowrap;
}
.cta-badge { flex-shrink: 0; }
.cta-badge img { height: 52px; width: auto; display: block; }

/* --- about / nearby --------------------------------------------------- */

.about p { color: var(--text-secondary); font-size: var(--text-body-s); margin-bottom: var(--space-3); }
.about p:last-child { margin-bottom: 0; }

.nearby-list {
  list-style: none; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 var(--space-6);
}
.nearby-list li {
  display: flex; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) 0; border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-body-s);
}
.nearby-list a { text-decoration: none; }
.nearby-list a:hover { text-decoration: underline; }
.km { color: var(--text-tertiary); font-size: var(--text-label); flex: none; }

/* --- search and chips ------------------------------------------------- */

.search-box {
  width: 100%; height: 52px; padding: 0 var(--space-5);
  font-family: inherit; font-size: var(--text-body); color: var(--text-primary);
  background: var(--surface-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-base) var(--ease-standard);
}
.search-box::placeholder { color: var(--text-tertiary); }
.search-box:focus {
  outline: none; border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow-cyan);
}

.chips {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin: var(--space-5) 0 var(--space-8);
}
.chips-label { color: var(--text-tertiary); font-size: var(--text-body-s); }

.chip {
  display: inline-flex; align-items: center; height: 36px; padding: 0 var(--space-4);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-pill);
  color: var(--text-primary); text-decoration: none; font-size: var(--text-body-s);
  font-weight: var(--fw-semibold); white-space: nowrap;
  transition: border-color var(--duration-base) var(--ease-standard),
              color var(--duration-base) var(--ease-standard);
}
.chip:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.chip.active { border-color: var(--accent-primary); color: var(--accent-primary); }

.hero-search { position: relative; margin-bottom: var(--space-6); }

#home-results {
  list-style: none; margin-top: var(--space-2);
  background: var(--surface-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); overflow: hidden;
}
#home-results li { border-bottom: 1px solid var(--border-subtle); }
#home-results li:last-child { border-bottom: 0; }
#home-results a {
  display: block; padding: var(--space-3) var(--space-5);
  color: var(--text-primary); text-decoration: none; font-size: var(--text-body-s);
}
#home-results a:hover { background: var(--surface-card-alt); color: var(--accent-primary); }

/* --- directory -------------------------------------------------------- */

.port-index { columns: 3 210px; column-gap: var(--space-8); list-style: none; }
.port-index li { break-inside: avoid; padding: 6px 0; font-size: var(--text-body-s); }
.port-index a { color: var(--text-secondary); text-decoration: none; }
.port-index a:hover { color: var(--accent-primary); }

.region-h {
  font-size: 11px; text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: var(--text-tertiary); font-weight: var(--fw-semibold);
  margin: var(--space-8) 0 var(--space-3);
}

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

.site-footer {
  max-width: var(--container-max); margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-12);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-label); color: var(--text-tertiary);
}
.site-footer p { margin-bottom: var(--space-3); }
.disclaimer { color: var(--text-secondary); }
.site-footer a { color: var(--text-secondary); }

@media (max-width: 560px) {
  .wrap { padding: 0 var(--space-4) var(--space-12); }
  header.site { padding: var(--space-5) var(--space-4); flex-wrap: wrap; }
  .panel { padding: var(--space-5); }
  .today-strip { grid-template-columns: 1fr 1fr; gap: var(--space-3); }
  .today-item { padding: var(--space-4); }
  .t-h { font-size: 2.25rem; }
  .t-time { position: static; display: inline-block; margin-bottom: var(--space-2); }
  .t-kind { margin-bottom: var(--space-2); }
  .tide-graph { height: 180px; }
  .brand svg { width: 84px; }
}

/* Search result matched via an alias — show which name the visitor typed,
   so "New Plymouth → Port Taranaki" reads as an answer, not a mistake. */
.match-via {
  color: var(--text-tertiary); font-weight: var(--fw-regular);
}
.match-via::after { content: " → "; }

/* Alias page disclosure — names the tide station the data comes from and how
   far away it is. Visible and plain, not a footnote. */
.station-note {
  font-size: var(--text-body-s); color: var(--text-secondary);
  background: var(--surface-card-alt); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: var(--space-3) var(--space-4);
  margin: var(--space-3) 0 var(--space-5);
}
.station-note a { color: var(--accent-primary); }

/* Directory: an alias page names the station it draws from, so the list
   explains itself rather than looking like a duplicate. */
.port-index .via { color: var(--text-tertiary); }
.port-index .via::before { content: " · "; }
