/* ============================================================
   layout.css — page scaffolding: frame, header, sections,
   hero, logbook grid, route timeline, modules grid, contact,
   footer. Component skins live in components.css.
   ============================================================ */

.wrap {
  width: min(1180px, 92vw);
  margin-inline: auto;
}

/* ------------------------------------------------------------
   GRATICULE FRAME — fixed rulers + corner readouts
   ------------------------------------------------------------ */
.frame { position: fixed; inset: 0; pointer-events: none; z-index: 40; }

.frame__ruler {
  position: absolute;
  background-image: repeating-linear-gradient(
    to right,
    var(--line-strong) 0 1px,
    transparent 1px 24px
  );
  opacity: .35;
}
.frame__ruler--top  { top: 0; left: 0; right: 0; height: 7px;
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent);
          mask-image: linear-gradient(to bottom, #000 40%, transparent); }
.frame__ruler--left { top: 0; left: 0; bottom: 0; width: 7px;
  background-image: repeating-linear-gradient(
    to bottom, var(--line-strong) 0 1px, transparent 1px 24px);
  -webkit-mask-image: linear-gradient(to right, #000 40%, transparent);
          mask-image: linear-gradient(to right, #000 40%, transparent); }

.frame__cell {
  position: absolute;
  font-family: var(--font-mono);
  font-size: .6rem;
  letter-spacing: .14em;
  color: var(--ink-2);
  white-space: nowrap;
}
.frame__cell--tl { top: 14px; left: 18px; }
.frame__cell--tr { top: 14px; right: 18px; font-variant-numeric: tabular-nums; }
.frame__cell--bl { bottom: 14px; left: 18px; }
.frame__cell--br { bottom: 14px; right: 18px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------
   HEADER
   ------------------------------------------------------------ */
.site-head {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  transition: background-color .3s var(--ease-out),
              box-shadow   .3s var(--ease-out);
}
.site-head.is-scrolled {
  background: var(--head-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 var(--line-strong);
}

/* THE TRAIL — scroll progress burned into the header's bottom
   edge, like the route rail filling as you travel the chart.
   --sx is set every frame by js/motion.js (0 → 1). */
.site-head__trail {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-ink));
  transform: scaleX(var(--sx, 0));
  transform-origin: left;
  pointer-events: none;
  z-index: 2;
}
/* Glowing pin head riding the tip of the trail */
.site-head__trail::after {
  content: "";
  position: absolute;
  right: -3px; top: 50%;
  width: 8px; height: 8px;
  translate: 0 -50%;
  rotate: 45deg;
  border-radius: 1px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  opacity: 0;
  transition: opacity .4s var(--ease-out);
}
.site-head__trail.is-live::after { opacity: 1; }

.site-head__bar {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 26px);
  padding-block: 12px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand__mark { width: 30px; height: 30px; transition: transform .5s var(--ease-io); }
.brand:hover .brand__mark { transform: rotate(120deg); }
.brand__text {
  font-family: var(--font-mono);
  font-size: .82rem;
  letter-spacing: .12em;
}
.brand__text b { color: var(--accent-ink); font-weight: 600; }

.primary-nav {
  /* centered between brand and the right-hand controls */
  margin-inline: auto;
  min-width: 0;
  position: relative;
}
.primary-nav ol {
  display: flex;
  gap: clamp(10px, 1.6vw, 24px);
}
.primary-nav a {
  display: inline-block;
  padding: 8px 2px;
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-2);
  white-space: nowrap;
  border-bottom: 1.5px solid transparent;
  transition: color .25s var(--ease-out), border-color .25s var(--ease-out),
              translate .25s var(--ease-out);
}
.primary-nav a sup {
  color: var(--accent-ink);
  margin-right: .45em;
  font-size: .85em;
}
.primary-nav a:hover,
.primary-nav a[aria-current="true"] {
  color: var(--ink);
  translate: 0 -1px;
  border-bottom-color: var(--accent);
}

/* THE TRAVELLING PIN — a tiny map pin that glides beneath the
   nav to whichever section you're hovering or reading. The
   header becomes a mini map of the page. Positioned by JS. */
.nav-pin {
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 9px; height: 9px;
  border-radius: 50% 50% 50% 0;
  rotate: -45deg;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 12px rgba(232, 80, 26, .6);
  opacity: 0;
  transition: transform .5s var(--ease-io), opacity .35s var(--ease-out);
  pointer-events: none;
}
.nav-pin.is-on { opacity: 1; }
@media (max-width: 860px) { .nav-pin { display: none; } }

/* Dark mode toggle — moon icon pill */
.theme-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  line-height: 1;
  padding: 10px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-2);
  transition: color .2s var(--ease-out), border-color .2s var(--ease-out),
              background-color .2s var(--ease-out);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink); }
