/* ─────────────────────────────────────────────────────────────
   Ephem · site stylesheet · v0.1
   Implements §8 of EPHEM_CODEX.md. Everything here is deliberate.
   Do NOT add colours, fonts, or components without cross-checking
   the anti-templated §8.1 list.
   ───────────────────────────────────────────────────────────── */

:root {
  /* §8.2 palette — fixed, no theming */
  --paper:  #F5F1E7;
  --ink:    #1C1917;
  --rule:   #C9C1AE;
  --muted:  #6B6355;
  --rust:   #B4412C;
  --sea:    #2A3E5F;
  --flag:   #8B7500;

  /* §8.3 typography — all system stacks, zero web-fonts */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono:  "IBM Plex Mono", "SF Mono", ui-monospace, Consolas, "Courier New", monospace;

  --measure: 68ch;
  --gutter: 1.5rem;
  --hairline: 0.5px solid var(--rule);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  background: var(--paper);
  color: var(--ink);
  margin: 0;
  padding: 0;
}

body {
  font: 17px/1.55 var(--serif);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* --- Type scale (§8.3) ------------------------------------------------- */

h1, h2, h3, h4 {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 0.5rem;
  color: var(--ink);
}

h1 { font-size: 2.25rem; margin-top: 0; }
h2 { font-size: 1.35rem; margin-top: 2.5rem; }
h3 { font-size: 1.05rem; margin-top: 1.75rem; }
h4 {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 1.25rem;
}

p, ul, ol, dl, blockquote, figure, table, pre {
  margin: 0 0 1rem;
}

p, li, dt, dd { line-height: 1.6; }

blockquote {
  border-left: 2px solid var(--rust);
  padding: 0.1rem 0 0.1rem 1rem;
  margin-left: 0;
  font-style: italic;
  color: var(--muted);
}

/* --- Links (§8.6): underlined, sea for content, rust for CTAs ---------- */

a {
  color: var(--sea);
  text-decoration: underline;
  text-decoration-thickness: 0.5px;
  text-underline-offset: 2px;
  transition: color 100ms linear;
}

a:hover, a:focus { color: var(--rust); }

a.cta {
  color: var(--rust);
  font-family: var(--mono);
  font-size: 0.9em;
  text-decoration: none;
  border-bottom: 0.5px solid var(--rust);
  padding-bottom: 1px;
}

a.cta:hover { background: rgba(180, 65, 44, 0.08); }

/* --- Rules & hairlines (§8.4: sections separated by 0.5px hairlines) --- */

hr, .rule {
  border: 0;
  border-top: var(--hairline);
  margin: 2rem 0;
}

/* --- Code (§8.3 mono, no ligatures) ------------------------------------ */

code, kbd, samp {
  font-family: var(--mono);
  font-size: 0.88em;
  font-variant-ligatures: none;
}

pre {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: auto;
  padding: 0.75rem 0;
  margin: 0.5rem 0;
  border-top: var(--hairline);
  border-bottom: var(--hairline);
  background: transparent;
}

pre code { font-size: inherit; }

/* --- Layout (§8.4: asymmetric grid, wide left margin like a footnoted book) --- */

.page {
  max-width: 76rem;
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 6rem;
}

.narrow {
  max-width: var(--measure);
  margin-inline: auto;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 3fr);
  gap: calc(var(--gutter) * 2);
  align-items: start;
}

.grid > .main { min-width: 0; }
.grid > .sidebar {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--muted);
  border-top: var(--hairline);
  padding-top: 1rem;
  position: sticky;
  top: 1rem;
}

.grid > .sidebar h4 { margin-top: 0; }
.grid > .sidebar a { color: var(--muted); }
.grid > .sidebar a:hover { color: var(--rust); }
.grid > .sidebar ul { list-style: none; padding: 0; }
.grid > .sidebar li { margin-bottom: 0.35rem; }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .grid > .sidebar { position: static; margin-top: 2rem; }
}

/* --- Masthead --------------------------------------------------------- */

.masthead {
  border-bottom: var(--hairline);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1rem;
}

.masthead .wordmark {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.masthead .wordmark:hover { color: var(--rust); }

.masthead .est {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.masthead nav {
  margin-left: auto;
  display: flex;
  gap: 1.25rem;
  font-family: var(--sans);
  font-size: 14px;
}

.masthead nav a {
  color: var(--ink);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

.masthead nav a:hover, .masthead nav a[aria-current="page"] {
  color: var(--rust);
  border-bottom-color: var(--rust);
}

@media (max-width: 640px) {
  .masthead nav { margin-left: 0; width: 100%; flex-wrap: wrap; }
}

/* --- Eyebrows & captions (§8.3 UPPERCASE labels) ---------------------- */

.eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.35rem;
  display: inline-block;
}

.caption {
  font-style: italic;
  color: var(--muted);
  font-size: 0.9em;
}

/* --- Data blocks (§8.6): mono, framed with hairlines ------------------ */

.datum {
  margin: 1.25rem 0 1.5rem;
  padding: 0.85rem 0 0.75rem;
  border-top: var(--hairline);
  border-bottom: var(--hairline);
}

.datum > .eyebrow { margin-bottom: 0.35rem; }
.datum pre { border: 0; padding: 0.25rem 0; margin: 0; }
.datum .caption { margin: 0.5rem 0 0; font-family: var(--sans); font-style: normal; }

/* --- Tables (§8.4: tables > cards) ------------------------------------ */

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 0.4rem 0.75rem 0.4rem 0;
  border-bottom: var(--hairline);
  vertical-align: top;
}

th {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom-width: 1px;
  border-bottom-color: var(--ink);
}

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }

/* --- Lists ------------------------------------------------------------- */

ul, ol { padding-left: 1.5rem; }
li + li { margin-top: 0.35rem; }

.plain-list { list-style: none; padding: 0; }
.plain-list li { border-bottom: var(--hairline); padding: 0.5rem 0; }

/* --- Footnotes -------------------------------------------------------- */

.footnote {
  font-size: 0.85em;
  color: var(--muted);
  vertical-align: super;
  text-decoration: none;
  border: 0;
}

.footnotes {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ink);
  font-size: 0.9em;
  color: var(--muted);
}

.footnotes ol { padding-left: 1.25rem; }
.footnotes li { margin-bottom: 0.35rem; }

/* --- Section markers (§1, §2 …) --------------------------------------- */

.section-marker {
  font-family: var(--mono);
  color: var(--rust);
  font-weight: 400;
  padding-right: 0.35rem;
}

/* --- Callouts (only two: note, deprecation/warning) ------------------- */

.note {
  border-left: 2px solid var(--sea);
  padding: 0.25rem 0 0.25rem 1rem;
  margin: 1rem 0;
  color: var(--ink);
}

.warn {
  border-left: 2px solid var(--flag);
  padding: 0.25rem 0 0.25rem 1rem;
  margin: 1rem 0;
  color: var(--ink);
}

/* --- Footer ----------------------------------------------------------- */

.site-footer {
  margin-top: 5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: baseline;
  justify-content: space-between;
}

.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--rust); }
.site-footer .colophon { font-family: var(--mono); font-size: 12px; }

/* --- Image + figure --------------------------------------------------- */

figure { margin: 1.5rem 0; }
figure img { max-width: 100%; height: auto; display: block; }
figure figcaption { margin-top: 0.5rem; font-style: italic; color: var(--muted); font-size: 0.9em; }

/* --- Map surface (overhead map page only) ----------------------------- */

.map-shell {
  border-top: var(--hairline);
  border-bottom: var(--hairline);
  margin: 1rem 0 1.5rem;
  background: #EDE6D3;
}

#map {
  height: min(70vh, 640px);
  width: 100%;
}

.legend {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink);
  padding: 0.5rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.legend .swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 0.35rem;
  vertical-align: middle;
  border: 0.5px solid var(--ink);
}

/* Provider swatch colours — kept sober per §8.1 (no neon). */
.legend .starlink { background: var(--rust); }
.legend .oneweb   { background: var(--sea); }
.legend .iridium  { background: var(--flag); }
.legend .viasat   { background: var(--muted); }

/* --- Overrides for Leaflet chrome so it doesn't scream "template" ----- */

.leaflet-container {
  font-family: var(--sans) !important;
  background: #EDE6D3 !important;
}

.leaflet-popup-content-wrapper {
  border-radius: 0 !important;
  border: 1px solid var(--ink) !important;
  background: var(--paper) !important;
  box-shadow: none !important;
  padding: 0.35rem 0.5rem !important;
  font-size: 13px !important;
  color: var(--ink) !important;
}

.leaflet-popup-tip { display: none !important; }

.leaflet-control-attribution {
  background: rgba(245, 241, 231, 0.85) !important;
  color: var(--muted) !important;
  font-family: var(--mono) !important;
  font-size: 10px !important;
}

.leaflet-bar a {
  background: var(--paper) !important;
  color: var(--ink) !important;
  border-radius: 0 !important;
  border-color: var(--ink) !important;
}

/* --- Prose helpers ---------------------------------------------------- */

.mono   { font-family: var(--mono); font-size: 14px; }
.muted  { color: var(--muted); }
.rust   { color: var(--rust); }
.sea    { color: var(--sea); }
.small  { font-size: 0.85em; }
.tabular { font-variant-numeric: tabular-nums; }

/* --- Print (§8 spirit: this reads as a bulletin, so print it as one) --- */

@media print {
  a { color: var(--ink); text-decoration: none; }
  .masthead nav, .site-footer, .map-shell { display: none; }
  body { font-size: 12pt; }
  .page { padding: 0; max-width: none; }
}
