/* AfricaHackOn Range — Training Archive
   An editorial archive for range training logs. Ink-teal ground, brass accent
   for marks/dates, signal teal reserved for interactive elements. */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400;1,6..72,500&family=Source+Serif+4:opsz,wght@8..60,400;8..60,500&family=Work+Sans:wght@400;500;600&display=swap');

:root {
  --ink: #0F1D1B;
  --surface: #16302B;
  --surface-soft: #12251F;
  --line: #24413B;
  --line-soft: #1B322C;

  --text: #EDE7D8;
  --text-muted: #93A39A;
  --text-dim: #5C6E66;

  --gold: #C99B4D;
  --gold-soft: #8A7042;
  --teal: #6FC4BA;
  --teal-dim: #3F7A72;
  --flag: #B9683F;

  --font-display: 'Newsreader', Georgia, serif;
  --font-serif: 'Source Serif 4', Georgia, serif;
  --font-ui: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal); }
a:hover { color: #92D9D0; }
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}

.wrap-wide {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
}

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

.masthead {
  border-bottom: 1px solid var(--line-soft);
}

.masthead .wrap-wide {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.masthead-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--text);
  text-decoration: none;
}

.masthead-mark {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.masthead-brand em {
  font-style: italic;
  color: var(--gold);
}

.masthead nav {
  display: flex;
  gap: 26px;
  font-size: 14px;
}

.masthead nav a {
  color: var(--text-muted);
  text-decoration: none;
}
.masthead nav a:hover { color: var(--text); }

/* ---------- Hero: range map ---------- */

.hero {
  position: relative;
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
  overflow: hidden;
}

.hero-map {
  display: block;
  width: 100%;
  height: auto;
}

.hero-node {
  animation: node-in 1.6s ease-out both;
  transform-origin: center;
}
.hero-link {
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  animation: link-in 2.2s ease-out forwards;
}

@keyframes node-in {
  from { opacity: 0; transform: scale(0.2); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes link-in {
  to { stroke-dashoffset: 0; }
}

.hero-caption {
  position: absolute;
  left: 24px;
  bottom: 16px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  color: var(--text-dim);
}

/* ---------- Article head ---------- */

article { padding-top: 46px; }

.dek {
  font-family: var(--font-ui);
  font-size: 14.5px;
  color: var(--gold);
  margin: 0 0 14px;
}

h1.title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.14;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
  max-width: 16ch;
}

.banner-image {
  display: block;
  width: 100%;
  max-height: 340px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  margin: 0 0 26px;
}

.inline-figure {
  float: right;
  width: 240px;
  max-width: 40%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--line);
  margin: 4px 0 14px 22px;
}

.narrative::after { content: ""; display: table; clear: both; }

.byline-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 6px;
  font-size: 14px;
  color: var(--text-muted);
  padding-bottom: 22px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line-soft);
}

.byline-row .tag {
  font-size: 12.5px;
  color: var(--text-muted);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 3px 11px;
}

/* ---------- Lede with drop cap + narrative ---------- */

.lede {
  font-family: var(--font-serif);
  font-size: 19.5px;
  line-height: 1.6;
  color: var(--text);
  margin: 0 0 20px;
}

.lede::first-letter {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 3.6em;
  line-height: 0.8;
  float: left;
  padding: 0.04em 0.08em 0 0;
  color: var(--gold);
}

.narrative p {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.7;
  color: #CBD5CE;
  margin: 0 0 20px;
  max-width: 66ch;
}

.pull {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 24px;
  line-height: 1.4;
  color: var(--gold);
  border-left: 2px solid var(--gold-soft);
  padding: 4px 0 4px 22px;
  margin: 34px 0;
  max-width: 46ch;
}

/* ---------- Timeline: editorial two-column ---------- */

.timeline-head {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 26px;
  margin: 8px 0 8px;
}