.theme-toggle[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.theme-toggle__icon { width: 14px; height: 14px; }

.site-head__side {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
}
.site-head__status {
  font-family: var(--font-mono);
  font-size: .62rem;
  letter-spacing: .14em;
  white-space: nowrap;
}

/* Hamburger — mobile only */
.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  margin-left: auto;
  position: relative;
  z-index: 70;
}
.nav-toggle span {
  position: absolute;
  left: 10px; right: 10px;
  height: 2px;
  background: var(--ink);
  transition: transform .35s var(--ease-io), top .35s var(--ease-io);
}
.nav-toggle span:nth-child(1) { top: 17px; }
.nav-toggle span:nth-child(2) { top: 26px; }
body.menu-open .nav-toggle span:nth-child(1) { top: 21px; transform: rotate(45deg); }
body.menu-open .nav-toggle span:nth-child(2) { top: 21px; transform: rotate(-45deg); }

/* ------------------------------------------------------------
   SECTION SCAFFOLDING + LEGEND HEADERS
   ------------------------------------------------------------ */
.section { padding-block: clamp(88px, 13vh, 150px); }
/* Anchored navigation lands below the fixed header */
.section[id], .hero[id] { scroll-margin-top: 86px; }
.section--tint { background: var(--paper-2); box-shadow: inset 0 1.5px 0 var(--line-strong), inset 0 -1.5px 0 var(--line-strong); }

.legend {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
  margin-bottom: clamp(40px, 6vh, 64px);
  border-bottom: 1.5px solid var(--line-strong);
}
.legend__no { color: var(--accent-ink); margin-bottom: 10px; }
.legend__title { font-family: var(--font-display); font-size: var(--fs-title); }
.legend__meta { text-align: right; color: var(--ink-2); line-height: 1.9; }

/* Ink variant for the contact band */
.section--ink { background: var(--tile); color: var(--tile-text); }
.section--ink .legend { border-bottom-color: var(--tile-line); }
.section--ink .legend__no { color: var(--accent); }
.section--ink .legend__meta { color: var(--tile-ink-2); }

/* ------------------------------------------------------------
   HERO — ORIGIN POINT
   ------------------------------------------------------------ */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding-top: 110px;
  padding-bottom: 90px;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  align-items: center;
  gap: clamp(32px, 5vw, 72px);
}

.hero__eyebrow { color: var(--accent-ink); margin-bottom: 22px; min-height: 1.2em; }
.hero__eyebrow::after {
  content: "▌";
  margin-left: 2px;
  animation: caret-blink 1s steps(1) infinite;
  color: var(--accent);
}

.hero__name {
  font-family: var(--font-display);
  font-size: var(--fs-hero);
  line-height: .96;
  letter-spacing: -.015em;
  margin-left: -.04em;
  margin-bottom: 26px;
}
.hero__name-line { display: block; }
.hero__name-line--ghost {
  font-style: italic;
  font-weight: 450;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--ink);
  paint-order: stroke;
}

