/* Layout: one centered column at 1200px; full-width navy hero band with column lines, sand body, ruled sections like a field manual. */
:root {
  --bg: #F4F2ED;        /* Sand */
  --surface: #FBFAF7;
  --fill: #E3ECF6;      /* Sky */
  --fg: #13233A;
  --heading: #0E2A47;   /* Navy */
  --muted: #384557;     /* Slate */
  --soft: #5A6577;
  --accent: #1F5FA8;    /* Harbor Blue, for text and links */
  --signal: #EE7623;    /* Orange, for bars, rules, highlights only */
  --rule: #D8D2C6;
  --band: #0E2A47;
  --band-line: #163658;
  --band-fg: #F4F2ED;
  --band-muted: #BCCBDD;
  --font-display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --font-body: "Public Sans", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Courier New", monospace;
  --wrap: 1200px;
  --input-bg: #FFFFFF;
  --ok-bg: #E3ECF6;  --ok-fg: #0E2A47;  --ok-edge: #1F5FA8;
  --err-bg: #FCEBDD; --err-fg: #8A3A0E; --err-edge: #B4531A;
  color-scheme: light;
}

/* Dark mode follows the visitor's browser or operating system setting automatically.
   Only the color tokens change; every component reads from them. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1F35; --surface: #0E2A47; --fill: #13345A; --fg: #E6E9EE; --heading: #F4F2ED;
    --muted: #BCCBDD; --soft: #8FA3BC; --accent: #7FB0EA; --signal: #F28A3E; --rule: #24456B;
    --band: #081828; --band-line: #102A45; --band-fg: #F4F2ED; --band-muted: #BCCBDD;
    --input-bg: #0B1F35;
    --ok-bg: #13345A;  --ok-fg: #E6E9EE;  --ok-edge: #7FB0EA;
    --err-bg: #3A2416; --err-fg: #FFD9BF; --err-edge: #F28A3E;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }
h1, h2, h3 { color: var(--heading); text-wrap: balance; margin: 0; }
p { margin: 0; }

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Header */
.site-header { background: var(--band); color: var(--band-fg); border-bottom: 1px solid var(--band-line); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 32px; padding-block: 18px; }
.wordmark { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; letter-spacing: 0.02em; text-transform: uppercase; color: var(--band-fg); text-decoration: none; }
.wordmark span { color: var(--signal); }
.nav { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.nav a { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--band-muted); text-decoration: none; padding-block: 4px; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--band-fg); border-bottom-color: var(--signal); }

/* Hero */
.hero {
  background: repeating-linear-gradient(90deg, var(--band) 0 119px, var(--band-line) 119px 120px), var(--band);
  color: var(--band-fg);
}
.hero .wrap { display: flex; flex-direction: column; gap: 28px; padding-block: 96px 88px; }
.hero .label { color: var(--signal); }
.bar { width: 96px; height: 8px; background: var(--signal); }
.hero h1 {
  color: var(--band-fg);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3rem, 9vw, 6.5rem);
  line-height: 0.95;
  text-transform: uppercase;
  max-width: 14ch;
}
.hero .lede { color: var(--band-muted); font-size: 1.25rem; max-width: 58ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; padding-top: 8px; }
.btn {
  display: inline-block; font-family: var(--font-mono); font-size: 0.82rem; letter-spacing: 0.12em; text-transform: uppercase;
  text-decoration: none; padding: 14px 22px; border: 2px solid var(--signal);
}
.btn-primary { background: var(--signal); color: #0E2A47; font-weight: 600; }
.btn-ghost { color: var(--band-fg); }
.btn:hover { filter: brightness(1.08); }

/* Sections */
.section .wrap { display: flex; flex-direction: column; gap: 40px; padding-block: 88px; }
.section + .section .wrap { border-top: 2px solid var(--rule); }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; max-width: 760px; }
.section-head .label { color: var(--accent); }
.section-head h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.05; }
.section-head p { color: var(--muted); font-size: 1.1rem; max-width: 62ch; }
.section-tint { background: var(--fill); }
.section-tint + .section .wrap, .section + .section-tint .wrap { border-top: none; }

