/*
  Layout and element styles for theme  "Contour". All values come from tokens.css.
  Sections: base, header and footer, documentation pages (with Downloads and About), Home
  (chart sheet, station search, example), figures (sources diagram, tide-curve plot), motion.
*/

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
/* Night palette: keep the macOS default smoothing. "antialiased" turns off its stem
   darkening, and regular-weight light text on the dark background then renders thin
   and grainy. Bold headings are not affected; the day palette keeps "antialiased". */
@media (prefers-color-scheme: dark) {
  html { -webkit-font-smoothing: auto; -moz-osx-font-smoothing: auto; }
}
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
  overflow-wrap: break-word;
}
svg { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
.wrap { max-width: var(--content-max); margin-inline: auto; padding-inline: var(--gutter); }

h1, h2, h3 { font-family: var(--font-heading); font-weight: var(--font-weight-heading); line-height: var(--line-height-heading); letter-spacing: var(--tracking-heading); text-wrap: balance; }
h1 { font-size: var(--font-size-h1); letter-spacing: var(--tracking-title); line-height: 1.1; margin: 0 0 var(--space-5); }
h2 { font-size: var(--font-size-h2); margin: 0 0 calc(var(--space-h2-content) + var(--space-h2-leading)); }
h3 { font-size: var(--font-size-h3); font-weight: 600; line-height: 1.5; margin: 0 0 var(--space-2); letter-spacing: 0; }
[id] { scroll-margin-top: calc(var(--header-h) + var(--space-4)); }
p { margin: 0 0 var(--space-flow); line-height: var(--line-height-prose); text-wrap: pretty; }
.place { font-family: var(--font-label); font-style: italic; font-weight: 500; }

a { color: var(--color-link); text-underline-offset: 0.2em; text-decoration-thickness: 1px; transition: color var(--duration-fast) var(--easing); }
a:hover { color: var(--color-link-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; border-radius: var(--radius-sm); }

code, pre, kbd { font-family: var(--font-mono); font-feature-settings: var(--font-features-mono); }
code { font-size: 0.85em; background: var(--color-code-bg); color: var(--color-code-text); padding: 0.06em 0.32em; border-radius: var(--radius-sm); overflow-wrap: anywhere; }
/* Code blocks are set on chart ink in both palettes, as the example window is; inline code
   stays a light tint in the text. */
pre { margin: 0 0 var(--space-5); background: var(--color-code-panel); color: var(--color-code-panel-text); padding: var(--space-4) var(--space-5); overflow-x: auto; font-size: 0.8125rem; line-height: 1.7; border-radius: 8px; border: var(--border-width) solid var(--color-code-panel-border); }
pre code { background: none; color: inherit; padding: 0; font-size: inherit; overflow-wrap: normal; }

.lead { font-size: var(--font-size-lead); line-height: var(--line-height-lead); color: var(--color-prose); }
.muted, small { color: var(--color-text-muted); }
.pending { font-style: italic; color: var(--color-text-muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.skip-link { position: absolute; z-index: var(--z-skip); left: var(--space-2); top: -4rem; background: var(--color-bg); color: var(--color-text); padding: var(--space-2) var(--space-3); border: 2px solid var(--color-accent); }
.skip-link:focus { top: var(--space-2); }

/* Status note: a magenta frame, as cautions are printed on a chart */
.note { border: 2px solid var(--color-note-border); background: var(--color-note-bg); color: var(--color-note-text); padding: var(--space-4) var(--space-5); border-radius: var(--radius-sm); margin-block: var(--space-5); }
.note > :first-child { margin-top: 0; }
.note > :last-child { margin-bottom: 0; }
.note strong { color: var(--color-link); }
.note a { color: inherit; }

/* Tables: the wrapper scrolls, the page does not */
.table-wrap { overflow-x: auto; margin-block: var(--space-5); }
table { border-collapse: collapse; width: 100%; font-size: var(--font-size-small); }
.table-wrap table { min-width: 34rem; }  /* narrow screens scroll the table, not the page */
caption { caption-side: top; text-align: left; font-family: var(--font-heading); font-weight: 600; font-size: 1rem; padding-bottom: var(--space-3); }
th, td { text-align: left; vertical-align: top; padding: var(--space-3) var(--space-4) var(--space-3) 0; border-bottom: var(--border-width) solid var(--color-border); }
th:last-child, td:last-child { padding-right: 0; }
thead th { font-family: var(--font-mono); font-size: var(--font-size-label); color: var(--color-text-muted); font-weight: 600; border-bottom: 1.5px solid var(--color-text); white-space: nowrap; vertical-align: bottom; }
tbody th { font-weight: 500; }
td.num, th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
table code { white-space: nowrap; overflow-wrap: normal; }

/* ---------- Header and footer ---------- */
/* The header pins to the top. assets/header.js adds .is-stuck once the page scrolls, which
   brings in the bottom rule; without the script the rule is always there. */
.site-header { position: sticky; top: 0; z-index: var(--z-sticky); background: var(--color-bg); border-bottom: var(--border-width) solid var(--color-border); transition: border-color var(--duration-fast) var(--easing), box-shadow var(--duration-fast) var(--easing); }
.js-header .site-header:not(.is-stuck) { border-bottom-color: transparent; }
.site-header.is-stuck { box-shadow: 0 1px 0 var(--color-border), 0 6px 16px -12px oklch(0 0 0 / 0.35); }
.top-sentinel { position: absolute; top: 0; left: 0; width: 1px; height: 1px; pointer-events: none; }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-6); padding-block: var(--space-4); }
.brand { display: inline-flex; min-height: 24px; align-items: center; gap: var(--space-2); color: var(--color-text); text-decoration: none; font-family: var(--font-mono); font-weight: 600; font-size: 1rem; }
.brand svg { width: 22px; height: 22px; flex: none; }
.brand span { white-space: nowrap; }
.nav-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-1) 0.875rem; font-size: var(--font-size-small); font-weight: 500; }
.nav-list a { display: inline-block; padding-block: 0.375rem; color: var(--color-text); text-decoration: none; }   /* a target at least 24px tall */
.nav-list a:hover { color: var(--color-link); text-decoration: underline; }
.nav-list a[aria-current] { color: var(--color-link); font-weight: 600; text-decoration: underline; text-decoration-thickness: 2px; }

/* Below the width where the links fit beside the brand (phones): brand on one line, the
   navigation one sideways-scrolling row below */
@media (max-width: 48rem) {
  .header-inner { padding-block: var(--space-3) 0; gap: 0 var(--space-4); }
  .nav-wrap { display: contents; }
  .nav-wrap > nav { order: 2; flex: 1 0 100%; min-width: 0; margin-inline: calc(-1 * var(--gutter)); }
  .nav-list { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: var(--space-4); padding: var(--space-1) var(--gutter); font-size: var(--font-size-label);
    mask-image: linear-gradient(to right, transparent, #000 var(--gutter), #000 calc(100% - 2.5rem), transparent); }
  .nav-list::-webkit-scrollbar { display: none; }
  .nav-list li { flex: none; }
  .nav-list a { padding-block: 0.625rem; }   /* a thumb-sized row: 40px tall */
}
.site-footer { font-size: var(--font-size-small); color: var(--color-text-muted); }
/* The footer's rule spans the text, not the gutters, so it lines up with the page above it. */
.footer-inner { --pad: var(--gutter); position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4) var(--space-6); padding-block: var(--space-6) var(--space-7); padding-inline: var(--pad); }
.footer-inner::before { content: ""; position: absolute; top: 0; inset-inline: var(--pad); border-top: var(--border-width) solid var(--color-border); }
.footer-brand { display: grid; justify-items: start; gap: var(--space-2); }
.footer-brand .brand { font-size: var(--font-size-small); }
.footer-brand .brand svg { width: 18px; height: 18px; }
.footer-inner p { margin: 0; max-width: 62ch; }
.footer-inner p a { color: inherit; }
.footer-inner p a:hover { color: var(--color-link); }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); font-weight: 500; }
.footer-links a { display: inline-block; padding-block: 0.25rem; color: var(--color-text); text-decoration: none; }
.footer-links a:hover { color: var(--color-link); text-decoration: underline; }