.hero__role {
  max-width: 46ch;
  font-size: var(--fs-role);
  color: var(--ink-2);
  margin-bottom: 34px;
}
.hero__role strong { color: var(--ink); font-weight: 600; }

.hero__stats {
  display: grid;
  grid-template-columns: repeat(4, auto);
  justify-content: start;
  gap: clamp(20px, 3.4vw, 44px);
  padding: 18px 0;
  margin-bottom: 36px;
  border-top: 1.5px solid var(--line-strong);
  border-bottom: 1.5px solid var(--line-strong);
}
.stat__num {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  font-weight: 650;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat--accent .stat__num { color: var(--accent-ink); }
.stat__label {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: .62rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.hero__cta { display: flex; flex-wrap: wrap; gap: 14px; }

/* Scroll cue pinned to the bottom of the hero */
.hero__cue {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink-2);
}
.hero__cue-line {
  width: 1.5px;
  height: 52px;
  background: linear-gradient(var(--accent) 50%, transparent 50%);
  background-size: 100% 200%;
  animation: cue-drip 1.6s var(--ease-io) infinite;
}

/* Portrait inset */
.portrait {
  position: relative;
  width: min(400px, 100%);
  margin-inline: auto;
  rotate: 1.6deg;
}
.portrait__rings {
  position: absolute;
  inset: -34% -30%;
  z-index: -1;
  color: var(--line-strong);
  opacity: .5;
}
.portrait__rings circle { fill: none; stroke: currentColor; stroke-width: 1; stroke-dasharray: 3 6; }
.portrait__rings line   { stroke: currentColor; stroke-width: 1; stroke-dasharray: 10 8; }

.portrait__frame {
  position: relative;
  border: 1.5px solid var(--ink);
  background: var(--tile);
  box-shadow: 12px 12px 0 var(--accent-soft);
  overflow: hidden;
}
.portrait__img {
  aspect-ratio: 4 / 5;
  width: 100%;
  object-fit: cover;
  /* Duotone: warm-orange highlights over deep ink shadows */
  filter: grayscale(1) sepia(.55) hue-rotate(-18deg) saturate(2.4) contrast(1.06) brightness(.97);
}
/* Vignette + warm wash so the photo sits INSIDE the chart's world */
.portrait__frame::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 90% at 50% 30%, transparent 55%, rgba(13, 11, 8, .78) 100%),
    linear-gradient(160deg, rgba(232, 80, 26, .28), rgba(232, 80, 26, 0) 55%);
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* Viewfinder brackets */
.portrait__bracket { position: absolute; width: 18px; height: 18px; z-index: 2; }
.portrait__bracket::before,
.portrait__bracket::after { content: ""; position: absolute; background: var(--accent); }
.portrait__bracket::before { width: 100%; height: 2.5px; }
.portrait__bracket::after  { width: 2.5px; height: 100%; }
.portrait__bracket--tl { top: -7px; left: -7px; }
.portrait__bracket--tr { top: -7px; right: -7px; } .portrait__bracket--tr::before { right: 0; } .portrait__bracket--tr::after { right: 0; }
.portrait__bracket--bl { bottom: -7px; left: -7px; } .portrait__bracket--bl::before { bottom: 0; }
.portrait__bracket--br { bottom: -7px; right: -7px; } .portrait__bracket--br::before { right: 0; bottom: 0; } .portrait__bracket--br::after { right: 0; }

.portrait__missing { display: none; }

.portrait__caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 16px;
  margin-top: 12px;
  color: var(--ink-2);
}
/* Whole labels wrap as units — never mid-text breaks */
.portrait__caption span {
  white-space: nowrap;
  font-size: .56rem;
  letter-spacing: .1em;
}
.portrait__caption .u-accent { color: var(--accent-ink); }

/* ------------------------------------------------------------
   MARQUEE RIBBON
   ------------------------------------------------------------ */
