/* DIVE-PL — dark theme (Diver / Engineer)
   Re-tokenised from the original light style.css. All class names preserved;
   the palette flips with [data-mode] on <html>. Diver = ocean blue + bathymetric
   texture; Engineer = cyan + graticule grid. */
:root {
  /* ---- Diver (default) ---- */
  --bg: #060d13;
  --bg-2: #05090d;
  --fg: #b4c0c7;
  --ink: #f1f6f8;
  --muted: #7d8c95;
  --rule: rgba(150,195,222,0.14);
  --card-bg: rgba(255,255,255,0.025);
  --row-hover: rgba(255,255,255,0.03);
  --accent: #2f9fd6;
  --accent-hover: #5bb6e2;
  --accent-soft: rgba(47,159,214,0.10);
  --accent-border: rgba(47,159,214,0.30);
  --accent-2: #f0832e;
  --accent-2-soft: rgba(240,131,46,0.09);
  --accent-2-border: rgba(240,131,46,0.40);
  --warn-bg: rgba(240,131,46,0.08);
  --warn-border: #e0a24d;
  --danger-bg: rgba(192,57,43,0.12);
  --danger-border: #c0392b;
  --danger-ink: #f0a89e;
  --code-bg: #0a141b;
  --lead: #c4d0d6;
  --hero-grad: linear-gradient(180deg,#0c2435 0%,#08161f 48%,#060d13 100%);
  --tex: 0.5;
  --max: 920px;
  --max-wide: 1240px;
  --font-display: Georgia, "Times New Roman", serif;
  --font-body: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
/* ---- Engineer overrides ---- */
html[data-mode="engineer"] {
  --accent: #36c9e6;
  --accent-hover: #63d6ee;
  --accent-soft: rgba(54,201,230,0.08);
  --accent-border: rgba(54,201,230,0.30);
  --hero-grad: linear-gradient(180deg,#08141a 0%,#070f14 60%,#060d13 100%);
  --tex: 0.6;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  position: relative;
}
/* ---- per-mode background texture (fixed, behind everything) ---- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: var(--tex);
}
html[data-mode="diver"] body::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='1200' height='600' preserveAspectRatio='none'><g fill='none' stroke='%232f9fd6' stroke-width='1' stroke-opacity='0.14'><path d='M-20 110 Q300 70 600 110 T1220 112'/><path d='M-20 200 Q320 156 620 196 T1220 200'/><path d='M-20 300 Q340 250 640 292 T1220 298'/><path d='M-20 404 Q360 350 660 396 T1220 404'/><path d='M-20 506 Q380 450 680 500 T1220 506'/></g></svg>");
  background-size: 100% 70vh;
  background-repeat: repeat-y;
}
html[data-mode="engineer"] body::before {
  background-image:
    linear-gradient(rgba(54,201,230,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(54,201,230,0.05) 1px, transparent 1px);
  background-size: 40px 40px;
}
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 clamp(1.25rem,3vw,3rem); position: relative; z-index: 1; }

/* ---- header ---- */
header.site {
  border-top: 3px solid var(--accent-2);
  border-bottom: 1px solid var(--rule);
  background: var(--hero-grad);
  position: relative;
  z-index: 2;
}
header.site .wrap { padding-top: 1.4rem; padding-bottom: 0.4rem; }
.brand { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; font-family: var(--font-display); }
.brand span { color: var(--accent); }
.brand:hover span { color: var(--accent-2); }
.tagline { color: var(--muted); font-size: 0.95rem; margin: 0.25rem 0 0.9rem; }
nav.site { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.4rem; padding-bottom: 0.6rem; }
nav.site a { text-decoration: none; color: var(--muted); font-size: 0.92rem; font-weight: 600; padding: 0.3rem 0.55rem; border-radius: 5px; transition: background .12s, color .12s; }
nav.site a:hover { background: var(--accent-soft); color: var(--accent); }
nav.site a.active { color: var(--ink); background: transparent; border-bottom: 2px solid var(--accent-2); border-radius: 0; padding-bottom: 0.18rem; }

/* ---- Diver / Engineer toggle (injected by mode.js) ---- */
.modes { display: inline-flex; align-items: center; border: 1px solid var(--accent-border); border-radius: 999px; overflow: hidden; margin-left: auto; }
.modes .seg { background: transparent; color: var(--muted); cursor: pointer; border: 0; padding: 0.32rem 0.7rem; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.03em; line-height: 1; transition: background .12s, color .12s; }
.modes .seg[aria-pressed="true"] { background: var(--accent); color: #04121b; }

main { padding: 2rem 0 1rem; position: relative; z-index: 1; }
footer.site { border-top: 1px solid var(--rule); margin-top: 3rem; padding: 1.4rem 0 2.4rem; color: var(--muted); font-size: 0.85rem; background: var(--bg-2); position: relative; z-index: 2; }
footer.site .wrap { z-index: 2; }
footer.site a { color: var(--muted); }
footer.site strong { color: #bcc9d0; font-family: var(--font-display); font-weight: 600; }
footer.site .lic { margin-top: 0.5rem; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; }
h1 { font-size: 2.3rem; line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 0.6rem; color: var(--ink); }
h2 { font-size: 1.5rem; margin: 2rem 0 0.6rem; padding-top: 0.9rem; border-top: 1px solid var(--rule); color: var(--ink); letter-spacing: -0.01em; }
h2:first-of-type { border-top: none; padding-top: 0; }
h3 { font-size: 1.15rem; margin: 1.4rem 0 0.4rem; color: var(--ink); }
p { margin: 0.6rem 0; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
ul, ol { padding-left: 1.3rem; }
li { margin: 0.25rem 0; }
small, .muted { color: var(--muted); }
hr { border: none; border-top: 1px solid var(--rule); margin: 2rem 0; }
.lead { font-size: 1.12rem; color: var(--lead); }
code { font-family: var(--font-mono); font-size: 0.86em; background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; color: #bcc9d0; }
pre { background: var(--code-bg); border: 1px solid var(--rule); border-radius: 6px; padding: 0.9rem 1rem; overflow-x: auto; font-size: 0.85rem; line-height: 1.5; color: #bcc9d0; }
pre code { background: none; padding: 0; font-size: inherit; }

table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { background: var(--accent-soft); font-weight: 600; color: #cdd9df; }
td { color: var(--fg); }
tbody tr:hover { background: var(--row-hover); }
.table-scroll { overflow-x: auto; }

.callout { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 0.8rem 1rem; border-radius: 0 6px 6px 0; margin: 1.2rem 0; font-size: 0.95rem; color: var(--fg); }
.callout.embargo { border-left-color: var(--warn-border); background: var(--warn-bg); }
.callout.warning { border-left-color: var(--accent-2); background: var(--accent-2-soft); }
.callout.warning strong { color: #f6b07a; }
.callout p:first-child { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--ink); }

.badges { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.9rem 0 0.4rem; }
.badge { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 0.2rem 0.55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); text-decoration: none; border: 1px solid var(--accent-border); }
.badge:hover { background: var(--accent-border); color: var(--ink); }
.pill { display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; padding: 0.1rem 0.45rem; border-radius: 4px; background: rgba(150,195,222,0.12); color: var(--muted); }
.pill.lic-mit { background: rgba(58,75,168,0.18); color: #aeb8ee; }
.pill.lic-cc { background: rgba(31,122,61,0.16); color: #9fd6ad; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px,1fr)); gap: 1rem; margin: 1.2rem 0; }
.card { border: 1px solid var(--rule); border-radius: 8px; padding: 1rem 1.1rem; background: var(--card-bg); }
.card h3 { margin-top: 0; }
.card p { font-size: 0.92rem; color: var(--muted); }

.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 1rem; top: 0.5rem; background: var(--bg); color: var(--ink); padding: 0.4rem 0.7rem; z-index: 10; border: 1px solid var(--accent); }

.flow { display: flex; flex-direction: column; align-items: center; margin: 1.2rem 0 2rem; }
.flow-step { width: min(460px,100%); text-align: center; border: 1px solid var(--accent-border); border-radius: 8px; padding: 0.55rem 0.9rem; background: var(--accent-soft); font-size: 0.9rem; font-weight: 600; color: var(--ink); }
.flow-step:not(:last-child) { margin-bottom: 1.6rem; position: relative; }
.flow-step:not(:last-child)::after { content: "\2193"; position: absolute; left: 50%; transform: translateX(-50%); bottom: -1.35rem; color: var(--accent-2); font-size: 1.1rem; font-weight: 700; }
.flow-step.scoped { background: var(--card-bg); color: var(--muted); font-weight: 500; border-style: dashed; }

/* Light figures (e.g. architecture diagram) sit on their own panel so they stay legible on dark */
main img { max-width: 100%; height: auto; background: #f7f9fb; border: 1px solid var(--rule); border-radius: 8px; padding: 6px; }

@media (max-width: 560px) { body { font-size: 16px; } h1 { font-size: 1.65rem; } .modes { margin-left: 0; } }