/* Series modules */
.modules { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 20px; }
.module { background: var(--surface); border-top: 6px solid var(--accent); padding: 28px 24px 26px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.module.is-featured { border-top-color: var(--signal); }
.module .num { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600; color: var(--accent); }
.module h3 { font-size: 1.3rem; font-weight: 700; }
.module p { color: var(--muted); font-size: 0.98rem; }
.series-kit { display: flex; flex-wrap: wrap; gap: 10px 28px; color: var(--muted); font-size: 0.98rem; }
.series-kit li { list-style: none; display: flex; gap: 10px; align-items: baseline; }
.series-kit li::before { content: ""; width: 10px; height: 10px; background: var(--signal); flex: none; transform: translateY(-1px); }
.series-kit { padding: 0; margin: 0; }

/* Approach */
.principles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0; border-top: 2px solid var(--heading); }
.principle { padding: 28px 28px 8px 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.principle h3 { font-family: var(--font-display); font-size: 1.8rem; font-weight: 600; text-transform: uppercase; }
.principle p { color: var(--muted); }

/* Notes list */
.notes { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--rule); }
.notes li { border-bottom: 2px solid var(--rule); }
.notes a { display: grid; grid-template-columns: 9rem minmax(0, 1fr) auto; gap: 8px 32px; align-items: baseline; padding-block: 22px; text-decoration: none; color: var(--fg); }
.notes time { font-family: var(--font-mono); font-size: 0.85rem; color: var(--soft); font-variant-numeric: tabular-nums; }
.notes .title { font-weight: 700; font-size: 1.15rem; color: var(--heading); }
.notes .tag { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.notes a:hover .title { color: var(--accent); }

/* About */
.about { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 56px; align-items: start; }
.about-body { display: flex; flex-direction: column; gap: 18px; color: var(--muted); max-width: 62ch; }
.facts { background: var(--surface); border-left: 6px solid var(--signal); padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.facts dt { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--soft); }
.facts dd { margin: 4px 0 0; font-weight: 600; color: var(--heading); }
.facts dl { margin: 0; display: flex; flex-direction: column; gap: 16px; }

/* Off the clock */
.interests { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.interest { border: 2px solid var(--rule); padding: 24px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.interest h3 { font-size: 1.15rem; }
.interest p { color: var(--muted); font-size: 0.98rem; }

/* Footer */
.site-footer { background: var(--band); color: var(--band-muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; padding-block: 56px; }
.site-footer .wordmark { font-size: 1.4rem; }
.site-footer p { max-width: 40ch; margin-top: 10px; }
.contact { display: flex; flex-direction: column; gap: 8px; }
.contact .label { color: var(--signal); }
.contact span { color: var(--band-fg); font-family: var(--font-mono); font-size: 0.95rem; }
.site-footer .legal { width: 100%; border-top: 1px solid var(--band-line); padding-top: 20px; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; }

@media (max-width: 760px) {
  .about { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .notes a { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .section .wrap { padding-block: 64px; }
  .hero .wrap { padding-block: 64px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- Additions for the PHP site ---- */
.skip-link { position: absolute; left: 16px; top: -48px; z-index: 10; background: var(--signal); color: #0E2A47; padding: 10px 16px; font-weight: 700; }
.skip-link:focus { top: 12px; }

.hero-compact .wrap { padding-block: 64px 56px; gap: 20px; }
.hero-compact h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); max-width: 22ch; }

.module h3 a { color: inherit; text-decoration: none; }
.module h3 a:hover { color: var(--accent); text-decoration: underline; }

.footer-nav { display: flex; flex-direction: column; gap: 8px; }
.footer-nav a { color: var(--band-muted); text-decoration: none; }
.footer-nav a:hover { color: var(--band-fg); text-decoration: underline; }

/* Long-form text: notes and module pages */
.prose { max-width: 68ch; display: flex; flex-direction: column; gap: 18px; color: var(--fg); min-width: 0; }
.prose h2 { font-family: var(--font-display); font-weight: 600; font-size: 2rem; line-height: 1.1; padding-top: 12px; }
.prose ul, .prose ol { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 8px; }
.prose li::marker { color: var(--signal); }
.prose code { font-family: var(--font-mono); font-size: 0.88em; background: var(--fill); padding: 1px 6px; }
.prose pre { background: var(--band); color: var(--band-fg); padding: 18px; overflow-x: auto; font-family: var(--font-mono); font-size: 0.85rem; }

/* Downloads panel */
.facts-title { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--soft); font-weight: 600; }
.downloads { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.downloads li { display: flex; flex-direction: column; gap: 2px; padding-block: 14px; border-top: 2px solid var(--rule); }
.downloads li:last-child { border-bottom: 2px solid var(--rule); }
.downloads a { font-weight: 700; }
.downloads span { font-family: var(--font-mono); font-size: 0.78rem; color: var(--soft); }
.downloads .pending { font-family: var(--font-body); font-size: 1rem; font-weight: 700; color: var(--muted); }

/* Previous / next */
.pager { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 2px solid var(--heading); padding-top: 20px; }
.pager a { display: flex; flex-direction: column; gap: 4px; text-decoration: none; font-weight: 700; color: var(--heading); }
.pager a .label { color: var(--accent); }
.pager a:hover { color: var(--accent); }
.pager .next { text-align: right; margin-left: auto; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 20px; max-width: 640px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; color: var(--heading); }
.field input, .field textarea {
  font: inherit; color: var(--fg); background: var(--input-bg);
  border: 2px solid var(--rule); padding: 12px 14px; width: 100%; border-radius: 0;
}
.field textarea { resize: vertical; min-height: 9rem; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--fill); }
.field.has-error input, .field.has-error textarea { border-color: var(--err-edge); }
.field .error { color: var(--err-fg); font-size: 0.95rem; }
.form .btn { align-self: flex-start; cursor: pointer; font-family: var(--font-mono); }
.form-note { color: var(--soft); font-size: 0.9rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.notice { padding: 16px 18px; margin-bottom: 24px; border-left: 6px solid; }
.notice-ok { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-edge); }
.notice-error { background: var(--err-bg); color: var(--err-fg); border-color: var(--err-edge); }

/* Full-width "about" block on module pages */
.module-about { max-width: none; border-top: 2px solid var(--rule); padding-top: 32px; }
.module-about strong { color: var(--heading); }

/* Tables inside long-form pages (privacy policy cookie table) */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.data-table th, .data-table td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 2px solid var(--rule); }
.data-table th { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--soft); border-bottom-color: var(--heading); }
.data-table td:first-child { white-space: nowrap; }