/* ---------- Documentation pages ---------- */
.doc { padding-block: var(--space-5) var(--space-7); }
/* Running text fills its column, the same width as the tables and figures in it. Line length
   is set by the column: a stand-alone page (.wrap.doc) is as wide as a docs page's content,
   and keeps its left edge on the header's. */
.wrap.doc { max-width: calc(var(--measure-page) + 2 * var(--gutter)); margin-inline: max(0px, (100% - var(--content-max)) / 2) auto; }
.doc > .table-wrap.narrow { max-width: var(--measure); }
/* The page title sits on a graduated neatline, the border of a printed chart */
.doc > h1 {
  margin-bottom: var(--space-4);
  background:
    repeating-linear-gradient(to right, var(--color-text) 0 48px, transparent 48px 96px) left bottom / 100% 5px no-repeat,
    linear-gradient(var(--color-text), var(--color-text)) left calc(100% - 9px) / 100% 1px no-repeat;
  padding-bottom: calc(var(--space-3) + 10px);
}
.doc > h1 + .lead { margin-bottom: var(--space-5); }
/* Running text one step softer than headings; bold run-in labels keep the heading colour */
.doc p, .doc li, .doc dd { color: var(--color-prose); }
.doc li, .doc dd { line-height: var(--line-height-prose); }
.doc :is(p, li, dd) strong { color: var(--color-text); font-weight: 600; }   /* aimock card titles: 600, not 700 */
.doc .note p, .doc .note li { color: var(--color-note-text); }
.doc h2 { font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.85rem); margin-top: calc(var(--space-section) + var(--space-h2-leading)); letter-spacing: var(--tracking-doc); }
.doc > :is(h1, .lead) + h2 { margin-top: var(--space-4); }   /* no section gap straight under the title */
.doc h3 { font-size: 1.25rem; line-height: 1.3; margin-top: var(--space-6); margin-bottom: var(--space-3); letter-spacing: var(--tracking-doc); }
.doc h2 + h3 { margin-top: var(--space-4); }
.doc h4 { font-family: var(--font-heading); font-size: var(--font-size-h3); font-weight: 600; margin: var(--space-5) 0 var(--space-2); }

.doc ul, .doc ol { padding-left: 1.3rem; }
.doc li { margin-block: var(--space-2); }
.doc li::marker { color: var(--color-text-muted); }
.doc ol > li::marker { color: var(--color-link); font-weight: 600; font-family: var(--font-mono); font-size: 0.9em; }
.doc em { font-style: italic; }
.doc pre { white-space: pre-wrap; }  /* citations and commands wrap instead of scrolling */

/* Definition lists: a label column on wide screens, as in a chart's source diagram */
.doc dl { margin: var(--space-4) 0 var(--space-5); display: grid; grid-template-columns: minmax(9rem, 13rem) 1fr; gap: 0 var(--space-5); }
.doc dt { font-family: var(--font-heading); font-weight: 600; padding-block: var(--space-3); border-top: var(--border-width) solid var(--color-border); }
.doc dd { margin: 0; padding-block: var(--space-3); border-top: var(--border-width) solid var(--color-border); }
.doc dd > :last-child { margin-bottom: 0; }
.doc section { margin-top: var(--space-6); }
.doc section > h3 { margin-top: 0; padding-top: var(--space-5); border-top: 2px solid var(--color-text); }
@media (max-width: 40rem) {
  .doc dl { grid-template-columns: 1fr; }
  .doc dt { padding-bottom: 0; }
  .doc dd { border-top: 0; padding-top: var(--space-1); }
}

/* Section rhythm on every text page: each h2 opens a section under a hairline, with a wide gap
   above it and a tight one below, as the sections on Home are set apart. Running text keeps a
   line of about 70 characters (36rem of the body face; 70ch would be about 95 characters, as
   ch is the width of a zero); tables, code and figures keep the column's full width. */
.doc { --sec-gap: clamp(2rem, 1.6rem + 1.2vw, 3rem); }
.doc > h2 { margin-top: var(--sec-gap); padding-top: var(--space-5); border-top: var(--border-width) solid var(--color-border); }
.doc > :is(h1, .lead) + h2 { margin-top: var(--space-6); }
.doc > :is(p, ul, ol), .doc > .note { max-width: var(--measure-prose); }
.doc > .lead { max-width: calc(var(--measure-prose) * 1.2); }
.doc :is(li, dd, section > p, dd p, li p, details > p) { max-width: var(--measure-prose); }   /* nested text too: lists, definitions, set sections */   /* the same line length in its larger size */

/* Stand-alone pages (Why, Downloads, About, 404) use Home's section grid on wide screens: the
   heading in a narrow column, its text beside it, the hairline across both. On phones and
   tablets they are one column, as before. */
@media (min-width: 64rem) {
  .wrap.doc { --head-col: clamp(15rem, 6rem + 12vw, 20rem); max-width: calc(var(--head-col) + 46rem + 2 * var(--gutter)); display: grid; grid-template-columns: var(--head-col) minmax(0, 46rem); row-gap: 0; align-items: start; container-type: inline-size; }
  .wrap.doc > * { grid-column: 2; }
  .wrap.doc > :is(h1, .lead) { grid-column: 1 / -1; }
  .wrap.doc > p:not(h2 ~ p) { grid-column: 1 / -1; }   /* the introduction, before the first section */
  .wrap.doc > h2 { position: relative; grid-column: 1; grid-row-end: span 6; padding-right: var(--space-6); border-top: 0; font-size: clamp(1.35rem, 1.1rem + 0.5vw, 1.6rem); }
  .wrap.doc > h2::before { content: ""; position: absolute; top: 0; left: 0; width: 100cqw; border-top: var(--border-width) solid var(--color-border); }   /* one hairline across both columns */
  .wrap.doc > h2 + * { margin-top: var(--sec-gap); padding-top: calc(var(--space-5) + 0.35rem); }
  .wrap.doc > :is(h1, .lead) + h2, .wrap.doc > :is(h1, .lead) + h2 + * { margin-top: var(--space-6); }
}

/* A list of tasks (Documentation, "In production"): each item a bold run-in and running text,
   ruled apart and marked with a tidal diamond, as the points on Home are. Unlike Home's points,
   the text runs on as a paragraph, so inline code wraps with the words around it. */
