/* ---------- Fonts (self-hosted, SIL OFL — see fonts/) ---------- */
@font-face { font-family: "Newsreader"; src: url("fonts/newsreader-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("fonts/newsreader-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("fonts/plus-jakarta-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("fonts/plus-jakarta-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("fonts/plus-jakarta-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  /* paper */
  --bg: #f4f1ea;
  --text: #161816;
  --text-muted: #565751;
  --text-subtle: #84827a;
  --border: #dfdad0;
  --accent: #2a5d5a;               /* petrol */
  --signal: #e09a3e;               /* map-marker ochre */

  /* hero band */
  --band: #1d4542;
  --band-text: #f4efe4;
  --band-muted: rgba(244, 239, 228, 0.72);
  --band-subtle: rgba(244, 239, 228, 0.5);
  --band-border: rgba(244, 239, 228, 0.18);
  --topo-stroke: #f4efe4;
  --topo-opacity: 0.22;
  --topo-lit-opacity: 0.9;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --shell: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111413;
    --text: #ecede8;
    --text-muted: #a5a8a1;
    --text-subtle: #737872;
    --border: #262b29;
    --accent: #7fb5ae;
    --band: #0d1d1c;
    --band-text: #ecede8;
    --topo-stroke: #7fb5ae;
    --topo-opacity: 0.3;
  }
}

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

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  display: flex;
  flex-direction: column;
}

::selection { background: var(--signal); color: #161816; }

a:focus-visible, button:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 4px; }

/* ---------- Hero band ---------- */
.band {
  position: relative;
  overflow: hidden;           /* contours bleed to the band edges, never beyond */
  background: var(--band);
  color: var(--band-text);
}

/* faint paper grain so the colour block doesn't feel flat */
.band::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

.band-inner {
  position: relative;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 2rem 2rem 0;
}

.masthead {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--band-border);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--band-subtle);
}

.masthead-domain { color: var(--band-text); text-decoration: none; font-weight: 400; }
.masthead-coords { cursor: help; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: 2rem;
  min-height: min(78svh, 720px);
  padding: 3rem 0 4.5rem;
}

.hero-content { position: relative; z-index: 2; }

.kicker {
  margin: 0 0 1.25rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--signal);
}

.profile-name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(3.4rem, 9vw, 7.25rem);
  line-height: 0.92;
  letter-spacing: -0.035em;
}

.surname { cursor: help; font-style: normal; }

.profile-role {
  margin: 1.25rem 0 0;
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--band-text);
}

.status {
  margin: 0.6rem 0 0;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--band-subtle);
}
.status[hidden] { display: none; }
.status .city { color: var(--band-muted); cursor: help; border-bottom: 1px dotted var(--band-border); }

.status-dot {
  flex-shrink: 0;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--signal);
  transform: translateY(-1px);
  animation: pulse 2.6s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(224, 154, 62, 0.45); }
  70%  { box-shadow: 0 0 0 8px rgba(224, 154, 62, 0); }
  100% { box-shadow: 0 0 0 0 rgba(224, 154, 62, 0); }
}

.about-text {
  margin: 1.75rem 0 0;
  max-width: 46ch;
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--band-muted);
}

/* ---------- Buttons ---------- */
.actions { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 0.75rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
}
.btn-primary { background: var(--band-text); color: var(--band); }
.btn-primary:hover { background: var(--signal); color: #161816; transform: translateY(-1px); }
.btn-ghost { color: var(--band-text); border: 1px solid var(--band-border); }
.btn-ghost:hover { border-color: var(--band-text); transform: translateY(-1px); }
.btn .icon { width: 1.05rem; height: 1.05rem; flex-shrink: 0; }
.btn .arrow { width: 0.9rem; height: 0.9rem; flex-shrink: 0; transition: transform 180ms ease; }
.btn:hover .arrow { transform: translate(2px, -2px); }

/* ---------- The map ---------- */
.map { position: relative; z-index: 1; }

.topo {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  /* set on the <svg> so it inherits into the <use> clone */
  fill: none;
  stroke: var(--topo-stroke);
  stroke-width: 1.4;
  stroke-linejoin: round;
  stroke-linecap: round;
}

#topo-lines { opacity: var(--topo-opacity); }
#topo-lines .topo-index { stroke-width: 2.4; }
.topo-lit { opacity: var(--topo-lit-opacity); stroke-width: 2.2; }

.topo-labels text {
  fill: var(--topo-stroke);
  stroke: var(--band);
  stroke-width: 10px;
  paint-order: stroke;
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 0.06em;
  opacity: 0.6;
}

.summit-halo { fill: none; stroke: var(--band-text); stroke-opacity: 0.25; stroke-width: 1.5; stroke-dasharray: 3 9; }
.summit-ring { fill: var(--band); stroke: var(--band-text); stroke-width: 3; }
.summit-leader { fill: none; stroke: var(--signal); stroke-width: 2; }
.summit-pin { fill: var(--signal); stroke: var(--band); stroke-width: 3; }
.summit-label {
  fill: var(--band-text);
  stroke: none;
  font-family: var(--mono);
  font-size: 24px;
  letter-spacing: 0.04em;
}
.summit-alt { fill: var(--signal); }

/* ---------- Landmarks ---------- */
.trail-path {
  fill: none;
  stroke: var(--band-text);
  stroke-width: 2;
  stroke-dasharray: 2 12;
  opacity: 0.3;
}

.agent { fill: var(--signal); stroke: none; opacity: 0.85; }

.poi {
  cursor: default;
  opacity: 0.7;
  transition: opacity 200ms ease;
  stroke: var(--band-text);
  stroke-width: 2.2;
  fill: none;
}
.poi-hit { fill: transparent; stroke: none; }
.poi-bg  { fill: var(--band); stroke: var(--band-text); stroke-width: 1.2; }
.poi-led, .poi-dot, .poi-nozzle { fill: var(--signal); stroke: none; }
.poi-layers { stroke: var(--signal); }
.poi-led.blink { animation: blink 1.4s steps(2, jump-none) infinite; }
.poi-led.blink.delay { animation-duration: 0.9s; }
@keyframes blink { 50% { opacity: 0.15; } }

.poi-label {
  fill: var(--band-text);
  stroke: var(--band);
  stroke-width: 8px;
  paint-order: stroke;
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 0.03em;
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}
.poi:hover, .poi.is-open { opacity: 1; }
.poi:hover .poi-label, .poi.is-open .poi-label { opacity: 1; }
.poi:hover .poi-bg, .poi.is-open .poi-bg { stroke: var(--signal); }

/* ---------- Paper sections ---------- */
.page {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

main.page { flex: 1; padding-top: 4.5rem; }

.section-label {
  margin: 0 0 1.5rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-subtle);
}

.legend { padding-bottom: 5rem; }

.legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.5rem;
}