.timeline-intro {
  font-family: var(--font-serif);
  color: var(--text-muted);
  font-size: 15.5px;
  margin: 0 0 8px;
  max-width: 60ch;
}

.timeline {
  margin-top: 26px;
  border-top: 1px solid var(--line-soft);
}

.tl-entry {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 22px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line-soft);
}

.tl-date {
  font-family: var(--font-display);
  color: var(--gold);
}

.tl-date .d-day {
  display: block;
  font-size: 22px;
  line-height: 1.1;
}

.tl-date .d-year {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  font-family: var(--font-ui);
  margin-top: 2px;
}

.tl-date .d-pending {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-dim);
}

.tl-ref {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-dim);
  margin: 6px 0 0;
}

.tl-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 19px;
}

button.doc-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: var(--teal);
  text-align: left;
  border-bottom: 1px solid var(--teal-dim);
}
button.doc-link:hover { color: #92D9D0; border-color: var(--teal); }

.doc-link-disabled {
  color: var(--text-dim);
}

.tl-desc {
  font-family: var(--font-serif);
  font-size: 15.5px;
  color: #CBD5CE;
  margin: 0;
  max-width: 58ch;
}

.tl-thumb {
  display: inline-block;
  margin-top: 14px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-soft);
  cursor: pointer;
  line-height: 0;
}
.tl-thumb:hover { border-color: var(--teal-dim); }
.tl-thumb img {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  opacity: 0.92;
}

.flag {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 11.5px;
  color: var(--flag);
  border: 1px solid var(--flag);
  border-radius: 20px;
  padding: 1px 9px;
  margin-left: 8px;
  vertical-align: middle;
}

@media (max-width: 600px) {
  .tl-entry { grid-template-columns: 1fr; gap: 6px; }
}

/* ---------- About ---------- */

.about { padding: 46px 0 10px; }

.about h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 21px;
  margin: 0 0 12px;
}

.about p {
  font-family: var(--font-serif);
  color: var(--text-muted);
  max-width: 62ch;
  font-size: 15.5px;
}

.about code {
  font-family: var(--font-ui);
  font-size: 12.5px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--text);
}

/* ---------- Related ---------- */

.related { padding: 40px 0 10px; }

.related h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 19px;
  margin: 0 0 14px;
}

.related-item {
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}

.related-item a {
  font-family: var(--font-serif);
  font-size: 15.5px;
  text-decoration: none;
  border-bottom: 1px solid var(--teal-dim);
}
.related-item a:hover { border-color: var(--teal); }

.related-item .r-date {
  font-family: var(--font-ui);
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
}

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

footer {
  border-top: 1px solid var(--line-soft);
  margin-top: 54px;
  padding: 24px 0 54px;
}

footer .wrap {
  color: var(--text-dim);
  font-size: 12.5px;
  font-family: var(--font-ui);
  display: flex;
  justify-content: space-between;
}

/* ---------- Viewer modal ---------- */

.viewer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 9, 8, 0.86);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}

.viewer-backdrop.open { display: flex; }

.viewer-panel {
  width: min(980px, 100%);
  height: min(88vh, 900px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(24px);
  opacity: 0;
  animation: viewer-in 0.28s ease-out forwards;
}

@keyframes viewer-in {
  to { transform: translateY(0); opacity: 1; }
}

.viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.viewer-head-text .v-ref {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--gold);
}

.viewer-head-text .v-title {
  font-family: var(--font-display);
  font-size: 16px;
  margin-top: 2px;
}

.viewer-head-actions {
  display: flex;
  gap: 14px;
  align-items: center;
}

.viewer-head-actions a {
  font-size: 13px;
  text-decoration: none;
  border-bottom: 1px solid var(--teal-dim);
}

.viewer-close {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-muted);
  border-radius: 20px;
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 5px 12px;
  cursor: pointer;
}
.viewer-close:hover { color: var(--text); border-color: var(--text-muted); }

.viewer-frame { flex: 1; border: none; background: #22262a; }