.doc ul.tasks { list-style: none; padding: 0; margin: var(--space-4) 0 var(--space-5); }
.doc .tasks li { position: relative; margin: 0; padding: var(--space-3) 0 var(--space-3) 1.75rem; border-top: var(--border-width) solid var(--color-border); }
.doc .tasks li:last-child { border-bottom: var(--border-width) solid var(--color-border); }
.doc .tasks li::before { content: ""; position: absolute; left: 0.2rem; top: calc(var(--space-3) + 0.55em); width: 0.55rem; height: 0.55rem; border: 2px solid var(--color-accent); transform: rotate(45deg); }
.doc .tasks li > strong:first-child { margin-right: 0.25em; }
.doc .tasks code { overflow-wrap: break-word; }   /* break a code span at its spaces, not mid-name */

/* Documentation layout, as on the aimock docs: a fixed left sidebar (260px) under the header
   that scrolls on its own, the text in a centred column of at most 960px, and a sticky
   "On this page" list (220px) at the right edge. --docs-top is the header height, set by
   assets/docs.js. */
.docs-layout { display: flex; min-height: calc(100vh - var(--docs-top, 4rem)); }
.sidebar { position: fixed; top: var(--docs-top, 4rem); left: 0; z-index: 15; width: var(--sidebar-w); height: calc(100vh - var(--docs-top, 4rem)); overflow-y: auto; background: var(--color-surface); border-right: var(--border-width) solid var(--color-border); padding: var(--space-5) 0; scrollbar-width: thin; }
.sidebar-section { padding: 0 1.25rem; margin-bottom: var(--space-5); }
.sidebar-title { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600; color: var(--color-text-muted); margin: 0 0 var(--space-2); padding: 0 var(--space-2); }
.sidebar-section a { display: block; padding: 0.35rem 0.75rem; border-radius: 6px; font-size: 0.85rem; line-height: 1.4; color: var(--color-prose); text-decoration: none; transition: color var(--duration-fast) var(--easing), background var(--duration-fast) var(--easing); }
.sidebar-section a:hover { color: var(--color-text); background: var(--color-bg); }
.sidebar-section a.active { color: var(--color-link); background: var(--color-accent-glow); font-weight: 600; }
.docs-content { flex: 1; min-width: 0; max-width: 960px; padding: 2rem 4rem 2.5rem; margin-right: auto; margin-left: calc(var(--sidebar-w) + max(0px, (100vw - var(--sidebar-w) - 220px - 960px) / 2)); }
.page-toc { position: sticky; top: 80px; align-self: flex-start; flex-shrink: 0; width: 220px; max-height: calc(100vh - 100px); overflow-y: auto; padding: var(--space-4) var(--space-4) var(--space-4) 0; font-size: 0.78rem; scrollbar-width: thin; }
.page-toc-label { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600; color: var(--color-text-muted); margin: 0 0 var(--space-2); padding: 0 0.5rem; }
.page-toc a { display: block; padding: 0.3rem 0.5rem; border-radius: 4px; color: var(--color-text-muted); text-decoration: none; line-height: 1.4; transition: color var(--duration-fast) var(--easing), background var(--duration-fast) var(--easing); }
.page-toc a.toc-h3 { padding-left: 1.25rem; }
.page-toc a:hover { color: var(--color-text); }
.page-toc a.active { color: var(--color-link); background: var(--color-accent-glow); }
.sidebar-toggle { display: none; font: inherit; font-size: 1.25rem; line-height: 1; color: var(--color-text); background: none; border: 0; padding: 0.25rem; margin-right: var(--space-2); cursor: pointer; }
/* The footer lines up with the text column */
body:has(.docs-layout) .site-footer { margin-left: calc(var(--sidebar-w) + max(0px, (100vw - var(--sidebar-w) - 220px - 960px) / 2)); max-width: 960px; }
body:has(.docs-layout) .footer-inner { --pad: 4rem; max-width: none; }
@media (max-width: 75rem) {   /* 1200px: the right list is hidden */
  .page-toc { display: none; }
  .docs-content, body:has(.docs-layout) .site-footer { margin-left: calc(var(--sidebar-w) + max(0px, (100vw - var(--sidebar-w) - 960px) / 2)); }
}
@media (max-width: 64rem) {   /* 1024px */
  .docs-content { padding: 2rem; margin-left: var(--sidebar-w); margin-right: 0; }
  body:has(.docs-layout) .site-footer { margin-left: var(--sidebar-w); }
  body:has(.docs-layout) .footer-inner { --pad: 2rem; }
}
@media (max-width: 48rem) {   /* 768px: the sidebar slides in from the left */
  .sidebar-toggle { display: block; }
  .header-inner:has(.sidebar-toggle) { justify-content: flex-start; }
  .sidebar { transform: translateX(-100%); transition: transform 300ms var(--easing-expo); }
  .sidebar.open { transform: translateX(0); }
  .docs-content, body:has(.docs-layout) .site-footer { margin-left: 0; }
  .docs-content { padding: var(--space-5) var(--gutter); }
  body:has(.docs-layout) .footer-inner { --pad: var(--gutter); }
}

/* Downloads: Formats and Locations as an accordion, closed by default */
.doc > .accordion { max-width: none; margin-top: var(--space-6); border-top: var(--border-width) solid var(--color-border); }
.accordion details { border-bottom: var(--border-width) solid var(--color-border); }
.accordion summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-4); padding: var(--space-4) 0; cursor: pointer; list-style: none; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::before { content: "+"; font-family: var(--font-mono); font-weight: 600; color: var(--color-link); width: 1ch; }
.accordion details[open] > summary::before { content: "\2212"; }
.doc .accordion summary :is(h2, h3) { margin: 0; font-size: 1.25rem; }
.acc-hint { color: var(--color-text-muted); font-size: var(--font-size-small); }
.acc-body { padding-bottom: var(--space-5); }
.acc-body > :first-child { margin-top: 0; }

/* Downloads: the release list, one entry per release (assets/releases.js) */
.doc > .releases { max-width: none; }
.exports .rel-files caption { font-family: var(--font-mono); border-top: 0; }
/* While the list loads, and without JavaScript: a quiet row in the place of the first entry */
.doc .rel-wait { border: var(--border-width) dashed var(--color-border); border-radius: var(--radius-md); padding: var(--space-4) var(--space-5); margin: 0 0 var(--space-4); color: var(--color-text-muted); font-size: var(--font-size-small); }
.rel { border: var(--border-width) solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-4) var(--space-5); margin-bottom: var(--space-4); }
.rel-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.doc .rel h3 { margin: 0; font-family: var(--font-mono); font-size: 1.1rem; overflow-wrap: anywhere; }
.rel .tag { vertical-align: baseline; }
.doc .rel-meta { margin: var(--space-1) 0 0; color: var(--color-text-muted); font-size: var(--font-size-small); }
/* Contains, Changes, Sources, Use it: a short label column */
.doc dl.rel-facts { grid-template-columns: 5.5rem 1fr; gap: 0 var(--space-4); margin: var(--space-3) 0 0; font-size: var(--font-size-small); }
.doc .rel-facts dt, .doc .rel-facts dd { padding-block: var(--space-2); }
.doc .rel-facts dt { font-size: var(--font-size-small); color: var(--color-text); }
.rel-files table { margin-top: var(--space-2); font-size: var(--font-size-label); }
.rel-files caption { font-size: var(--font-size-small); padding: var(--space-2) 0; border-top: var(--border-width) solid var(--color-border); }
.rel-files th, .rel-files td { padding-block: var(--space-2); }
.rel-files td:first-child { font-family: var(--font-mono); white-space: nowrap; }
.rel-sha { font-family: var(--font-mono); font-size: 0.72rem; color: var(--color-text-muted); overflow-wrap: anywhere; min-width: 12rem; }
@media (max-width: 48rem) {   /* each file becomes a block: name and size on one line, checksum below */
  .doc dl.rel-facts { grid-template-columns: 1fr; }
  .doc .rel-facts dt { padding-bottom: 0; }
  .doc .rel-facts dd { border-top: 0; padding-top: 0; }
  .rel-files thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .rel-files tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-3); padding-block: var(--space-2); border-bottom: var(--border-width) solid var(--color-border); }
  .rel-files td { border: 0; padding: 0; }
  .rel-files td:first-child { white-space: normal; overflow-wrap: anywhere; }
  .rel-files .rel-sha { flex-basis: 100%; min-width: 0; }
}