.marquee {
  overflow: hidden;
  background: var(--accent);
  color: var(--tile);
  border-block: 1.5px solid var(--ink);
}
.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee-scroll 36s linear infinite;
}
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__group {
  display: flex;
  align-items: center;
  gap: 34px;
  padding: 13px 17px;
  font-family: var(--font-mono);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .18em;
  white-space: nowrap;
}
.marquee__group span { display: inline-flex; align-items: center; gap: 34px; }
.marquee__group span::after {
  content: "";
  width: 9px; height: 9px;
  background: var(--tile);
  rotate: 45deg;
  margin-left: 34px;
}

/* ------------------------------------------------------------
   LOGBOOK
   ------------------------------------------------------------ */
.logbook {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
}

.logbook__notes {
  display: grid;
  gap: 28px;
}
.fieldnote {
  border-left: 2px solid var(--line-strong);
  padding-left: 22px;
  max-width: 60ch;
}
.fieldnote__head { color: var(--accent-ink); margin-bottom: 10px; }
.fieldnote p { color: var(--ink-2); max-width: 58ch; }
.fieldnote strong { color: var(--ink); }
.fieldnote--principles ul { display: grid; gap: 6px; color: var(--ink-2); }
.fieldnote--principles li::before { content: "— "; color: var(--accent-ink); }

.logbook__facts {
  border: 1.5px solid var(--ink);
  background: var(--paper);
  padding: 26px 26px 12px;
  box-shadow: 8px 8px 0 var(--accent-soft);
  position: sticky;
  top: 110px;
}
.logbook__facts-title { color: var(--accent-ink); margin-bottom: 18px; }

.facts__row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  padding-block: 14px;
  border-top: 1px solid var(--line);
}
.facts dt { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .14em; color: var(--ink-2); padding-top: 3px; }
.facts dd { font-size: .92rem; line-height: 1.5; }
.facts dd em { color: var(--ink-2); font-style: italic; }
.facts__sub { display: block; font-size: .78rem; color: var(--ink-2); }
.facts__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--accent-ink);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
.facts__link svg { width: 12px; height: 12px; }

/* ------------------------------------------------------------
   ROUTE — ELEVATION TRAIL
   Mobile-first: classic vertical rail. ≥901px: the trail becomes
   a winding SVG path across stylized terrain; a pin travels it
   with scroll and waypoint cards flare alive as they're reached.
   ------------------------------------------------------------ */
.route { position: relative; }

.route__list {
  position: relative;
  display: grid;
  gap: clamp(48px, 8vh, 84px);
}

/* Rail (mobile fallback) */
.route__rail {
  position: absolute;
  top: 8px; bottom: 8px;
  left: 19px;
  width: 2px;
}
.route__track { position: absolute; inset: 0; border-left: 2px dashed var(--line-strong); opacity: .5; }
.route__fill {
  position: absolute; top: 0; left: -1px;
  width: 2px; height: 0%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(232, 80, 26, .55);
}
.route__runner {
  position: absolute; left: 50%;
  bottom: 0%;
  width: 13px; height: 13px;
  translate: -50% 50%;
  background: var(--accent);
  border-radius: 50% 50% 50% 0;
  rotate: -45deg;
  box-shadow: 0 0 0 5px var(--accent-soft);
  opacity: 0;
  transition: opacity .3s var(--ease-out);
}
.route.is-moving .route__runner { opacity: 1; }

/* Waypoint card (shared by both modes) */
.waypoint { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: start; }
.waypoint__node {
  grid-column: 1;
  grid-row: 1 / span 2;
  position: relative;
  height: 100%;
}
.waypoint__card { grid-column: 2; }
.waypoint__dot {
  position: sticky;
  top: 50vh;
  display: block;
  width: 15px; height: 15px;
  margin-inline: auto;
  border-radius: 50%;
  background: var(--paper-2);
  border: 2.5px solid var(--ink);
  translate: 0 -50%;
  transition: background-color .3s var(--ease-out), scale .3s var(--ease-out),
              box-shadow .3s var(--ease-out);
}
.waypoint.is-active .waypoint__dot {
  background: var(--accent);
  scale: 1.25;
  box-shadow: 0 0 0 6px var(--accent-soft);
}