.legend-list li {
  position: relative;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.legend-list li::before {
  content: "";
  position: absolute;
  top: -1px; left: 0;
  height: 2px; width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 450ms cubic-bezier(.2,.7,.2,1);
}
.legend-list li:hover::before { transform: scaleX(1); }

.legend-sym {
  width: 30px; height: 30px;
  margin-bottom: 0.9rem;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: transform 300ms cubic-bezier(.2,.7,.2,1);
}
.legend-sym .sym-accent { fill: var(--signal); stroke: none; }
.legend-list li:hover .legend-sym { transform: translateY(-3px); }

.legend-list h3 { margin: 0 0 0.4rem; font-size: 1.05rem; font-weight: 600; letter-spacing: -0.005em; }
.legend-list p { margin: 0; font-size: 0.95rem; line-height: 1.6; color: var(--text-muted); }

/* ---------- Footer ---------- */
.site-footer {
  padding-top: 1.25rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  font-size: 0.8125rem;
  color: var(--text-subtle);
}
.site-footer.page { border-top: 0; position: relative; }
.site-footer.page::before {
  content: "";
  position: absolute;
  top: 0; left: 2rem; right: 2rem;
  border-top: 1px solid var(--border);
}

.scale { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--mono); font-size: 0.7rem; }
.scale-bar { display: inline-flex; height: 6px; border: 1px solid var(--text-subtle); }
.scale-bar i { width: 14px; height: 100%; }
.scale-bar i:nth-child(odd) { background: var(--text-subtle); }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: rise 750ms cubic-bezier(.2,.7,.2,1) both; }
  .masthead     { animation-delay: 0ms; }
  .kicker       { animation-delay: 80ms; }
  .profile-name { animation-delay: 140ms; }
  .profile-role { animation-delay: 220ms; }
  .status       { animation-delay: 280ms; }
  .about-text   { animation-delay: 340ms; }
  .actions      { animation-delay: 400ms; }
  .map          { animation: fade 900ms ease 200ms both; }
  .legend       { animation-delay: 500ms; }
  .site-footer  { animation-delay: 640ms; }

  /* contour lines draw themselves in, from the summit outwards */
  #topo-lines .topo-line {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: draw 2.4s cubic-bezier(.45,.15,.2,1) forwards;
    animation-delay: calc(300ms + (16 - var(--i)) * 70ms);
  }
  .topo-labels { animation: fade 800ms ease 2.2s both; }
  .summit { animation: pop 700ms cubic-bezier(.2,1.3,.4,1) 250ms both; transform-origin: 500px 500px; }
  .summit-leader { stroke-dasharray: 320; stroke-dashoffset: 320; animation: line 600ms ease 1s forwards; }
  .summit-label  { animation: fade 500ms ease 1.5s both; }
}

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes line { to { stroke-dashoffset: 0; } }
@keyframes pop  { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }

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

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .band-inner { padding: 1.5rem 1.25rem 0; }
  .page { padding-left: 1.25rem; padding-right: 1.25rem; }
  .site-footer.page::before { left: 1.25rem; right: 1.25rem; }

  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 0;
    padding: 1rem 0 3rem;
  }
  /* map (with portrait) first, text below */
  .map { order: -1; width: min(78vw, 360px); margin: 0 auto 0.5rem; }
  .topo-labels text { font-size: 26px; }
  .summit-label { font-size: 30px; }
  .poi-label { font-size: 30px; }

  main.page { padding-top: 3rem; }
  .legend-list { grid-template-columns: 1fr; gap: 1.75rem; }
}