/* Migrating: each guide and what it takes, one under the other */
.doc dl.guides { grid-template-columns: 1fr; }
.doc .guides dt { padding-bottom: 0; }
.doc .guides dd { border-top: 0; padding-top: var(--space-1); }

/* About: the attribution text of each provider, one under the other */
.doc dl.credits { display: block; margin: 0; font-size: var(--font-size-small); }
.doc .credits dt { padding: var(--space-3) 0 0; }
.doc .credits dd { border-top: 0; padding: var(--space-1) 0 var(--space-3); border-bottom: var(--border-width) solid var(--color-border); }
.doc .credits dt:first-child { border-top: 0; padding-top: 0; }
.doc .credits dt { border-top: 0; }
.doc .credits dd p { margin: 0 0 var(--space-2); line-height: var(--line-height-body); }

/* ---------- Home ---------- */
/* The first screen holds the text and the example side by side, so Home is wider than the
   other pages. Header, sections and footer follow, and keep one left edge. */
.page-index { --content-max: 82rem; }
.section { padding-top: calc(var(--space-section) + var(--font-size-h2) / 4); }   /* --space-h2-leading, in the heading's size */
.section-head { text-wrap: pretty; margin-bottom: var(--space-head); }
.section-head h2:not(:last-child) { margin-bottom: calc(var(--space-h2-sub) + var(--space-h2-leading)); }
.section-head p { color: var(--color-prose); font-size: var(--font-size-sub); line-height: var(--line-height-lead); margin: 0; }
.tag { display: inline-block; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; letter-spacing: 0; color: var(--color-link); border: 1.5px solid currentColor; border-radius: 999px; padding: 0.15rem 0.75rem; vertical-align: 0.3em; white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5); align-items: center; margin-top: var(--space-4); }
.button { display: inline-flex; gap: var(--space-2); align-items: center; background: var(--color-accent); color: var(--color-on-accent); text-decoration: none; font-family: var(--font-mono); font-size: var(--font-size-small); font-weight: 600; padding: 0.7rem 1.5rem; border-radius: var(--radius-md); transition: background var(--duration-fast) var(--easing); }
.button:hover { background: var(--color-link-hover); color: var(--color-on-accent); text-decoration: none; }
.more { display: inline-block; padding-block: 0.25rem; font-family: var(--font-mono); font-size: var(--font-size-small); font-weight: 500; }

/* First screen: a chart sheet in a graduated border. The title panel and the example are
   printed on it as a chart's title and tide table are; the chart shows around and below them. */
.sheet { padding-block: var(--space-3) 0; }
.sheet-frame {
  --bar: 6px; --inset: calc(var(--bar) + 4px);
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: var(--space-4);
  padding: var(--inset); border: var(--border-width) solid var(--color-text);
  background:
    repeating-linear-gradient(to right, var(--color-text) 0 48px, transparent 48px 96px) top / 100% var(--bar) no-repeat,
    repeating-linear-gradient(to right, var(--color-text) 0 48px, transparent 48px 96px) bottom / 100% var(--bar) no-repeat,
    repeating-linear-gradient(to bottom, var(--color-text) 0 48px, transparent 48px 96px) left / var(--bar) 100% no-repeat,
    repeating-linear-gradient(to bottom, var(--color-text) 0 48px, transparent 48px 96px) right / var(--bar) 100% no-repeat,
    var(--color-bg);
}
.sheet-art { position: relative; height: 7.5rem; border: var(--border-width) solid var(--color-text); overflow: hidden; }
.sheet-map { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }
.title-block { position: relative; min-width: 0; padding: 0 var(--space-2); }
.title-block h1 { font-family: var(--font-display); font-size: clamp(1.75rem, 1.1rem + 1.9vw, 2.6rem); font-weight: 700; line-height: 1.1; letter-spacing: var(--tracking-display); margin: 0 0 var(--space-3); }
.title-block p { margin: 0 0 var(--space-3); line-height: 1.55; color: var(--color-prose); }
.title-block .lead { font-size: 1.0625rem; line-height: 1.55; color: var(--color-text); }

/* Station search on Home: a labelled box that goes to /stations/ on its own.
   assets/station-search.js (with the Stations pages) lists matches under it as you type. */
.title-block [data-station-search] { margin: var(--space-4) 0 0; }
.search-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-3); margin: 0 0 var(--space-1); }
.search-head label { font-weight: 600; color: var(--color-text); }
.search-head span { font-size: var(--font-size-small); color: var(--color-text-muted); }
.search-row { display: flex; gap: var(--space-2); }
.search-row input { flex: 1; min-width: 0; font: inherit; line-height: 1.5; color: var(--color-text); background: var(--color-bg); border: var(--border-width) solid var(--color-text); border-radius: var(--radius-md); padding: 0.5rem 0.75rem; }
.search-row input:focus-visible { outline-offset: 1px; }
.search-row button { font-family: var(--font-mono); font-size: var(--font-size-small); font-weight: 600; color: var(--color-text); background: var(--color-surface); border: var(--border-width) solid var(--color-text); border-radius: var(--radius-md); padding: 0 var(--space-4); cursor: pointer; transition: background var(--duration-fast) var(--easing); }
.search-row button:hover { background: var(--color-shallow); }
.title-block .station-status { margin: var(--space-2) 0 0; font-size: var(--font-size-small); color: var(--color-text-muted); }
.title-block .station-status:empty { display: none; }
.title-block .station-results { list-style: none; margin: var(--space-1) 0 0; padding: 0; max-height: 13rem; overflow-y: auto; border-top: var(--border-width) solid var(--color-border); }
.title-block .station-results li { margin: 0; border-bottom: var(--border-width) solid var(--color-border); }
.title-block .station-result { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-3); padding: var(--space-2) var(--space-1); text-decoration: none; color: var(--color-text); font-size: var(--font-size-small); line-height: 1.45; }
.title-block a.station-result:hover { background: var(--color-surface); }
.title-block a.station-result:focus-visible { outline-offset: -2px; }
.title-block .station-result-name { font-weight: 600; }
.title-block a.station-result .station-result-name { color: var(--color-link); }
.title-block .station-result-meta { font-size: var(--font-size-label); color: var(--color-text-muted); }

