/* The tide pages (/tides, a station's tide table, the stations, the planner,
   king tides and the guides), light theme. tides-dark.css overrides it for
   the dark theme (linked with data-theme-dark). */

.td-page {
  --td-water: #2f7fb0;
  --td-water-soft: #e3f0f8;
  --td-water-fill: rgb(47 127 176 / 0.16);
  --td-high: #1d6a96;
  --td-low: #b4691d;
  --td-night: rgb(26 36 72 / 0.07);
  --td-flood: #c0392b;
  --td-king: #7a3d9a;
}

.td-intro { margin-bottom: 14px; }
.td-meta { display: block; max-width: 62em; }
.td-mute { color: var(--muted); }
.td-small { font-size: 0.86rem; }
.td-num { font-variant-numeric: tabular-nums; }
.td-p { margin: 0 0 10px; max-width: 62em; }
.td-gap { margin-top: 10px; }
.td-lede { color: var(--muted); margin-bottom: 12px; max-width: 60em; }
.td-h2 { font-size: 1.05rem; margin: 0 0 8px; }
.td-sub { font-size: 1.02rem; margin: 18px 0 8px; }
.td-warn { color: var(--warn-text); margin: 6px 0 10px; max-width: 62em; }

/* ---- Tabs: the header's Tides menu, again on each page ---- */
.td-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.td-tabs a {
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
  white-space: nowrap;
}
.td-tabs a:hover { color: var(--text); border-color: var(--muted); }
.td-tabs a[aria-current="page"] { background: var(--td-water-soft); border-color: var(--td-water); color: var(--text); font-weight: 600; }
.td-tabs a:focus-visible { outline: 2px solid var(--accent-moon); outline-offset: 1px; }

/* ---- Section chips ---- */
.td-chips { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 16px; font-size: 0.9rem; }
.td-chips a { color: var(--td-high); text-decoration: none; }
.td-chips a:hover { text-decoration: underline; }

/* ---- Cards ---- */
.td-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin: 0 0 18px;
  min-width: 0;
  scroll-margin-top: 12px;
}
.td-card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 10px; }
.td-card-head h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; color: #1d5d86; }
.td-card-head .td-card-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.td-grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.td-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 860px) { .td-grid3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 620px) { .td-grid2, .td-grid3 { grid-template-columns: minmax(0, 1fr); } }

.td-cta {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--td-water);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}
.td-cta:hover { filter: brightness(1.08); }
.td-cta:focus-visible { outline: 2px solid var(--accent-moon); outline-offset: 2px; }

