:root {
  --bg: #f4f4f4;
  --fg: #111111;
  --muted: #6b6b6b;
  --faint: #bdbdbd;
  --hair: #dfdfdf;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e0e; --fg: #ededed; --muted: #8f8f8f; --faint: #3d3d3d; --hair: #222222;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e0e; --fg: #ededed; --muted: #8f8f8f; --faint: #3d3d3d; --hair: #222222;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }
html { background: var(--bg); color: var(--fg); transition: background-color .6s ease, color .6s ease; }
body { font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
main { max-width: 46rem; margin: 0 auto; padding: clamp(3.5rem, 12vh, 8rem) 1.5rem 3rem; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .22em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }
::selection { background: var(--fg); color: var(--bg); }
.mono { font-family: var(--mono); font-size: .8125rem; letter-spacing: .01em; }

/* hero */
.hero { position: relative; isolation: isolate; padding-bottom: 4.5rem; }
/* contours bleed toward the corner but always stay inside the viewport (1rem from top, 1.5rem from the right edge) */
.topo { position: absolute; z-index: -1; pointer-events: none; color: var(--faint); height: auto;
        top: calc(1rem - clamp(3.5rem, 12vh, 8rem));
        right: calc(-1 * min(10rem, max((100vw - 46rem) / 2, 0rem)));
        width: min(32rem, calc(100vw - 3rem)); }
.topo path { fill: none; stroke: currentColor; stroke-width: 1; }
.topo path.idx { stroke-width: 1.6; }
.eyebrow { margin-bottom: 1.75rem; color: var(--muted); }
@media (max-width: 560px) { .eyebrow { min-height: 3.2em; } }  /* long locations wrap to 2 lines; keep the name from jumping */
.eyebrow b { font-weight: 500; color: var(--fg); }
#loc::after { content: ""; display: inline-block; width: .55em; height: 1.05em; margin-left: 2px; vertical-align: -.18em; background: var(--fg); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
h1 { font-size: clamp(2.75rem, 9vw, 4.75rem); line-height: .98; letter-spacing: -.04em; font-weight: 700; }
.lede { font-size: clamp(1.125rem, 2.6vw, 1.375rem); line-height: 1.5; max-width: 35rem; margin-top: 1.75rem; }
.tags { margin-top: 1.5rem; color: var(--muted); }

/* sections */
section, footer { padding: 3.5rem 0; border-top: 1px solid var(--hair); }
h2 { font: 500 .8125rem/1 var(--mono); color: var(--muted); display: flex; gap: .6rem; margin-bottom: .6rem; }
h2 span { color: var(--fg); }
.kicker { color: var(--muted); margin-bottom: 2.25rem; }

/* game */
.hud, .controls { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .4rem 1rem; color: var(--muted); }
.hud { margin-bottom: .75rem; }
.hud b { color: var(--fg); font-weight: 600; }
#status { color: var(--fg); }
.board-wrap { display: flex; justify-content: center; }
#board { display: block; box-sizing: content-box; border: 1px solid var(--fg); touch-action: none; cursor: pointer; user-select: none; -webkit-user-select: none; }
.controls { margin-top: .75rem; }
.controls button { font: inherit; color: var(--fg); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .22em; }

/* locked content */
.locked .rd { color: transparent; background: var(--hair); border-radius: 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; user-select: none; }
.locked svg { opacity: .2; }
.locked .wp { border-color: var(--faint); color: var(--faint); }
.locked a { pointer-events: none; text-decoration-color: transparent; }
.locked ul li::before { color: var(--hair); }

/* elevation profile */
.profile svg { display: block; width: 100%; height: auto; overflow: visible; }
.profile figcaption { margin-top: .75rem; color: var(--muted); }
#profile .line { fill: none; stroke: var(--fg); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
#profile .area { fill: url(#hatch); }
#profile .hatch { stroke: var(--faint); stroke-width: 1; }
#profile .axis { stroke: var(--hair); }
#profile .drop { stroke: var(--faint); stroke-dasharray: 2 3; }
#profile .mk { fill: var(--bg); stroke: var(--fg); stroke-width: 1.6; transition: fill .2s ease; }
#profile .wp-mark.on .mk { fill: var(--fg); }
#profile .flag line { stroke: var(--fg); stroke-width: 1.4; }
#profile .flag path { fill: var(--fg); }
#profile text { font-family: var(--mono); font-size: 13px; fill: var(--muted); }
#profile .lbl { fill: var(--fg); font-weight: 600; }
#profile .hint { fill: var(--muted); transition: opacity .4s ease; }
#profile .off { opacity: 0; }
#profile.anim .wp-mark, #profile.anim .flag { transition: opacity .5s ease .6s; }
@media (max-width: 560px) { #profile text { font-size: 21px; } }

.waypoints { list-style: none; padding: 0; margin-top: 2.75rem; display: grid; gap: 2.25rem; }
.waypoints > li { display: grid; grid-template-columns: 2rem 1fr; gap: 1.1rem; }
.wp { width: 1.9rem; height: 1.9rem; border: 1px solid var(--fg); border-radius: 50%; display: grid; place-items: center; font: 600 .8125rem/1 var(--mono); transition: background-color .2s ease, color .2s ease; }
.waypoints > li:not(.locked):hover .wp { background: var(--fg); color: var(--bg); }
h3 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.9rem; }
.when { color: var(--muted); margin-bottom: .55rem; }
.waypoints ul { list-style: none; padding: 0; display: grid; gap: .3rem; }
.waypoints ul li { padding-left: 1.1rem; position: relative; }
.waypoints ul li::before { content: "—"; position: absolute; left: 0; color: var(--faint); }

/* pack list */
.pack { display: grid; grid-template-columns: 7rem 1fr; gap: .9rem 1.5rem; }
.pack dt { color: var(--muted); padding-top: .15rem; }

/* off the clock */
.life { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 2.5rem; }
.life svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; margin-bottom: .9rem; }
.life h3 { line-height: 1.4; margin-bottom: .35rem; }
.life p { color: var(--muted); }
#glove { cursor: default; -webkit-tap-highlight-color: transparent; }

/* footer */
.links { display: flex; flex-wrap: wrap; gap: .5rem 2rem; font-size: 1.25rem; }
.colophon { margin-top: 3rem; color: var(--muted); }
.agents { margin-top: .35rem; color: var(--muted); font-size: .6875rem; }   /* 11px: small but readable (hidden links count as spam) */

/* the bell */
.round { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0;
         font: 800 clamp(3.5rem, 15vw, 10rem)/1 var(--sans); letter-spacing: -.05em; text-transform: uppercase; color: var(--fg); }
.round.show { animation: round 1.7s cubic-bezier(.2, .8, .2, 1) forwards; }
@keyframes round { 0% { opacity: 0; transform: scale(1.3); } 14% { opacity: 1; transform: scale(1); } 70% { opacity: 1; } 100% { opacity: 0; transform: scale(.97); } }
main.hit { animation: hit .38s ease; }
@keyframes hit { 20% { transform: translateX(-7px) rotate(-.3deg); } 40% { transform: translateX(6px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

@media (prefers-reduced-motion: reduce) {
  html, .wp, #profile .mk, #profile.anim .wp-mark, #profile.anim .flag { transition: none; }
  #loc::after, main.hit { animation: none; }
  .round.show { animation: none; opacity: 1; }
}
