/* SEASCOPE-DRIFT documentation. Light and dark, print-friendly. */
:root {
  --bg: #ffffff;
  --bg-soft: #f5f7f9;
  --bg-code: #eef1f4;
  --fg: #1b2430;
  --fg-soft: #4c5a6a;
  --muted: #7a8696;
  --line: #dfe4ea;
  --accent: #d8402b;
  --accent-soft: #fbe9e6;
  --link: #1d5fa8;
  --head: #0f1d2c;
  --head-fg: #e9eef3;
  --ok: #1d7a46;
  --api: #1d5fa8;
  --ui: #b9461f;
  --hit: #ffe58a;
  --hit-cur: #ffa43a;
  --radius: 8px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f151c; --bg-soft: #16202a; --bg-code: #1c2733; --fg: #dde4eb; --fg-soft: #aab6c3;
    --muted: #7f8c9a; --line: #2a3644; --accent: #f06a52; --accent-soft: #3a1f1a;
    --link: #78b2f0; --head: #0a1016; --ok: #5fcf8b; --api: #78b2f0; --ui: #f08a5d;
    --hit: #6b5714; --hit-cur: #b8641a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f151c; --bg-soft: #16202a; --bg-code: #1c2733; --fg: #dde4eb; --fg-soft: #aab6c3;
  --muted: #7f8c9a; --line: #2a3644; --accent: #f06a52; --accent-soft: #3a1f1a;
  --link: #78b2f0; --head: #0a1016; --ok: #5fcf8b; --api: #78b2f0; --ui: #f08a5d;
  --hit: #6b5714; --hit-cur: #b8641a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15.5px/1.6 var(--sans); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: 0.86em var(--mono); background: var(--bg-code); padding: 0.1em 0.35em; border-radius: 4px; }
pre { background: var(--bg-code); padding: 12px 14px; border-radius: var(--radius); overflow-x: auto; }
pre code { background: none; padding: 0; }

/* ---- header */
header.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px;
  height: 56px; padding: 0 20px; background: var(--head); color: var(--head-fg);
}
header.top a { color: var(--head-fg); }
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand small { font-weight: 400; opacity: 0.7; }
/* The application's brand pill: Anton, in its red, on a white pill. */
.brand .pill {
  display: inline-flex; align-items: center; height: 34px; padding: 0 15px;
  border-radius: 16px; background: #fff; color: #f04123;
  font-family: "Anton", var(--sans); font-size: 17px; letter-spacing: 0.04em;
}
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 6px 12px; border-radius: 6px; opacity: 0.8; }
.tabs a[aria-current] { background: rgba(255,255,255,0.12); opacity: 1; }
.tabs a:hover { text-decoration: none; opacity: 1; }
.versions { margin-left: auto; display: flex; gap: 8px; font-size: 12.5px; }
.ver { background: rgba(255,255,255,0.1); border-radius: 99px; padding: 3px 10px; white-space: nowrap; }
.menu { display: none; background: none; border: 0; color: inherit; font-size: 20px; cursor: pointer; }

/* ---- layout */
.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); }
.layout.notoc { grid-template-columns: minmax(0, 1fr); }
.toc {
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
  padding: 18px 14px 40px 18px; border-right: 1px solid var(--line); background: var(--bg-soft);
  font-size: 13.5px;
}
.toc input {
  width: 100%; padding: 7px 10px; margin-bottom: 12px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--bg); color: var(--fg); font: inherit;
}
.toc ol { list-style: none; margin: 0; padding: 0; }
.findbar { display: flex; align-items: center; gap: 4px; margin: -6px 0 12px; font-size: 12.5px; color: var(--muted); }
.findbar .count { flex: 1; }
.findbar button {
  width: 28px; height: 24px; border: 1px solid var(--line); border-radius: 5px;
  background: var(--bg); color: var(--fg-soft); cursor: pointer; font: inherit;
}
.findbar button:hover { color: var(--fg); border-color: var(--muted); }
.toc .hits { margin-left: auto; align-self: center; font-size: 11px; font-weight: 600; color: var(--accent); }
.toc .hits:empty { display: none; }
mark.hit { background: var(--hit); color: inherit; border-radius: 2px; }
mark.hit.cur { background: var(--hit-cur); box-shadow: 0 0 0 2px var(--hit-cur); }
.toc li a { display: flex; gap: 6px; padding: 3px 6px; border-radius: 5px; color: var(--fg-soft); }
.toc li a:hover { background: var(--bg-code); text-decoration: none; color: var(--fg); }
.toc li a.active { color: var(--accent); background: var(--accent-soft); }
.toc li.l1 { margin-top: 10px; }
.toc li.l1 > a { font-weight: 600; color: var(--fg); }
.toc li.l2 a { padding-left: 16px; }
.toc li.l3 a { padding-left: 32px; font-size: 12.5px; }
.toc .num { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 2.2em; }

.content { padding: 28px 48px 60px; max-width: 1060px; width: 100%; }
.content > p, .content > ul, .content > ol, .content > dl, .content > h2, .content > h3,
.content > h4, .content > .note, .content > blockquote { max-width: 820px; }