/* The example in five languages (Home and Documentation): a code window on chart ink, in both
   palettes. The language choice is a group of radio buttons drawn as tabs in the window's
   header: the buttons are hidden from sight, their labels are the tabs. The code is coloured at
   build time (scripts/highlight.mjs); the tk-* classes take the --color-tk-* tokens. */
.example { position: relative; min-width: 0; background: var(--color-code-panel); color: var(--color-code-panel-text); border: var(--border-width) solid var(--color-code-panel-border); border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 2px oklch(0.2 0.03 255 / 0.12), 0 24px 48px -24px oklch(0.2 0.04 255 / 0.45); }
.ex-radio { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.ex-tabs { display: flex; flex-wrap: nowrap; gap: 0; margin: 0; padding: 0 var(--space-3); background: var(--color-code-panel-raised); border-bottom: var(--border-width) solid var(--color-code-panel-border); overflow-x: auto; scrollbar-width: none; }
.ex-tabs label { flex: none; font-family: var(--font-mono); font-size: var(--font-size-label); font-weight: 500; color: var(--color-code-panel-muted); padding: 0.8rem var(--space-3) 0.7rem; margin-bottom: -1px; border-bottom: 2px solid transparent; cursor: pointer; transition: color var(--duration-fast) var(--easing); }
.ex-tabs label:hover { color: var(--color-code-panel-text); }
.ex-radio:nth-of-type(1):checked ~ .ex-tabs label:nth-of-type(1),
.ex-radio:nth-of-type(2):checked ~ .ex-tabs label:nth-of-type(2),
.ex-radio:nth-of-type(3):checked ~ .ex-tabs label:nth-of-type(3),
.ex-radio:nth-of-type(4):checked ~ .ex-tabs label:nth-of-type(4),
.ex-radio:nth-of-type(5):checked ~ .ex-tabs label:nth-of-type(5) { color: var(--color-code-panel-text); border-bottom-color: var(--color-code-panel-accent); }
.ex-radio:nth-of-type(1):focus-visible ~ .ex-tabs label:nth-of-type(1),
.ex-radio:nth-of-type(2):focus-visible ~ .ex-tabs label:nth-of-type(2),
.ex-radio:nth-of-type(3):focus-visible ~ .ex-tabs label:nth-of-type(3),
.ex-radio:nth-of-type(4):focus-visible ~ .ex-tabs label:nth-of-type(4),
.ex-radio:nth-of-type(5):focus-visible ~ .ex-tabs label:nth-of-type(5) { outline: 2px solid var(--color-code-panel-accent); outline-offset: -2px; border-radius: var(--radius-sm); }
@media (max-width: 30rem) { .ex-tabs label { padding-inline: var(--space-2); } }
.ex-panel { display: none; }
.ex-radio:nth-of-type(1):checked ~ .ex-panels > .ex-panel:nth-child(1),
.ex-radio:nth-of-type(2):checked ~ .ex-panels > .ex-panel:nth-child(2),
.ex-radio:nth-of-type(3):checked ~ .ex-panels > .ex-panel:nth-child(3),
.ex-radio:nth-of-type(4):checked ~ .ex-panels > .ex-panel:nth-child(4),
.ex-radio:nth-of-type(5):checked ~ .ex-panels > .ex-panel:nth-child(5) { display: block; }
/* Code keeps its lines: a long line scrolls inside its window, the page does not */
.example pre { white-space: pre; background: transparent; color: var(--color-code-panel-text); border: 0; border-radius: 0; margin: 0; font-size: 0.8125rem; line-height: 1.7; padding: var(--space-4) var(--space-5); }
.example code { background: none; color: inherit; }
.example pre.ex-install { padding-block: var(--space-4) 0; }
.example pre.ex-install code::before { content: "$ "; color: var(--color-code-panel-accent); user-select: none; }
.example pre.ex-code { padding-block: var(--space-4) var(--space-5); }
.example .ex-code + .ex-install { padding-top: 0; padding-bottom: var(--space-4); }
.ex-install-text, .doc .example .ex-note { margin: 0; padding: var(--space-4) var(--space-5) 0; color: var(--color-code-panel-muted); font-size: var(--font-size-small); line-height: 1.55; max-width: none; }
.doc .example .ex-note strong { color: var(--color-code-panel-text); }
.doc .example .ex-note code { color: var(--color-code-panel-text); }
.doc .example .ex-note a { color: var(--color-code-panel-accent); }
.doc .example .ex-note + .ex-install-text { padding-top: var(--space-2); }
/* Home: what the example prints, docked under the code, and the caption */
.ex-home .sr { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal;
  margin: 0; padding: var(--space-3) var(--space-5) 0; background: var(--color-code-panel-raised); border-top: var(--border-width) solid var(--color-code-panel-border);
  font-family: var(--font-mono); font-size: var(--font-size-label); font-weight: 600; color: var(--color-code-panel-muted); }
.ex-home pre.ex-output { background: var(--color-code-panel-raised); padding: var(--space-2) var(--space-5) var(--space-4); }
.ex-caption { margin: 0; padding: var(--space-3) var(--space-5) var(--space-4); background: var(--color-code-panel-raised); border-top: var(--border-width) solid var(--color-code-panel-border); color: var(--color-code-panel-muted); font-size: var(--font-size-label); line-height: 1.5; }
@media (max-width: 30rem) { .example pre { padding-inline: var(--space-4); font-size: 0.75rem; } .ex-home .sr, .ex-caption, .ex-install-text, .doc .example .ex-note { padding-inline: var(--space-4); } }
.doc .example { margin-block: var(--space-5) var(--space-4); }
/* Syntax colours */
.tk-c { color: var(--color-tk-comment); font-style: italic; }
.tk-s { color: var(--color-tk-string); }
.tk-n { color: var(--color-tk-number); }
.tk-k { color: var(--color-tk-keyword); }
.tk-f { color: var(--color-tk-fn); }
.tk-t { color: var(--color-tk-type); }

/* Chart symbology inside the sheet */
.sheet-map .water { fill: var(--color-bg); }
/* The chart features sit in .chart. On a phone the sheet is a band above the title: the island
   fills its height and the compass rose stands beside it. */
.sheet-map .chart { transform-box: view-box; transform-origin: 960px 330px; transform: translate(-500px, 240px) scale(1.5); }
.sheet-map .grat { stroke: var(--color-grat); stroke-width: 1; fill: none; }
.sheet-map .fill-shallow { fill: var(--color-shallow); }
.sheet-map .fill-shoal { fill: var(--color-shoal); }
.sheet-map .dc { fill: none; stroke: var(--color-contour); stroke-width: 1.2; stroke-dasharray: 1; stroke-dashoffset: 0; animation: sheet-draw 2200ms var(--easing-expo) both; animation-delay: calc(var(--i) * 140ms); }
.sheet-map .d30, .sheet-map .d20 { stroke-dasharray: none; stroke-width: 1; opacity: 0.8; animation: fade-in 1400ms var(--easing) both; }
.sheet-map .d30 { stroke-dasharray: 6 5; }
.sheet-map .land { fill: var(--color-land); stroke: var(--color-coast); stroke-width: 1.6; }
.sheet-map .snd text { font-family: var(--font-mono); font-style: italic; font-size: 14px; fill: var(--color-sounding); animation: fade-in 900ms var(--easing) both; animation-delay: calc(600ms + var(--d) * 22ms); }
.sheet-map .snd .sub { font-size: 10px; }
.sheet-map .rose { color: var(--color-accent); transform-box: view-box; transform-origin: 1070px 548px; translate: 150px -218px; animation: rose-turn 2400ms var(--easing-expo) both; }
.sheet-map .ring { fill: none; stroke: currentColor; stroke-width: 1.6; }
.sheet-map .ring.thin { stroke-width: 0.8; }
.sheet-map .rtick { stroke: currentColor; stroke-width: 1.1; }
.sheet-map .star4 { fill: currentColor; }
.sheet-map .star8 { fill: var(--color-bg); stroke: currentColor; stroke-width: 1.2; }
.sheet-map .rlab text { font-family: var(--font-mono); font-size: 13px; fill: currentColor; text-anchor: middle; }
.sheet-map .gauge { fill: var(--color-accent); stroke: var(--color-accent); stroke-width: 2.4; }
.sheet-map .gauge path { fill: none; }
.sheet-map .gauge-lab { font-family: var(--font-mono); font-weight: 600; font-size: 16px; fill: var(--color-accent); }
.sheet-map .tdiamond path { fill: var(--color-bg); stroke: var(--color-accent); stroke-width: 2.5; }
.sheet-map .tdiamond text { font-family: var(--font-mono); font-weight: 600; font-size: 18px; fill: var(--color-accent); }
.sheet-map .limit { fill: none; stroke: var(--color-accent); stroke-width: 2; stroke-dasharray: 14 6 3 6; opacity: 0.85; }

/* Wide screens: the title panel holds the text; the chart fills the rest of the sheet beside it. */
@media (min-width: 68rem) {
  .sheet-frame { grid-template-columns: minmax(0, 50rem) minmax(0, 1fr); align-items: stretch; padding: calc(var(--inset) + var(--space-3)); gap: var(--space-4); }
  .sheet-art { height: auto; min-height: 100%; }
  .title-block { z-index: 1; margin: 7px; background: var(--color-panel); border: var(--border-width) solid var(--color-text); outline: 3px double var(--color-text); outline-offset: 4px; padding: var(--space-5) var(--space-5) var(--space-5); }
  .sheet-map .chart { transform: translate(-60px, 20px) scale(1); }
  .sheet-map .rose { translate: -40px -40px; }
}

/* First screen: the value proposition, one text column on the chart sheet's title panel,
   body text under about 70 characters a line. The chart band closes the sheet under it. */
.title-block h1 { max-width: 24em; text-wrap: balance; }
.title-block > p, .title-block [data-station-search], .title-block [data-station-results] { max-width: 42rem; }
.title-block .hero-sub { font-size: 1.0625rem; color: var(--color-text); margin-bottom: var(--space-4); }

/* The value points: one line each where the width allows, a bold lead and a short tail.
   Each is marked with a tidal diamond, as on the chart beside it. */
.points { list-style: none; margin: 0; padding: 0; max-width: 42rem; }
.points li { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-3); margin: 0; padding: 0.4rem 0 0.4rem 1.6rem; border-top: var(--border-width) solid var(--color-border); line-height: 1.4; }
.points li:last-child { border-bottom: var(--border-width) solid var(--color-border); }
.points li::before { content: ""; position: absolute; left: 0.2rem; top: 0.9rem; width: 0.55rem; height: 0.55rem; border: 2px solid var(--color-accent); transform: rotate(45deg); }
.points strong { font-family: var(--font-heading); font-size: 1.0625rem; font-weight: 600; color: var(--color-text); }
.points span { font-size: var(--font-size-small); color: var(--color-prose); }
@media (max-width: 40rem) { .points span { flex-basis: 100%; } }   /* a phone: every tail under its lead, alike */
.title-block .actions { margin-top: var(--space-4); }