/* ---- Hero: now and the chart ---- */
.td-hero {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  background: linear-gradient(180deg, var(--td-water-soft), var(--surface) 70%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin: 0 0 14px;
}
.td-hero > .td-chart-figure:only-child { grid-column: 1 / -1; }
@media (max-width: 760px) { .td-hero { grid-template-columns: minmax(0, 1fr); } }
.td-now .td-h2 { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.85rem; color: var(--muted); }
.td-big { font-size: 2.6rem; font-weight: 650; line-height: 1.05; font-variant-numeric: tabular-nums; color: var(--td-high); }
.td-trend { margin: 6px 0 10px; font-weight: 600; }
.td-trend span[aria-hidden] { font-size: 1.2rem; }
.td-rising { color: var(--td-high); }
.td-falling { color: var(--td-low); }
.td-trend .td-mute { font-weight: 400; }
.td-progress { display: block; width: 100%; height: 6px; margin: 0 0 12px; border: 0; border-radius: 3px; background: var(--line); overflow: hidden; appearance: none; -webkit-appearance: none; accent-color: var(--td-water); }
.td-progress::-webkit-progress-bar { background: var(--line); border-radius: 3px; }
.td-progress::-webkit-progress-value { background: var(--td-water); border-radius: 3px; }
.td-progress::-moz-progress-bar { background: var(--td-water); border-radius: 3px; }
.td-next { display: grid; gap: 8px; margin: 0; }
.td-next div { display: grid; gap: 2px; }
.td-next dt { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.td-next dd { margin: 0; }

.td-chart-figure { margin: 0; min-width: 0; }
.td-chart-figure figcaption { margin-top: 6px; }
[data-tide="readout"] { margin-left: 6px; color: var(--text); font-variant-numeric: tabular-nums; }

/* The SVG chart (Presentation/TideChart.cs). */
.tide-chart { display: block; width: 100%; height: auto; touch-action: pan-y; font: 11px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; user-select: none; }
.tide-chart .tc-night { fill: var(--td-night); }
.tide-chart .tc-grid line { stroke: var(--line); stroke-width: 1; }
.tide-chart .tc-grid text { fill: var(--muted); text-anchor: end; font-size: 10px; }
.tide-chart .tc-day { stroke: var(--muted); stroke-opacity: 0.5; stroke-dasharray: 2 3; }
.tide-chart .tc-dayname { fill: var(--text); font-weight: 600; font-size: 11px; }
.tide-chart .tc-tick { stroke: var(--muted); }
.tide-chart .tc-hour { fill: var(--muted); text-anchor: middle; font-size: 10px; }
.tide-chart .tc-water { fill: var(--td-water-fill); }
.tide-chart .tc-line { fill: none; stroke: var(--td-water); stroke-width: 2.2; stroke-linejoin: round; }
.tide-chart .tc-ref { stroke-width: 1; stroke-dasharray: 5 4; }
.tide-chart .tc-ref-mhhw { stroke: var(--td-high); stroke-opacity: 0.6; }
.tide-chart .tc-ref-datum { stroke: var(--muted); stroke-opacity: 0.8; }
.tide-chart .tc-ref-flood { stroke: var(--td-flood); }
.tide-chart .tc-reflabel { font-size: 9.5px; text-anchor: end; fill: var(--muted); }
.tide-chart .tc-reflabel.tc-ref-flood { fill: var(--td-flood); }
.tide-chart .tc-dot { stroke: var(--surface); stroke-width: 1.5; }
.tide-chart .tc-dot.tc-high { fill: var(--td-high); }
.tide-chart .tc-dot.tc-low { fill: var(--td-low); }
.tide-chart .tc-label { font-size: 11px; font-weight: 600; fill: var(--text); }
.tide-chart .tc-label .tc-h { font-weight: 400; fill: var(--muted); }
.tide-chart .tc-now line { stroke: var(--accent-sun); stroke-width: 1.5; }
.tide-chart .tc-now circle { fill: var(--accent-sun); stroke: var(--surface); stroke-width: 2; }
.tide-chart .tc-now text { fill: var(--accent-sun); font-weight: 700; font-size: 10px; }
.tide-chart .tc-cursor line { stroke: var(--text); stroke-opacity: 0.45; }
.tide-chart .tc-cursor circle { fill: var(--surface); stroke: var(--td-water); stroke-width: 2.5; }
.tide-chart .tc-cursor text { fill: var(--text); font-weight: 600; font-size: 11px; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
/* Phones get the narrow chart (560 wide), with larger text in its units. */
.tide-chart.tc-narrow { display: none; }
@media (max-width: 620px) {
  .tide-chart.tc-wide { display: none; }
  .tide-chart.tc-narrow { display: block; font-size: 15px; }
  .tide-chart .tc-label { font-size: 16px; }
  .tide-chart .tc-label .tc-h { font-size: 14px; }
  .tide-chart .tc-hour, .tide-chart .tc-grid text { font-size: 14px; }
  .tide-chart .tc-dayname { font-size: 16px; }
  .tide-chart .tc-reflabel { font-size: 13px; }
  .tide-chart .tc-now text, .tide-chart .tc-cursor text { font-size: 15px; }
}

/* ---- Tables of high and low water ---- */
.td-table-wrap { overflow-x: auto; margin: 0 -4px; }
.td-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.93rem; }
.td-table th, .td-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
.td-table thead th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.td-table tbody th { font-weight: 600; }
.td-table .td-dow { display: inline-block; min-width: 2.4em; color: var(--muted); font-weight: 500; }
.td-today { background: var(--td-water-soft); }
.td-badge { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--td-water); color: #fff; font-size: 0.72rem; font-weight: 600; vertical-align: 1px; }
.td-ev time { font-weight: 600; }
.td-ev-kind { font-size: 0.7rem; }
.td-hi .td-ev-kind { color: var(--td-high); }
.td-lo .td-ev-kind { color: var(--td-low); }
.td-ev-h { display: block; color: var(--muted); font-size: 0.85rem; }
.td-minus .td-ev-h { color: var(--td-low); font-weight: 600; }
.td-sun-col, .td-moon-col { color: var(--muted); }
.td-phase { color: var(--text); }
/* Phones: each day is a heading line over its four high and low waters, so nothing scrolls sideways. */
@media (max-width: 620px) {
  .td-table { font-size: 0.86rem; }
  .td-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .td-table tbody tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); padding: 4px 0 6px; }
  .td-table th, .td-table td { padding: 3px 2px; border-bottom: 0; white-space: nowrap; }
  .td-table td.td-ev { font-size: 0.8rem; letter-spacing: -0.01em; overflow: hidden; }
  .td-table .td-ev-kind { font-size: 0.6rem; }
  .td-table tbody th { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 6px; }
  .td-table .td-moon-col { grid-column: 1 / -1; font-size: 0.8rem; padding-top: 0; }
  .td-table .td-moon-col:empty { display: none; }
  .td-sun-col { display: none; }
}