.waypoint__card {
  border: 1.5px solid var(--ink);
  background: var(--paper);
  padding: clamp(20px, 3vw, 30px);
  box-shadow: 7px 7px 0 var(--card-shadow);
}
.waypoint__era {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 14px;
  color: var(--ink-2);
  margin-bottom: 14px;
}
.waypoint__kicker { color: var(--accent-ink); font-weight: 600; }
.waypoint__role { font-family: var(--font-display); font-size: clamp(1.25rem, 2.2vw, 1.65rem); margin-bottom: 6px; }
.waypoint__org { color: var(--accent-ink); margin-bottom: 14px; }
.waypoint__points { display: grid; gap: 7px; color: var(--ink-2); font-size: .95rem; }
.waypoint__points li { padding-left: 20px; position: relative; }
.waypoint__points li::before { content: "▸"; position: absolute; left: 0; color: var(--accent-ink); }

/* --- TERRAIN MODE (desktop) -------------------------------- */
@media (min-width: 901px) {
  .route--terrain { height: clamp(1250px, 185vh, 1700px); }

  /* Faint contour rings drifting behind the trail */
  .route__scenery { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
  .route__contour {
    position: absolute;
    border: 1.5px dashed var(--line-strong);
    border-radius: 50%;
    opacity: .28;
  }
  .route__contour--a { width: 340px; height: 200px; top: 8%;  right: 4%; rotate: -12deg; }
  .route__contour--b { width: 260px; height: 150px; top: 44%; left: 2%;  rotate: 9deg; }
  .route__contour--c { width: 380px; height: 220px; bottom: 5%; right: 10%; rotate: -7deg; }
  .route__contour::after {
    content: "";
    position: absolute; inset: 18px 30px;
    border: 1px dashed var(--line);
    border-radius: 50%;
  }

  .route__rail,
  .waypoint__node { display: none; }

  .route__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
  .route__ring {
    fill: none;
    stroke: var(--line-strong);
    stroke-dasharray: 2 7;
    opacity: .35;
    vector-effect: non-scaling-stroke;
  }
  .route__trackpath {
    fill: none;
    stroke: var(--line-strong);
    stroke-width: 1.6;
    stroke-dasharray: 5 8;
    vector-effect: non-scaling-stroke;
  }
  .route__drawpath {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.4;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 0 7px rgba(232, 80, 26, .5));
  }

  /* The travelling pin */
  .route__marker {
    position: absolute;
    z-index: 3;
    width: 32px; height: 32px;
    margin: -16px 0 0 -16px;
    color: var(--accent);
    opacity: 0;
    transition: opacity .35s var(--ease-out);
    pointer-events: none;
  }
  .route--terrain.is-moving .route__marker { opacity: 1; }
  .route__marker svg { width: 100%; height: 100%; fill: currentColor; filter: drop-shadow(0 4px 5px rgba(20, 17, 12, .45)); }
  .route__marker-pulse {
    position: absolute; inset: -8px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    animation: marker-pulse 1.9s ease-out infinite;
  }

  .route__list { display: block; height: 100%; }

  /* Stops anchor exactly on their trail coordinates (set inline by JS) */
  .route__stop { position: absolute; width: 0; z-index: 2; }

  .route__flag {
    position: absolute;
    left: 0; top: 0;
    width: 13px; height: 13px;
    translate: -50% -50%;
    rotate: 45deg;
    background: var(--paper-2);
    border: 2px solid var(--ink);
    z-index: 2;
    transition: background-color .35s var(--ease-out), box-shadow .35s var(--ease-out), scale .35s var(--ease-out);
  }
  .route__stop.is-active .route__flag {
    background: var(--accent);
    scale: 1.2;
    box-shadow: 0 0 0 6px var(--accent-soft);
  }

  /* Dashed leader connecting flag ↔ card */
  .route__stop::before {
    content: "";
    position: absolute;
    left: -1px;
    width: 2px;
    height: 22px;
    border-left: 2px dashed var(--line-strong);
  }
  .route__stop:nth-child(odd)::before  { bottom: 9px; }
  .route__stop:nth-child(even)::before { top: 9px; }

  /* Cards hover above/below their node, alternating */
  .route__stop .waypoint__card {
    position: absolute;
    left: 50%;
    width: min(360px, 38vw);
    transform: translateX(-50%) translateY(10px);
    opacity: .13;
    filter: saturate(.35);
    transition: opacity .5s var(--ease-out), transform .5s var(--ease-out),
                filter .5s var(--ease-out);
  }
  .route__stop:nth-child(odd) .waypoint__card  { bottom: 40px; }
  .route__stop:nth-child(even) .waypoint__card { top: 40px; }

  /* Trail ends flip inward so edge cards stay inside the section */
  .route__stop:first-child .waypoint__card { top: 44px; bottom: auto; }
  .route__stop:first-child::before { top: 9px; bottom: auto; }
  .route__stop:last-child .waypoint__card { bottom: 44px; top: auto; }
  .route__stop:last-child::before { bottom: 9px; top: auto; }

  .route__stop.is-active .waypoint__card {
    opacity: 1;
    transform: translateX(-50%);
    filter: none;
  }
}