/* ---------- Home, below the first screen ----------
   Every section shares one grid: the heading in a narrow column, the content beside it on
   wide screens, under it on phones. Sections are far apart; the parts inside them are close.
   The chart sheet's vocabulary carries on down the page: depth tints, tidal diamonds, the
   graduated border (on the closing panel) and chart magenta. */
.home-sec { padding-block: clamp(3.5rem, 2.25rem + 5vw, 7rem) 0; }
.home-sec h2 { font-size: clamp(1.75rem, 1.2rem + 1.8vw, 2.5rem); letter-spacing: var(--tracking-heading); line-height: 1.1; margin: 0 0 var(--space-4); max-width: 16ch; }
.sec-grid { display: grid; gap: var(--space-5) clamp(2rem, 1rem + 4vw, 5rem); align-items: start; }
.sec-head > p, .sec-body > p { max-width: 40rem; color: var(--color-prose); margin: 0 0 var(--space-4); }
.sec-head > p:last-child, .sec-body > p:last-child { margin-bottom: 0; }
.sec-lede { font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem); line-height: 1.4; font-weight: 500; letter-spacing: -0.01em; color: var(--color-text) !important; text-wrap: balance; }
.sec-links { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); font-family: var(--font-mono); font-size: var(--font-size-small); font-weight: 600; }
.sec-links a { text-decoration: none; display: inline-flex; align-items: center; gap: 0.5em; }
.sec-links a::after { content: ""; width: 0.45em; height: 0.45em; border: solid currentColor; border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); transition: translate var(--duration-fast) var(--easing); }
.sec-links a:hover { text-decoration: underline; }
.sec-links a:hover::after { translate: 2px 0; }
@media (min-width: 60rem) {
  .sec-grid { grid-template-columns: minmax(16rem, 5fr) minmax(0, 8fr); }
}

/* Where that matters: the lede in ink, the uses as one ruled row, each marked with a tidal
   diamond as the hero's points are. */
.uses-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: var(--space-5) clamp(1.5rem, 1rem + 2vw, 3rem); margin: clamp(2.5rem, 2rem + 2vw, 3.5rem) 0 0; }
.uses-list > div { position: relative; border-top: 1.5px solid var(--color-text); padding-top: var(--space-4); }
.uses-list dt { display: flex; align-items: center; gap: var(--space-3); font-family: var(--font-heading); font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; color: var(--color-text); }
.uses-list dt::before { content: ""; flex: none; width: 0.6rem; height: 0.6rem; border: 2px solid var(--color-accent); transform: rotate(45deg); }
.uses-list dd { margin: var(--space-2) 0 0; color: var(--color-prose); line-height: var(--line-height-prose); max-width: 34rem; }