/* ---- headings */
.hero { padding: 18px 0 26px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.hero h1 { font-size: 34px; line-height: 1.15; margin: 4px 0 10px; letter-spacing: -0.01em; }
.hero.small h1 { font-size: 28px; }
.hero .kicker { color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; font-size: 20px; line-height: 1.3; margin: 0; }
.hero .lead { font-size: 18px; color: var(--fg-soft); margin: 0 0 8px; }
.hero .meta { color: var(--muted); font-size: 13.5px; margin: 0; }
h2, h3, h4 { line-height: 1.3; position: relative; }
h2 { font-size: 26px; margin: 56px 0 14px; padding-top: 18px; border-top: 2px solid var(--line); }
h3 { font-size: 20px; margin: 36px 0 10px; }
h4 { font-size: 16.5px; margin: 26px 0 8px; }
h2 .num, h3 .num, h4 .num { color: var(--accent); margin-right: 6px; font-variant-numeric: tabular-nums; }
.anchor { opacity: 0; margin-left: 8px; color: var(--muted); font-weight: 400; }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor { opacity: 1; }

/* ---- blocks */
.note, blockquote {
  background: var(--bg-soft); border-left: 3px solid var(--link); padding: 10px 14px;
  border-radius: 0 var(--radius) var(--radius) 0; margin: 16px 0;
}
blockquote { border-left-color: var(--accent); }
blockquote p { margin: 4px 0; }
.note p:first-child, blockquote p:first-child { margin-top: 0; }
.note p:last-child, blockquote p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.broken { background: #ffe066; color: #000; }
.pending { padding: 30px; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius); }
dl dt { font-weight: 600; margin-top: 10px; }
dl dd { margin-left: 18px; }

/* ---- figures */
figure.fig { margin: 22px 0 26px; }
figure.fig a.zoom img {
  display: block; max-width: 100%; height: auto; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--bg-soft); cursor: zoom-in;
}

figcaption { font-size: 13.5px; color: var(--fg-soft); margin-top: 8px; max-width: 820px; }
.figrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; align-items: start; }
.figrow figure.fig { margin: 0; }

/* ---- tables */
.tablewrap { overflow-x: auto; margin: 18px 0 24px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
caption { caption-side: top; text-align: left; font-size: 13.5px; color: var(--fg-soft); padding-bottom: 8px; }
th, td { text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--line); }
thead th { background: var(--bg-soft); font-weight: 600; font-size: 13px; white-space: nowrap; }
tbody tr:hover { background: var(--bg-soft); }
table.controls td:first-child { width: 1%; }
table.controls td:nth-child(2) { white-space: nowrap; }
.range { font-family: var(--mono); font-size: 12px; color: var(--fg-soft); }
table.schema td:first-child, table.endpoints td:nth-child(2) { white-space: nowrap; }
table.leeway td:nth-child(n+4) { text-align: right; font-variant-numeric: tabular-nums; }
.req { font-size: 11px; color: var(--accent); font-weight: 600; margin-left: 4px; }
.badge {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: #e23d28; color: #fff; font-weight: 700; font-size: 12.5px; border: 2px solid #fff;
  box-shadow: 0 0 0 1px #e23d28;
}

/* ---- what's new */
details.update { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; margin: 10px 0; }
details.update summary { cursor: pointer; }
.releases { display: grid; gap: 14px; }
.release { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.release header { display: flex; align-items: baseline; gap: 12px; }
.release h3 { margin: 0; font-size: 18px; padding: 0; border: 0; }
.release time { color: var(--muted); font-size: 13px; margin-left: auto; }
.release ul { margin: 8px 0 0; padding-left: 20px; font-size: 14px; }
.comp { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 4px; color: #fff; }
.comp-api { background: var(--api); }
.comp-ui { background: var(--ui); }
.sha { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

/* ---- footer, lightbox */
.foot { margin-top: 70px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
#lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(5, 10, 15, 0.88); display: grid; place-items: center; padding: 24px; }
#lightbox[hidden] { display: none; }
#lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }
#lightbox button { position: absolute; top: 14px; right: 18px; font-size: 30px; background: none; border: 0; color: #fff; cursor: pointer; }

/* ---- small screens */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu { display: block; }
  .tabs a { padding: 6px 8px; }
  .versions, .brand small { display: none; }
  header.top { gap: 10px; padding: 0 12px; }
  .tabs a { padding: 6px 6px; font-size: 14px; white-space: nowrap; }
  .tabs .long { display: none; }
  .toc { position: fixed; top: 56px; left: 0; width: min(320px, 88vw); z-index: 30; transform: translateX(-100%); transition: transform 0.2s; box-shadow: 4px 0 20px rgba(0,0,0,0.2); }
  .toc.open { transform: none; }
  .content { padding: 20px 16px 40px; }
  h2 { font-size: 22px; }
}

@media print {
  header.top, .toc, #lightbox, .anchor { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; max-width: none; }
  h2 { break-before: page; border-top: 0; }
  figure, table { break-inside: avoid; }
  a { color: inherit; }
}
td code { white-space: nowrap; }

/* ---- domain map */
.mapbox { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg-soft); }
.maptabs { display: flex; gap: 6px; padding: 8px; }
.maptabs button { font: inherit; font-size: 13.5px; padding: 5px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); cursor: pointer; }
.maptabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
#domainMap { height: 520px; }
.maplegend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 8px 12px; font-size: 13px; color: var(--fg-soft); }
.maplegend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 18px; height: 12px; border-radius: 2px; display: inline-block; }
.sw-national { border: 1.5px dashed #5b8fc9; background: rgba(91,143,201,0.08); }
.sw-ocean { border: 2px solid #1d5fa8; background: rgba(29,95,168,0.3); }
.sw-tide { border: 2px solid #0f9d8a; background: rgba(15,157,138,0.2); }
.sw-wind { border: 2px dashed #e07b1f; }
@media (max-width: 900px) { #domainMap { height: 380px; } }
@media print { .maptabs, #domainMap { display: none; } }
