/* ── tokens ─────────────────────────────────────────────────────────── */
:root {
  --ink: #f0f1e8;
  --ink-2: #c9cfbe;
  --ink-3: #959e8c;
  --lichen: #e4ab45;   /* the orange lichen on Skellig's stones */
  --moss: #bcd46a;
  --glacier: #a6d8d0;
  --night: 13 18 14;   /* rgb triplet for scrims */
  --basalt: #1b221d;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --gutter: clamp(20px, 7vw, 120px);
  --measure: 34rem;
}

* { box-sizing: border-box; }
html { background: var(--basalt); color: var(--ink); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 1.1rem/1.62 var(--serif);
  font-optical-sizing: auto;
  background: radial-gradient(120% 80% at 70% 0%, #3a463c 0%, var(--basalt) 60%) fixed;
  overflow-x: hidden;
}
.mono { font-family: var(--mono); }
a { color: var(--ink); text-decoration-color: var(--lichen); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--lichen); }
:focus-visible { outline: 2px solid var(--lichen); outline-offset: 3px; }

/* ── the canvas and things pinned to it ─────────────────────────────── */
#land {
  position: fixed; inset: 0; width: 100vw; height: 100vh; display: block;
  opacity: 0; transition: opacity 2.2s ease;
}
#land.on { opacity: 1; }
#marks { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.mark { position: absolute; left: 0; top: 0; opacity: 0; will-change: transform, opacity; }
.mark::before { /* the pole from the cairn up to its label */
  content: ""; position: absolute; left: -0.5px; bottom: 0; width: 1px; height: 46px;
  background: linear-gradient(to top, rgb(240 241 232 / 0.9), rgb(240 241 232 / 0));
}
.mark::after { content: ""; position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.mark-t {
  position: absolute; left: -1px; bottom: 50px; white-space: nowrap;
  font: 500 11px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink); text-shadow: 0 1px 6px rgb(0 0 0 / 0.55);
  padding-left: 8px; border-left: 1px solid rgb(240 241 232 / 0.6);
}
.mark-t b { color: var(--lichen); font-weight: 500; margin-right: 0.6em; }
.mark.on::after { background: var(--lichen); box-shadow: 0 0 0 4px rgb(228 171 69 / 0.25); }

.brand, .hud { background: rgb(var(--night) / 0.42); padding: 5px 8px; border-radius: 2px; }
.brand {
  position: fixed; top: 14px; left: calc(var(--gutter) - 8px); z-index: 6;
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none; color: var(--ink);
}
/* link to the other version of the homepage (/ serves the shark one) */
.swap {
  position: fixed; bottom: 14px; left: calc(var(--gutter) - 8px); z-index: 6;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none; color: var(--ink);
  background: rgb(var(--night) / 0.6); padding: 6px 9px; border-radius: 2px; border: 1px solid rgb(240 241 232 / 0.25);
  transition: color 0.2s, border-color 0.2s;
}
.swap:hover, .swap:focus-visible { color: var(--lichen); border-color: var(--lichen); }
.hud {
  position: fixed; right: 18px; top: 14px; z-index: 6; white-space: pre;
  font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2);
  opacity: 0; transition: opacity 1s;
}
.land-ready .hud { opacity: 0.85; }

/* ── trail map (progressive enhancement of page.js's nav list) ──────── */
#trailmap { position: fixed; z-index: 6; }
.tm-list { list-style: none; margin: 0; padding: 0; }
.land #trailmap { right: 18px; top: 50%; transform: translateY(-50%); height: min(70vh, 600px); width: 92px; }
.land #trailmap svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tm-contour { fill: none; stroke: rgb(240 241 232 / 0.13); stroke-width: 1; }
.tm-river { fill: none; stroke: var(--glacier); stroke-width: 1.6; opacity: 0.85; }
.tm-here { fill: var(--lichen); stroke: rgb(var(--night)); stroke-width: 1.5; }
.land .tm-list a { position: absolute; display: block; width: 18px; height: 18px; margin: -9px 0 0 -9px; text-decoration: none; }
.tm-dot { position: absolute; left: 5px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: rgb(var(--night)); border: 1.5px solid var(--ink-2); transition: transform 0.2s, background 0.2s; }
.land .tm-label {
  position: absolute; right: 24px; top: 50%; transform: translate(6px, -50%); white-space: nowrap;
  font: 500 10.5px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink);
  background: rgb(var(--night) / 0.75); padding: 5px 7px; border-radius: 2px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.tm-label b { color: var(--lichen); font-weight: 500; }
.land .tm-list a:hover .tm-label, .land .tm-list a:focus-visible .tm-label, .land .tm-list a.on .tm-label { opacity: 1; transform: translate(0, -50%); }
.tm-list a:hover .tm-dot, .tm-list a.on .tm-dot { background: var(--lichen); border-color: var(--lichen); transform: scale(1.25); }

/* ── the readable trail ─────────────────────────────────────────────── */
main { position: relative; z-index: 2; }
.stop { position: relative; min-height: 100vh; display: flex; align-items: center; padding: 14vh 0; }
.land .stop + .stop { margin-top: 70vh; }  /* the empty stretch is where the camera travels */
.stop-hero { align-items: flex-end; padding-bottom: 16vh; }