/* ---- Tiles ---- */
.td-tile { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--bg); min-width: 0; }
.td-tile h3 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; }
.td-tile p { margin: 0 0 6px; }
.td-tile-big { font-size: 1.25rem; font-weight: 650; }
.td-tile-king { border-color: color-mix(in srgb, var(--td-king) 40%, var(--line)); }
.td-tile-king .td-tile-big { color: var(--td-king); }
.td-tile-low .td-tile-big { color: var(--td-low); }

.td-tool { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); text-decoration: none; background: var(--bg); }
.td-tool:hover { border-color: var(--td-water); }
.td-tool strong { color: var(--td-high); }
.td-tool span { color: var(--muted); font-size: 0.9rem; }

/* ---- Station details ---- */
.td-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(12em, 1fr)); gap: 12px 18px; margin: 4px 0 12px; }
.td-kv div { min-width: 0; }
.td-kv dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.td-kv dd { margin: 2px 0 0; font-size: 1.05rem; font-weight: 600; }
.td-kv dd .td-small { display: block; font-weight: 400; }
.td-levels { border-collapse: collapse; margin: 6px 0 12px; font-variant-numeric: tabular-nums; }
.td-levels caption { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding-bottom: 4px; }
.td-levels th, .td-levels td { padding: 4px 14px 4px 0; border-bottom: 1px solid var(--line); text-align: left; }
.td-levels th abbr { text-decoration: none; cursor: help; }
.td-levels .td-flood th, .td-levels .td-flood td.td-num { color: var(--td-flood); }

.td-nearby { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.td-nearby li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.td-nearby li.td-current > a:first-child { font-weight: 700; }
.td-nearby li.td-current::before { content: "●"; color: var(--td-water); font-size: 0.7rem; }

/* ---- Source tips: popovers (without script the browser centers them; the islands anchor them) ---- */
.td-cite { display: inline; font-size: 0.9rem; font-weight: 400; text-transform: none; letter-spacing: 0; }
.td-cite-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 2px;
  padding: 0;
  vertical-align: 1px;
  border-radius: 50%;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  opacity: 0.6;
  font: italic 600 10px/1 Georgia, serif;
  cursor: pointer;
}
.td-cite-btn:hover, .td-cite-btn[aria-expanded="true"] { opacity: 1; }
.td-cite-btn:focus-visible { outline: 2px solid var(--accent-moon); outline-offset: 2px; }
.td-pop {
  width: min(320px, calc(100vw - 24px));
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 8px 28px rgb(0 0 0 / 0.14);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: 0;
  text-align: left;
}
.td-pop.is-anchored { position: fixed; inset: auto; margin: 0; }
.td-pop::backdrop { background: transparent; }
.td-pop-h { display: block; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }

/* ---- Sources ---- */
.td-refs { margin: 8px 0 18px; }
.td-sources { padding-left: 1.4em; font-size: 0.88rem; display: grid; gap: 6px; }
.td-sources li { scroll-margin-top: 80px; }
.td-sources li:target { background: var(--td-water-soft); }

/* ---- Inland ---- */
.td-inland p { margin-bottom: 10px; }