/* The accuracy result: the figure set large in the chart's magenta, the sentence beside it. */
.accuracy { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-6); margin: clamp(2rem, 1.5rem + 2vw, 3rem) 0 0; padding: var(--space-5) clamp(1rem, 0.5rem + 2vw, 2rem); background: var(--color-surface); border-radius: var(--radius-md); }
.accuracy-figure { font-family: var(--font-heading); font-size: clamp(2.25rem, 1.6rem + 2.4vw, 3.5rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1; color: var(--color-link); white-space: nowrap; font-variant-numeric: tabular-nums; }
.accuracy-text { flex: 1 1 22rem; max-width: 46rem; color: var(--color-text); line-height: 1.55; }

/* Try it: a band of chart water with the graticule, the code in a framed window on it. */
.home-example { margin-top: clamp(3.5rem, 2.25rem + 5vw, 7rem); padding-block: clamp(3rem, 2rem + 4vw, 5.5rem);
  background:
    linear-gradient(to right, color-mix(in oklch, var(--color-grat) 45%, transparent) 1px, transparent 1px) 0 0 / 120px 100%,
    linear-gradient(to bottom, color-mix(in oklch, var(--color-grat) 45%, transparent) 1px, transparent 1px) 0 0 / 100% 110px,
    var(--color-d10);
  border-block: var(--border-width) solid var(--color-border); }
.home-example .sec-head { position: sticky; top: calc(var(--header-h) + var(--space-5)); }
.home-example .sec-head > p { color: var(--color-text); }
@media (max-width: 59.99rem) { .home-example .sec-head { position: static; } }
@media (min-width: 60rem) { .home-example .sec-grid { grid-template-columns: minmax(14rem, 4fr) minmax(0, 8fr); } }


/* Coverage: each figure drawn against its whole, as a bar in the chart's depth tints. */
.bars { list-style: none; margin: 0 0 var(--space-6); padding: 0; display: grid; gap: var(--space-5); }
.bars li { display: grid; gap: var(--space-2); margin: 0; }
.bar-label { color: var(--color-prose); line-height: 1.45; }
.bar-label b { font-family: var(--font-heading); font-weight: 700; font-size: 1.25rem; letter-spacing: -0.01em; color: var(--color-text); font-variant-numeric: tabular-nums; margin-right: 0.15em; }
.bar { display: block; height: 0.75rem; background: var(--color-shallow); border-radius: 999px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--color-border); }
.bar i { display: block; height: 100%; width: var(--p); background: var(--color-plot-ticon); border-radius: inherit; transform-origin: left; }
.bar-model .bar i { background: repeating-linear-gradient(-45deg, var(--color-plot-ticon) 0 4px, var(--color-shoal) 4px 7px); }
.bar-current .bar i { background: var(--color-accent); min-width: 0.75rem; }
.coverage .note { margin: 0; max-width: 40rem; font-size: var(--font-size-small); padding: var(--space-3) var(--space-4); }
@supports (animation-timeline: view()) {
  .bar i { animation: bar-grow linear both; animation-timeline: view(); animation-range: entry 10% cover 35%; }
}
@keyframes bar-grow { from { transform: scaleX(0); } }

/* Where the constants come from: the order of preference drawn as steps down from the shore
   to open water, each a deeper chart tint. The one numbered sequence on the page. */
.ladder-intro { font-weight: 600; color: var(--color-text) !important; }
.ladder { list-style: none; counter-reset: step; margin: 0 0 var(--space-6); padding: 0; display: grid; gap: 3px; max-width: 44rem; }
.ladder li { counter-increment: step; position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem var(--space-3); margin: 0 0 0 calc(var(--step) * clamp(0.75rem, 0.25rem + 2vw, 2.5rem)); padding: var(--space-3) var(--space-4) var(--space-3) 3.25rem; background: var(--tint); color: var(--color-text); border-radius: var(--radius-md); line-height: 1.45; }
.ladder li::before { content: counter(step); position: absolute; left: var(--space-4); top: 50%; translate: 0 -50%; width: 1.5rem; height: 1.5rem; display: grid; place-items: center; font-family: var(--font-mono); font-size: var(--font-size-label); font-weight: 600; color: var(--color-text); border: 1.5px solid var(--color-text); border-radius: 50%; background: var(--color-bg); }
.ladder li:nth-child(1) { --step: 0; --tint: var(--color-shoal); }
.ladder li:nth-child(2) { --step: 1; --tint: var(--color-shallow); }
.ladder li:nth-child(3) { --step: 2; --tint: var(--color-d10); }
.ladder li:nth-child(4) { --step: 3; --tint: var(--color-bg); box-shadow: inset 0 0 0 1px var(--color-contour); }
.ladder strong { font-weight: 600; }
.ladder span { font-size: var(--font-size-small); color: var(--color-text); }

/* Closing: the graduated border of the chart sheet again, round one statement and the action. */
.closing { padding-bottom: clamp(3.5rem, 2.25rem + 5vw, 6rem); }
.closing-frame { --bar: 6px; padding: clamp(2rem, 1.25rem + 3vw, 4rem) clamp(1.25rem, 0.5rem + 4vw, 4rem); border: var(--border-width) solid var(--color-text);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-5) var(--space-7);
  background:
    repeating-linear-gradient(to right, var(--color-text) 0 48px, transparent 48px 96px) top / 100% var(--bar) no-repeat,
    repeating-linear-gradient(to right, var(--color-text) 0 48px, transparent 48px 96px) bottom / 100% var(--bar) no-repeat,
    repeating-linear-gradient(to bottom, var(--color-text) 0 48px, transparent 48px 96px) left / var(--bar) 100% no-repeat,
    repeating-linear-gradient(to bottom, var(--color-text) 0 48px, transparent 48px 96px) right / var(--bar) 100% no-repeat,
    var(--color-bg); }
.closing-frame h2 { margin: 0; max-width: 20ch; }
.closing-frame .actions { margin: 0; }

/* ---------- Figures: the sources diagram and the tide-curve plot ---------- */
/* Sources: the four kinds of source in their order of rank, drawn as Home draws the order of
   preference: steps down from the shore to open water, each a deeper chart tint. */
.streams { list-style: none; margin: var(--space-6) 0; padding: 0; display: grid; gap: 3px; counter-reset: rank; }
.doc .stream { counter-increment: rank; position: relative; display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); grid-template-rows: auto 1fr; gap: var(--space-1) var(--space-6); align-items: start;
  margin: 0 0 0 calc(var(--step) * clamp(0.75rem, 0.25rem + 2vw, 2rem)); padding: var(--space-4) var(--space-5) var(--space-4) 3.5rem; background: var(--tint); color: var(--color-text); border-radius: var(--radius-md); }