.note { position: relative; margin-left: var(--gutter); width: min(var(--measure), calc(100vw - var(--gutter) - 130px)); }
.land .note::before { /* a band of shade from the left edge that travels with the text */
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  top: -32vh; bottom: -32vh; left: calc(-1 * var(--gutter)); width: calc(100% + var(--gutter) + 24vw);
  background: linear-gradient(90deg, rgb(var(--night) / 0.68) 0%, rgb(var(--night) / 0.52) 50%, rgb(var(--night) / 0) 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 32vh, #000 calc(100% - 32vh), transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 32vh, #000 calc(100% - 32vh), transparent);
}
.note > * { margin: 0; }
.note > * + * { margin-top: 1rem; }
.note p, .note dd, .note li { text-shadow: 0 1px 10px rgb(0 0 0 / 0.3); }

.chapter { display: flex; align-items: baseline; gap: 0.9rem; margin-bottom: 1.6rem !important; }
.chapter .local { font: italic 300 clamp(2.4rem, 5vw, 3.6rem)/1 var(--serif); color: var(--moss); letter-spacing: -0.01em; }
.chapter .mono { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); }

.kicker { font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
.kicker .n { color: var(--lichen); margin-right: 0.9em; }
h1 {
  font: 300 clamp(3.4rem, 9vw, 7.4rem)/0.92 var(--serif); letter-spacing: -0.025em;
  margin-top: 0.6rem !important; text-shadow: 0 2px 30px rgb(0 0 0 / 0.35);
}
h2 { font: 400 clamp(1.9rem, 3.4vw, 2.6rem)/1.08 var(--serif); letter-spacing: -0.015em; margin-top: 0.5rem !important; }
.lede { font-size: 1.28rem; line-height: 1.5; color: var(--ink); }
.stop-hero .lede { max-width: 31rem; margin-top: 1.4rem !important; }
.note p { color: #e3e6da; }
.note em { font-style: italic; }

.meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1.1rem; font-size: 12px; line-height: 1.5; color: var(--ink-2); padding: 0.8rem 0; border-top: 1px solid rgb(240 241 232 / 0.18); border-bottom: 1px solid rgb(240 241 232 / 0.18); }
.meta dt { text-transform: uppercase; letter-spacing: 0.12em; font-size: 10.5px; color: var(--ink-3); padding-top: 0.12em; }
.meta dd { margin: 0; }

.hint { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); margin-top: 2.4rem !important; }
.hint span { display: inline-block; animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(4px); } }

.links { font-size: 13px; letter-spacing: 0.06em; }
.foot { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin-top: 2.4rem !important; }

/* figures */
figure { margin: 1.6rem 0 0; }
.plate img { display: block; width: 100%; height: auto; border: 1px solid rgb(240 241 232 / 0.22); }
figcaption { font-size: 11px; line-height: 1.5; color: var(--ink-2); margin-top: 0.55rem; letter-spacing: 0.02em; }
figcaption b { color: var(--lichen); font-weight: 500; margin-right: 0.5em; }
.trace svg { display: block; width: 100%; height: 70px; cursor: crosshair; overflow: visible; }
.trace .line { fill: none; stroke: var(--glacier); stroke-width: 1; vector-effect: non-scaling-stroke; }
.trace .zero { stroke: rgb(240 241 232 / 0.2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.trace .cursor { stroke: var(--lichen); stroke-width: 1; vector-effect: non-scaling-stroke; }
.trace figcaption { display: flex; justify-content: space-between; gap: 1rem; }
.trace output { color: var(--lichen); }

/* smaller projects */
.small { list-style: none; padding: 0; }
.small li { display: grid; grid-template-columns: 1fr max-content; gap: 0.15rem 1rem; padding: 0.85rem 0; border-top: 1px solid rgb(240 241 232 / 0.16); }
.small .what { font-weight: 500; }
.small .text { grid-column: 1 / -1; color: #dcdfd3; font-size: 1rem; line-height: 1.5; }
.small .yr { grid-row: 1; grid-column: 2; font-size: 11px; color: var(--ink-3); align-self: center; }

/* ── flat mode: the same page with the landscape switched off ───────── */
.flat #land, .flat #marks, .flat .hud { display: none; }
.flat body { background: linear-gradient(180deg, #2b352d 0%, #1e2620 40%, #1b221d 100%); }
.flat .stop { min-height: auto; padding: 4rem 0 2rem; }
.flat .stop-hero { min-height: 80vh; }
.flat #trailmap { top: 16px; right: var(--gutter); }
.flat .tm-list { display: flex; gap: 1rem; }
.tm-chapter { display: none; }
.flat .tm-list li:not(.tm-chapter-start) { display: none; }
.flat .tm-list a { text-decoration: none; font: 11px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.flat .tm-dot, .flat .tm-label { display: none; }
.flat .tm-chapter { display: inline; }
.flat .note { width: min(40rem, calc(100vw - 2 * var(--gutter))); }

.noscript { max-width: 34rem; margin: 30vh auto; padding: 0 20px; }

/* ── small screens ──────────────────────────────────────────────────── */
@media (max-width: 760px) {
  body { font-size: 1.04rem; }
  .note { width: calc(100vw - var(--gutter) - 46px); }
  .land #trailmap { right: 6px; width: 40px; height: 56vh; }
  .land .tm-label, #marks { display: none; }
  .tm-contour { display: none; }
  .land .note::before { width: calc(100% + var(--gutter) + 46px); background: rgb(var(--night) / 0.6); }
  .hud { display: none; }
  .flat #trailmap { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #land { transition: none; }
  .hint span { animation: none; }
}
