/* ============================================================
   Ole Aamot — oleaamot.com
   Design: a life read as a route. Ole builds location-based
   search and GPS-altitude tools; the page borrows that
   vocabulary — a track line with waypoints — to carry a
   chronological memoir instead of generic numbered sections.
   ============================================================ */

:root {
  --bg: #12130f;
  --bg-panel: #191b14;
  --bg-panel-2: #20221a;
  --text: #ece7d8;
  --text-muted: #9a967f;
  --text-faint: #6b6957;
  --accent-rust: #c1613a;
  --accent-rust-dim: #8a4527;
  --accent-fjord: #6f9c92;
  --line: #34362a;
  --line-soft: #24261d;

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  --measure: 40rem;
  --edge: clamp(1.25rem, 4vw, 3.5rem);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 40% at 15% 0%, rgba(193,97,58,0.07), transparent 60%),
    radial-gradient(ellipse 50% 30% at 90% 15%, rgba(111,156,146,0.05), transparent 60%);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { max-width: 100%; display: block; }

::selection { background: var(--accent-rust); color: #12130f; }

:focus-visible {
  outline: 2px solid var(--accent-fjord);
  outline-offset: 3px;
}

/* ---------- progress altimeter ---------- */
.altimeter {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-rust), var(--accent-fjord));
  z-index: 60;
  transition: width 0.08s linear;
}

/* ---------- top nav ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem var(--edge);
  background: rgba(18,19,15,0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}

.topbar .mark {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.topbar .mark .dot { color: var(--accent-rust); }

.topbar nav {
  display: flex;
  gap: 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.topbar nav a {
  text-decoration: none;
  color: var(--text-muted);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 0.15s, border-color 0.15s;
}
.topbar nav a:hover { color: var(--accent-rust); border-color: var(--accent-rust); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
}

@media (max-width: 760px) {
  .topbar nav {
    position: fixed;
    top: 52px; right: 0; left: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--line);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .topbar nav.open { max-height: 70vh; overflow-y: auto; }
  .topbar nav a {
    padding: 0.85rem var(--edge);
    border-bottom: 1px solid var(--line-soft);
    width: 100%;
  }
  .nav-toggle { display: block; }
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  padding: clamp(3.5rem, 10vw, 7rem) var(--edge) clamp(3rem, 8vw, 5rem);
  max-width: 68rem;
  margin: 0 auto;
}

.hero .coords {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-fjord);
  letter-spacing: 0.06em;
  margin-bottom: 1.4rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.6rem, 7vw, 5rem);
  line-height: 1.02;
  margin: 0 0 1.1rem;
  letter-spacing: -0.01em;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent-rust);
}

.hero .tagline {
  max-width: 38rem;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-style: italic;
  line-height: 1.6;
}

.hero .meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  margin-top: 2.6rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
}
.hero .meta-row span { display: block; color: var(--text-muted); margin-bottom: 0.25rem; }

/* ---------- route rail (signature element) ---------- */
.route {
  position: relative;
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 var(--edge) 6rem;
}

.route-line {
  position: absolute;
  left: calc(var(--edge) + 1px);
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--line) 3%, var(--line) 97%, transparent);
}
@media (max-width: 640px) { .route-line { left: 1rem; } }

.era {
  margin: 0 0 0.5rem;
}

.era-heading {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding: 3.4rem 0 1.2rem 2.6rem;
}
@media (max-width: 640px) { .era-heading { padding-left: 2.1rem; } }

.era-heading::before {
  content: "";
  position: absolute;
  left: calc(1px - 4px);
  top: 3.6rem;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent-fjord);
  box-shadow: 0 0 0 4px var(--bg);
}
@media (max-width: 640px) { .era-heading::before { left: calc(1rem - 4px - 2.6rem + 2.1rem); } }

.era-heading .years {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-fjord);
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.era-heading h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  margin: 0;
  color: var(--text);
}

/* ---------- chapter / waypoint ---------- */
.chapter {
  position: relative;
  padding: 1.9rem 0 1.9rem 2.6rem;
  border-top: 1px solid var(--line-soft);
}
.chapter:first-of-type { border-top: none; }
@media (max-width: 640px) { .chapter { padding-left: 2.1rem; } }

.chapter::before {
  content: "";
  position: absolute;
  left: calc(1px - 3px);
  top: 2.5rem;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-rust);
  box-shadow: 0 0 0 4px var(--bg);
}
@media (max-width: 640px) { .chapter::before { left: calc(1rem - 3px - 2.6rem + 2.1rem); } }

.chapter-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin-bottom: 0.9rem;
}

.chapter-waypoint {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}
.chapter-waypoint .n { color: var(--accent-rust); }

.chapter h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.25rem, 2.6vw, 1.6rem);
  margin: 0;
  line-height: 1.25;
  flex-basis: 100%;
}

.chapter-body {
  max-width: var(--measure);
  color: var(--text);
}
.chapter-body p { margin: 0 0 1.05em; }
.chapter-body p:last-child { margin-bottom: 0; }
.chapter-body strong { color: var(--text); font-weight: 600; }
.chapter-body em { color: var(--accent-fjord); font-style: italic; }
.chapter-body a.inline-link {
  color: var(--accent-fjord);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}
.chapter-body a.inline-link:hover { text-decoration-color: var(--accent-fjord); }

.chapter[data-toggle="closed"] .chapter-body { display: none; }

.chapter-toggle {
  background: none;
  border: none;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  text-transform: uppercase;
}
.chapter-toggle:hover { color: var(--accent-rust); }

/* ---------- pull quote (used once, sparingly) ---------- */
.pullquote {
  max-width: 44rem;
  margin: 4.5rem auto;
  padding: 0 var(--edge);
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.4rem, 3.4vw, 2.1rem);
  line-height: 1.4;
  color: var(--text);
  text-align: center;
}
.pullquote span { color: var(--accent-rust); }

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--line);
  padding: 3rem var(--edge) 4rem;
  max-width: 68rem;
  margin: 0 auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
}
footer .colophon { max-width: 30rem; color: var(--text-muted); }
footer a { color: var(--accent-fjord); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ---------- back to top ---------- */
.to-top {
  position: fixed;
  right: 1.4rem;
  bottom: 1.4rem;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  color: var(--accent-fjord);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 40;
}
.to-top.visible { opacity: 1; pointer-events: auto; }
.to-top:hover { border-color: var(--accent-fjord); }