.stream::before { content: counter(rank); position: absolute; left: var(--space-4); top: var(--space-4); width: 1.5rem; height: 1.5rem; display: grid; place-items: center; font-family: var(--font-mono); font-size: var(--font-size-label); font-weight: 600; color: var(--color-text); border: 1.5px solid var(--color-text); border-radius: 50%; background: var(--color-bg); }
.stream:nth-child(1) { --step: 0; --tint: var(--color-shoal); }
.stream:nth-child(2) { --step: 1; --tint: var(--color-shallow); }
.stream:nth-child(3) { --step: 2; --tint: var(--color-d10); }
.stream:nth-child(4) { --step: 3; --tint: var(--color-bg); box-shadow: inset 0 0 0 1px var(--color-contour); }
.doc .stream h3 { margin: 0.1rem 0 var(--space-1); font-size: 1.125rem; border: 0; padding: 0; }
.doc .stream .rank { grid-column: 1; margin: 0; font-size: var(--font-size-small); line-height: 1.5; color: var(--color-text); }
.stream ul { grid-column: 2; grid-row: 1 / span 2; list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-5); }
.doc .stream li { margin: 0; padding-block: var(--space-1); color: var(--color-text); }
.stream li a { font-weight: 600; color: var(--color-text); text-decoration-color: var(--color-accent); }   /* ink on the tints; the underline marks the link */
.stream li a:hover { color: var(--color-text); }
.stream .country { color: var(--color-text); font-size: 0.9rem; }
@media (max-width: 40rem) {
  .doc .stream { grid-template-columns: 1fr; grid-template-rows: auto; }
  .stream ul { grid-column: 1; grid-row: auto; margin-top: var(--space-2); }
}
.confluence { display: block; width: 100%; height: 5rem; overflow: visible; }
.confluence path { fill: none; stroke: var(--color-contour); stroke-width: 2; vector-effect: non-scaling-stroke; }
.confluence .main { stroke: var(--color-accent); stroke-width: 3; }
.release {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--space-4) var(--space-7); align-items: start;
  background: var(--color-panel); border: var(--border-width) solid var(--color-text); outline: 3px double var(--color-text); outline-offset: 4px;
  padding: clamp(1.25rem, 2.5vw, 2rem); margin: 0 4px;
}
.release h3 { font-size: 1.5rem; font-weight: 700; letter-spacing: var(--tracking-heading); margin-bottom: var(--space-2); }
.release .stem { font-family: var(--font-mono); font-weight: 600; font-size: clamp(1rem, 0.8rem + 1vw, 1.35rem); margin: 0 0 var(--space-3); overflow-wrap: anywhere; }
.release .pending { margin: 0; }
.release ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: var(--space-3) var(--space-6); }
.release li { margin: 0; padding-left: 1.5rem; position: relative; }
.release li::before { content: ""; position: absolute; left: 0.15rem; top: 0.5rem; width: 0.6rem; height: 0.6rem; border: 2px solid var(--color-accent); transform: rotate(45deg); }
.flow-key { font-size: var(--font-size-small); color: var(--color-text-muted); margin: var(--space-5) 0 0; }

/* Proof: the tide curve on a graticule */
.proof { margin-top: var(--space-8); padding-block: var(--space-8); background-color: var(--color-d10);
  background-image: linear-gradient(var(--color-grat) 1px, transparent 1px), linear-gradient(90deg, var(--color-grat) 1px, transparent 1px);
  background-size: var(--graticule); background-position: -1px -1px; border-block: var(--border-width) solid var(--color-text); }
.proof .section-head { background: var(--color-panel); padding: var(--space-4) var(--space-5); border: var(--border-width) solid var(--color-text); }
.proof .section-head p { color: var(--color-prose); }
.section-head p + p { margin-top: var(--space-3); }
.plot { background: var(--color-panel); border: var(--border-width) solid var(--color-text); padding: var(--space-4) var(--space-5) var(--space-5); }
.plot-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-5); margin-bottom: var(--space-2); }
.plot-head p { margin: 0; color: var(--color-text-muted); font-size: var(--font-size-small); }
.plot-head .place { font-size: 1.6rem; color: var(--color-text); }
.plot-box svg { width: 100%; height: auto; overflow: visible; }
.tide.compact { display: none; }
.tide .g { stroke: var(--color-plot-grid); stroke-width: 1; fill: none; }
.tide .g3 { stroke: var(--color-plot-grid-strong); }
.tide .ticks text { font-family: var(--font-mono); font-size: calc(var(--fs) * 0.8); fill: var(--color-text-muted); text-anchor: middle; }
.tide .c { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tide .c-official { stroke: var(--color-plot-official); stroke-width: 3; stroke-dasharray: 1; }
.tide .c-ticon { stroke: var(--color-plot-ticon); stroke-width: 3; stroke-dasharray: 11 7; }
.tide .c-fit { stroke: var(--color-plot-fit); stroke-width: 3.5; }
/* The plot shows its final state by default. assets/plot.js adds .play when the plot first
   scrolls into view: the official curve draws, then TICON-4 and our fit slide out to their lag. */
.plot.play .tide .c-official { animation: curve-draw 1300ms var(--easing) both; }
.plot.play .tide .c-ticon { animation: curve-lag 1500ms 1200ms var(--easing-expo) both; }
.plot.play .tide .c-fit { animation: curve-lag 1200ms 1500ms var(--easing-expo) both; }
.plot.play .tide .marks { animation: fade-in 700ms 2500ms var(--easing) both; }
.tide .lead { stroke: var(--color-plot-grid-strong); stroke-width: 1.2; stroke-dasharray: 3 3; fill: none; }
.tide .span { stroke: var(--color-plot-ticon); stroke-width: 2.4; fill: none; }
.tide .hw-ti { fill: var(--color-panel); stroke: var(--color-plot-ticon); stroke-width: 3; }
.tide .hw-fit { fill: var(--color-plot-fit); stroke: var(--color-panel); stroke-width: 2; }
.tide .hw-official { fill: var(--color-panel); stroke: var(--color-plot-official); stroke-width: 2; }
.tide .lab { font-family: var(--font-mono); font-weight: 600; font-size: var(--fs); }
.tide .lab-ti { fill: var(--color-plot-ticon); }
.tide .lab-fit { fill: var(--color-plot-fit); }
.plot figcaption { margin-top: var(--space-4); font-size: var(--font-size-small); color: var(--color-text-muted); }
.plot-key { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); font-family: var(--font-mono); font-size: var(--font-size-label); color: var(--color-text); }
.plot-key li { display: inline-flex; align-items: flex-start; gap: var(--space-2); margin: 0; }
.plot-key i { display: inline-block; width: 28px; height: 0; border-top: 3px solid; flex: none; margin-top: 0.75em; }
.plot-key .k-official { border-color: var(--color-plot-official); }
.plot-key .k-ticon { border-top-style: dashed; border-color: var(--color-plot-ticon); }
.plot-key .k-fit { border-color: var(--color-plot-fit); }
.plot figcaption p { margin: 0; }

@media (max-width: 60rem) {
  .confluence { display: none; }
  .release { grid-template-columns: 1fr; margin-top: var(--space-6); position: relative; }
  .release::before { content: ""; position: absolute; left: 50%; top: calc(-1 * var(--space-6) - 4px); height: var(--space-6); width: 3px; margin-left: -1.5px; background: var(--color-accent); }
}
@media (max-width: 40rem) {
  .tide.wide { display: none; }
  .tide.compact { display: block; }
  .plot { padding-inline: var(--space-3); }
}

/* ---------- Motion ---------- */
@keyframes sheet-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes rose-turn { from { transform: rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes curve-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes curve-lag { from { transform: translateX(var(--dx)); opacity: 0; } 25% { opacity: 1; } to { transform: none; opacity: 1; } }

/* Reduced motion: the final state shows at once. No content depends on an animation. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 0ms !important; }
}


/* On documentation pages the header spans the full width, as on the aimock docs */
body:has(.docs-layout) .header-inner { max-width: none; }

/* Request icon (Not included): one trailing column, an outline icon in the link colour */
.doc dl.requests dd { display: grid; grid-template-columns: 1fr auto; gap: var(--space-3); align-items: start; }
.request { display: inline-grid; place-items: center; inline-size: 2rem; block-size: 2rem; margin-top: -0.15rem; border-radius: var(--radius-sm); color: var(--color-link); }
.request:hover { color: var(--color-link-hover); background: var(--color-accent-glow); }
.request svg, .request-glyph svg { display: block; inline-size: 1.25rem; block-size: 1.25rem; }
.request-glyph { display: inline-block; vertical-align: -0.2em; color: var(--color-link); }
@media (pointer: coarse) { .request { inline-size: 2.75rem; block-size: 2.75rem; margin-top: -0.55rem; margin-right: -0.375rem; } }