/* ---- Forms (planner, station search) ---- */
.td-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(13em, 1fr)); gap: 12px 16px; align-items: end; }
.td-form label, .td-form fieldset { display: grid; gap: 4px; font-size: 0.86rem; color: var(--muted); min-width: 0; }
.td-form fieldset { border: 0; padding: 0; margin: 0; }
.td-form legend { padding: 0; margin-bottom: 4px; }
.td-form input[type="number"], .td-form input[type="search"], .td-form input[type="time"], .td-form select {
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 10px;
  min-width: 0;
}
.td-form .td-inline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--text); }
.td-form input[type="time"] { width: 8.2em; }
.td-form input[type="number"] { width: 6.5em; }
.td-form button { font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 999px; border: 0; background: var(--td-water); color: #fff; cursor: pointer; }
.td-form button:focus-visible { outline: 2px solid var(--accent-moon); outline-offset: 2px; }
.td-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.td-presets a { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); text-decoration: none; font-size: 0.88rem; background: var(--bg); }
.td-presets a:hover { border-color: var(--td-water); }
.td-presets a[aria-current="true"] { background: var(--td-water-soft); border-color: var(--td-water); font-weight: 600; }

/* ---- Planner results ---- */
.td-form .td-check { display: inline-flex; align-items: center; gap: 3px; font-size: 0.9rem; color: var(--text); }
.td-form .td-check input { accent-color: var(--td-water); }
.td-weekdays .td-inline { flex-wrap: wrap; gap: 4px 10px; }
.td-cals { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 4px 0 14px; }
.td-calm h3 { font-weight: 600; margin: 0 0 4px; color: var(--muted); }
.td-cal { display: grid; grid-template-columns: repeat(7, 2.1em); gap: 3px; }
.td-cal > span, .td-cal > a { height: 1.9em; border-radius: 5px; font-size: 0.74rem; display: flex; align-items: center; justify-content: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.td-cal > span:not(.td-dowh):not(.td-blank) { background: var(--bg); border: 1px solid var(--line); }
.td-cal > span.td-out { opacity: 0.4; }
.td-cal > a.td-hit { background: var(--td-water); color: #fff; font-weight: 700; text-decoration: none; }
.td-cal > a.td-hit:hover, .td-cal > a.td-hit:focus-visible { outline: 2px solid var(--accent-moon); outline-offset: 1px; }
.td-cal .td-dowh { text-transform: uppercase; font-size: 0.66rem; letter-spacing: 0.04em; }
.td-windows { list-style: none; margin: 0; padding: 0; }
.td-window { display: grid; grid-template-columns: 10.5em minmax(120px, 240px) minmax(0, 1fr); gap: 4px 14px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 14px; }
.td-window:target { background: var(--td-water-soft); }
.td-window-day { font-weight: 600; }
.td-daybar { display: block; width: 100%; height: 14px; border-radius: 4px; overflow: hidden; }
.td-daybar-bg { fill: var(--bg); stroke: var(--line); }
.td-daybar-night { fill: rgb(26 36 72 / 0.2); }
.td-daybar-win { fill: var(--td-water); }
.td-daybar-tick { stroke: var(--line); stroke-width: 0.6; }
.td-window-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; font-variant-numeric: tabular-nums; font-size: 0.92rem; }
.td-window-low { color: var(--muted); }
@media (max-width: 620px) {
  .td-window { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Events ---- */
.td-episodes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.td-episode { display: grid; grid-template-columns: minmax(9em, 12em) minmax(0, 1fr) auto; gap: 4px 14px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.td-episode-when { font-weight: 650; }
.td-episode-h { font-variant-numeric: tabular-nums; font-weight: 650; text-align: right; white-space: nowrap; }
.td-king .td-episode-h { color: var(--td-king); }
.td-lowtide .td-episode-h { color: var(--td-low); }
.td-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.td-tag { padding: 1px 8px; border-radius: 999px; font-size: 0.74rem; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.td-tag-flood { border-color: var(--td-flood); color: var(--td-flood); }
.td-tag-perigee { border-color: var(--td-king); color: var(--td-king); }
.td-tag-day { border-color: var(--accent-sun); color: var(--warn-text); }
@media (max-width: 620px) {
  .td-episode { grid-template-columns: minmax(0, 1fr) auto; }
  .td-episode > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
}
.td-program { border-left: 4px solid var(--td-king); padding: 4px 0 4px 12px; margin: 0 0 12px; }
.td-program h3 { font-size: 1rem; margin-bottom: 2px; }

/* ---- Station pages: breadcrumbs, month navigation ---- */
.td-crumbs { font-size: 0.86rem; color: var(--muted); margin: -4px 0 6px; }
.td-crumbs a { color: var(--td-high); text-decoration: none; }
.td-crumbs a:hover { text-decoration: underline; }
.td-month-head h2 { margin-right: auto; }
.td-monthnav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.9rem; }
.td-monthnav > a { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); text-decoration: none; white-space: nowrap; }
.td-monthnav > a:hover { border-color: var(--td-water); }
.td-monthform { display: flex; gap: 6px; align-items: center; }
.td-monthform input { font: inherit; font-size: 0.9rem; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4px 8px; }
.td-monthform button { font: inherit; font-size: 0.86rem; font-weight: 600; padding: 4px 12px; border-radius: 999px; border: 0; background: var(--td-water); color: #fff; cursor: pointer; }

/* ---- Station map, search and lists ---- */
.td-map { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #dcebf5; aspect-ratio: 2 / 1; width: 100%; }
.td-map-svg { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.td-map.is-zoomed .td-map-svg:active { cursor: grabbing; }
.td-map-land { fill: #f4f1e8; stroke: #c9c3b2; stroke-width: 0.15; }
.td-map-grid { fill: none; stroke: rgb(29 93 134 / 0.12); stroke-width: 1; }
.td-map-dots { fill: none; stroke-linecap: round; stroke-width: 4; }
.td-map.is-zoomed .td-map-dots { stroke-width: 6; }
.td-map-k0 { stroke: #1d6a96; }
.td-map-k1 { stroke: #58a6d6; }
.td-map-k2 { stroke: #c06a1a; }
.td-map-other { stroke: rgb(60 70 80 / 0.25); }
.td-map-hover { fill: none; stroke: var(--text); stroke-width: 2; pointer-events: none; }
.td-map-tip { position: absolute; z-index: 2; transform: translate(-50%, calc(-100% - 12px)); padding: 3px 9px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 4px 14px rgb(0 0 0 / 0.14); font-size: 0.82rem; white-space: nowrap; pointer-events: none; }
.td-map-zoom { position: absolute; z-index: 2; right: 8px; top: 8px; display: grid; gap: 4px; }
.td-map-zoom[hidden] { display: none; }
.td-map-zoom button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 600 1.1rem/1 system-ui, sans-serif; cursor: pointer; }
.td-map-zoom button:focus-visible { outline: 2px solid var(--accent-moon); outline-offset: 1px; }
.td-map.is-failed::after { content: "The map could not load."; position: absolute; inset: auto 0 45% 0; text-align: center; color: var(--muted); }
.td-map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; }
.td-key { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.td-key-0 { background: #1d6a96; }
.td-key-1 { background: #58a6d6; }
.td-key-2 { background: #c06a1a; }
.td-map-legend [data-tidemap="label"] { margin-left: auto; color: var(--text); font-weight: 600; }
.td-search { display: grid; gap: 4px; margin: 0 0 12px; max-width: 520px; font-size: 0.86rem; color: var(--muted); }
.td-search[hidden] { display: none; }
.td-search input { font: inherit; font-size: 1rem; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.td-search-results { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 2px; font-size: 0.95rem; }
.td-search-results a { display: block; padding: 5px 4px; border-bottom: 1px solid var(--line); color: var(--td-high); text-decoration: none; }
.td-search-results a:hover, .td-search-results a:focus-visible { background: var(--td-water-soft); }
.td-countries { columns: 3 14em; column-gap: 24px; padding: 0; list-style: none; margin: 0; }
.td-countries li { break-inside: avoid; padding: 3px 0; }
.td-stations { columns: 3 15em; column-gap: 24px; padding: 0; list-style: none; margin: 0; }
.td-stations li { break-inside: avoid; padding: 3px 0; }
.td-stations .td-tag { margin-left: 6px; font-size: 0.68rem; padding: 0 6px; vertical-align: 1px; }
.td-tag-gauge { border-color: #c06a1a; color: #9a5210; }

/* ---- Guides ---- */
.td-guide h2 { font-size: 1.25rem; margin: 6px 0 10px; }
.td-guide h3 { font-size: 1.02rem; margin: 16px 0 6px; }
.td-guide p { margin: 0 0 12px; max-width: 64em; }
.td-guide ul, .td-guide ol { max-width: 62em; padding-left: 1.3em; margin: 0 0 12px; }
.td-guide li { margin-bottom: 4px; }
.td-figure { margin: 6px 0 16px; }
.td-figure svg { display: block; width: 100%; height: auto; max-width: 760px; }
.td-figure figcaption { font-size: 0.86rem; color: var(--muted); margin-top: 6px; max-width: 60em; }
.td-toc { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 16px; font-size: 0.92rem; }
.td-toc a { color: var(--td-high); text-decoration: none; }
.td-toc a:hover { text-decoration: underline; }
.td-constituents { border-collapse: collapse; width: 100%; font-size: 0.9rem; margin: 6px 0 14px; }
.td-constituents th, .td-constituents td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.td-constituents thead th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.td-constituents td.td-num { text-align: right; white-space: nowrap; }
.td-explorer { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 8px 0 16px; background: var(--bg); }
.td-explorer-toggles { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.td-explorer-toggles label { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.85rem; cursor: pointer; background: var(--surface); }
.td-explorer-toggles input { accent-color: var(--td-water); }
.td-explorer canvas { display: block; width: 100%; height: 220px; }
.td-note { border-left: 3px solid var(--td-water); padding: 2px 0 2px 12px; color: var(--muted); margin: 0 0 12px; max-width: 62em; }

/* Diagrams drawn in the guide (SVG in the page). */
.td-diagram .earth { fill: #3c7fbf; }
.td-diagram .ocean { fill: rgb(47 127 176 / 0.22); stroke: var(--td-water); stroke-width: 1.5; }
.td-diagram .moon { fill: #9aa1ad; }
.td-diagram .sun { fill: var(--accent-sun); }
.td-diagram .arrow { stroke: var(--text); stroke-width: 1.6; fill: none; marker-end: url(#td-arrow); }
.td-diagram .arrow-head { fill: var(--text); }
.td-diagram text { fill: var(--text); font: 12px system-ui, sans-serif; }
.td-diagram .muted { fill: var(--muted); }
.td-diagram .orbit { fill: none; stroke: var(--line); stroke-dasharray: 3 4; }

@media print {
  .td-tabs, .td-chips, .td-hero .td-now, .td-tools, .td-refs, .site-header, .circumstances, .site-footer, .td-print-hide { display: none !important; }
  .td-card { box-shadow: none; border: 0; padding: 0; }
  .td-table th, .td-table td { padding: 3px 5px; }
}

/* ---- Events: flood list ---- */
.td-flood-list { columns: 2 16em; column-gap: 24px; list-style: none; padding: 0; margin: 0; font-size: 0.92rem; }
.td-flood-list li { break-inside: avoid; padding: 3px 0; border-bottom: 1px solid var(--line); }
.td-flood-list .td-num { color: var(--td-flood); font-weight: 600; margin-left: 6px; }
.td-strong { font-weight: 600; color: var(--text); }

/* ---- Guides: examples, formula, explorer, figures ---- */
.td-block { display: block; }
.td-guide .td-card > h2 { font-size: 1.25rem; margin: 0 0 10px; }
.td-examples th[scope="row"] { white-space: normal; min-width: 14em; }
.td-formula { font: 1.05rem/1.4 Georgia, "Times New Roman", serif; padding: 8px 14px; border-left: 3px solid var(--td-water); background: var(--td-water-soft); border-radius: 0 8px 8px 0; display: inline-block; }
.td-explorer[hidden] { display: none; }
.td-explorer-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.td-explorer-head label { display: inline-flex; gap: 6px; align-items: center; font-size: 0.9rem; color: var(--muted); }
.td-explorer-head select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 5px 8px; max-width: 18em; }
.td-explorer-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.td-explorer-presets button { font: inherit; font-size: 0.84rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.td-explorer-presets button:hover { border-color: var(--td-water); }
.td-explorer canvas { display: block; width: 100%; height: 240px; margin-top: 6px; }
.td-diagram .on-earth { fill: #fff; font-weight: 600; }
.td-diagram .ladder-water { fill: var(--td-water-fill); }
.td-diagram .ladder-line { stroke: var(--td-water); stroke-width: 1.2; stroke-dasharray: 5 4; }
.td-diagram .ladder-zero { stroke: var(--text); stroke-width: 2.2; }
.td-diagram .twelfth { fill: var(--td-water); }