/* ------------------------------------------------------------
   LOADOUT (skills)
   ------------------------------------------------------------ */
.loadout__intro { max-width: 56ch; color: var(--ink-2); margin: -18px 0 42px; }

.modules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 22px;
}

/* ------------------------------------------------------------
   PINS (projects) — card grid lives in components.css;
   the toolbar and archive link live here.
   ------------------------------------------------------------ */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-bottom: 34px;
}
.filters__count {
  margin-left: auto;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}

.pins__more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 46px;
  padding-top: 30px;
  border-top: 1.5px solid var(--line-strong);
}
.pins__more p { color: var(--ink-2); }

/* ------------------------------------------------------------
   CONTACT (dark band)
   ------------------------------------------------------------ */
.contact__lede {
  max-width: 54ch;
  font-size: clamp(1.05rem, 1.7vw, 1.3rem);
  color: var(--tile-text);
  margin: -20px 0 48px;
}

.contact__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
}

.contact__channels { display: grid; gap: 14px; }

.compose {
  border: 1.5px solid var(--tile-line);
  background: rgba(239, 233, 219, .03);
  padding: 28px;
}
.compose__title { color: var(--accent); margin-bottom: 22px; }
.compose__field { display: grid; gap: 8px; margin-bottom: 20px; }
.compose__field > span { color: var(--tile-ink-2); }
.compose__field input,
.compose__field textarea {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1.5px solid var(--tile-line);
  padding: 8px 2px;
  color: var(--tile-text);
  resize: vertical;
  transition: border-color .25s var(--ease-out);
}
.compose__field :is(input, textarea):focus-visible {
  outline: none;
  border-bottom-color: var(--accent);
}
.compose__field ::placeholder { color: rgba(167, 156, 135, .55); }
.compose__note { margin-top: 18px; color: var(--tile-ink-2); line-height: 1.8; letter-spacing: .06em; }

/* ------------------------------------------------------------
   FOOTER
   ------------------------------------------------------------ */
.site-foot {
  background: var(--tile-2);
  color: var(--tile-text);
  padding: clamp(70px, 10vh, 110px) 0 34px;
}

.site-foot__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding-bottom: 44px;
  border-bottom: 1px solid var(--tile-line);
}
.site-foot__big {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(2rem, 6vw, 4.4rem);
  color: transparent;
  -webkit-text-stroke: 1.2px var(--tile-text);
}

.totop {
  flex: none;
  width: 64px; height: 64px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--tile-line);
  border-radius: 50%;
  color: var(--tile-text);
  transition: background-color .3s var(--ease-out), color .3s var(--ease-out), rotate .5s var(--ease-io);
}
.totop svg { width: 22px; height: 22px; }
.totop:hover { background: var(--accent); border-color: var(--accent); rotate: -12deg; }

.site-foot__cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 30px;
  padding-block: 40px;
}
.site-foot__cols h4 { color: var(--accent); font-family: var(--font-mono); font-size: .68rem; letter-spacing: .16em; margin-bottom: 10px; }
.site-foot__cols p { color: var(--tile-ink-2); font-size: .78rem; line-height: 1.9; letter-spacing: .05em; }
.site-foot__cols a { color: var(--tile-text); text-underline-offset: 3px; }
.site-foot__cols a:hover { color: var(--accent); }

.site-foot__base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 22px;
  border-top: 1px solid var(--tile-line);
  color: var(--tile-ink-2);
  font-size: .64rem;
}

.secret-pin {
  width: 30px; height: 30px;
  display: inline-grid;
  place-items: center;
  color: var(--tile-ink-2);
  opacity: .4;
  transition: opacity .3s, transform .3s var(--ease-io), color .3s;
}
.secret-pin svg { width: 14px; height: 14px; }
.secret-pin:hover { opacity: 1; color: var(--accent); animation: pin-wiggle .5s var(--ease-io); }
.secret-pin.is-found { opacity: 1; color: var(--accent); }

/* ------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------ */
@media (max-width: 1280px) {
  .site-head__status { display: none; }
  .site-head__side { padding: 8px 9px; }
}

@media (max-width: 1180px) {
  /* Compact legend type so all six entries stay comfortable */
  .primary-nav a { font-size: .63rem; letter-spacing: .05em; }
  .primary-nav ol { gap: clamp(8px, 1.2vw, 16px); }
}

@media (max-width: 1120px) {
  .site-head__side { display: none; }
}

@media (max-width: 960px) {
  .hero__grid { grid-template-columns: 1fr; }
  .portrait { width: min(340px, 80%); order: -1; rotate: 0deg; }
  .hero { padding-top: 130px; }
  .hero__stats { grid-template-columns: repeat(2, auto); gap: 18px 40px; }

  .logbook { grid-template-columns: 1fr; }
  .logbook__facts { position: static; }

  .contact__grid { grid-template-columns: 1fr; }

  /* Terrain mode is desktop-only; base rail styles take over.
     (The frame is re-styled into a mini HUD by mobile.css.) */
  .route__svg,
  .route__scenery,
  .route__marker,
  .route__flag { display: none; }
}

@media (max-width: 860px) {
  /* Nav becomes a full-screen paper panel */
  .primary-nav {
    position: fixed;
    inset: 0;
    z-index: 65;
    display: grid;
    place-content: center;
    background: var(--paper);
    opacity: 0;
    visibility: hidden;
    transition: opacity .35s var(--ease-out), visibility .35s;
  }
  body.menu-open .primary-nav { opacity: 1; visibility: visible; }
  body.menu-open { overflow: hidden; }
  .primary-nav ol { flex-direction: column; gap: 8px; text-align: center; }
  .primary-nav a { font-size: 1.05rem; padding: 12px 20px; white-space: normal; }
  .primary-nav a sup { display: block; margin: 0 0 4px; }

  /* brand left, everything else pushed right */
  .primary-nav { margin-inline: 0; }
  .nav-toggle { margin-left: auto; }
  .nav-toggle { display: block; }
}

@media (max-width: 560px) {
  .legend { flex-direction: column; align-items: flex-start; gap: 10px; }
  .legend__meta { text-align: left; }
  .hero__cta .btn { width: 100%; justify-content: center; }
  .pin__coord { display: none; }
  .filters__count { width: 100%; margin-left: 0; }
}
