/* =====================================================================
   ED–VENTURE · INTERFACE LAYER
   Rule: the world is the interface. Everything here is small, quiet,
   lives at the edges, and takes its colour from the current atmosphere.
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--night-1); color: var(--atmo-fg); }
body { font-family: var(--font-display); font-size: var(--t-body); -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; touch-action: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
kbd { font-family: var(--font-mono); font-size: .9em; border: 1px solid currentColor; border-radius: 4px; padding: 0 .35em; opacity: .8; }

#world { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; }
#earth { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; opacity: 0; z-index: 4; }
#veil { position: fixed; inset: 0; background: var(--atmo-bg); opacity: 0; pointer-events: none; z-index: 5; transition: opacity var(--dur-mid) var(--ease-in-out); }
#grain { position: fixed; inset: -50%; pointer-events: none; z-index: 6; opacity: .06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* ---------- INTRO ---------- */
#intro { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; align-content: center; gap: 18px; padding: var(--edge);
  background: radial-gradient(120% 90% at 50% 60%, rgba(32,61,65,.0) 0%, rgba(16,30,39,.55) 55%, var(--night-1) 100%); color: var(--night-5); cursor: pointer; transition: opacity 1.6s var(--ease-in-out); }
#intro.out { opacity: 0; pointer-events: none; }
.intro-mark { font-family: var(--font-display); font-variation-settings: var(--wordmark-axes); font-size: var(--t-wordmark); line-height: .9; font-weight: 300; letter-spacing: -.01em; display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; width: min(1400px, 96vw); white-space: nowrap; }
.im-pre { text-align: right; opacity: .92; }
.im-ed { font-weight: 800; color: var(--jungle-5); position: relative; }
.im-post { text-align: left; font-weight: 300; }
.im-pre .l, .im-post .l { display: inline-block; transform: translateY(.3em); opacity: 0; transition: transform .7s var(--ease-out), opacity .7s var(--ease-out); }
.im-pre .l.in, .im-post .l.in { transform: none; opacity: 1; }
.im-pre .dot { color: var(--night-4); padding: 0 .04em; }
.intro-tag { margin: 0; font-style: italic; font-size: var(--t-title); color: var(--night-5); opacity: 0; transform: translateY(8px); transition: opacity 1.2s var(--ease-out), transform 1.2s var(--ease-out); }
.intro-tag.in { opacity: .9; transform: none; }
.manifesto { position: relative; height: 4.2em; width: min(760px, 92vw); text-align: center; font-size: clamp(19px, 1.7vw, 26px); line-height: 1.35; font-weight: 340; }
.manifesto p { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; opacity: 0; filter: blur(6px); transition: opacity 1.1s var(--ease-out), filter 1.1s var(--ease-out); }
.manifesto p.in { opacity: 1; filter: none; }
.manifesto em { color: var(--night-4); }
.intro-enter { display: flex; align-items: center; gap: 14px; font-family: var(--font-mono); font-size: 12px; letter-spacing: var(--track-label); text-transform: uppercase; color: var(--night-5); opacity: 0; transition: opacity 1s; }
.intro-enter.in { opacity: .85; animation: breathe var(--dur-breath) var(--ease-breath) infinite; }
.ie-line { width: 46px; height: 1px; background: currentColor; }
.intro-resume { display: flex; gap: 14px; font-family: var(--font-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--night-5); }
.intro-resume button { border-bottom: 1px solid rgba(203,219,160,.4); padding: 6px 2px; }
.intro-resume button:hover, .intro-resume button:focus-visible { color: var(--jungle-5); border-color: var(--jungle-5); outline: none; }
.intro-foot { position: absolute; left: 0; right: 0; bottom: var(--edge); text-align: center; margin: 0; font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; color: var(--night-4); opacity: .7; }
.intro-skip { position: absolute; right: var(--edge); top: var(--edge); font-family: var(--font-mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--night-4); opacity: .7; padding: 8px; }
.intro-skip:hover { opacity: 1; }
@keyframes breathe { 0%, 100% { opacity: .45; } 50% { opacity: .95; } }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; color: var(--atmo-fg); transition: color 1.2s; }
#hud > * { pointer-events: auto; }
.hud-tl { position: absolute; left: var(--edge); top: var(--edge); display: flex; align-items: baseline; gap: 18px; pointer-events: none; }
.brand { font-variation-settings: var(--wordmark-axes); font-size: 20px; font-weight: 300; letter-spacing: .02em; }
.brand b { font-weight: 800; }
.day { font-family: var(--font-mono); font-size: var(--t-label); letter-spacing: var(--track-label); opacity: .7; }
.hud-tr { position: absolute; right: var(--edge); top: calc(var(--edge) - 6px); display: flex; gap: 4px; }
.ctl { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 99px; font-family: var(--font-mono); font-size: var(--t-label); letter-spacing: .16em; text-transform: uppercase; opacity: .72; transition: opacity var(--dur-fast), background var(--dur-fast); position: relative; }
.ctl:hover, .ctl:focus-visible { opacity: 1; background: color-mix(in srgb, var(--atmo-fg) 12%, transparent); outline: none; }
.ctl svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ctl[data-ctl="sound"] .wave { display: none; }
.ctl[data-ctl="sound"][aria-pressed="true"] .wave { display: block; }
.ctl[data-ctl="sound"][aria-pressed="true"] .mute { display: none; }
.ctl[aria-pressed="true"] { opacity: 1; }
.ctl[data-ctl="motion"][aria-pressed="true"] { background: color-mix(in srgb, var(--atmo-fg) 14%, transparent); }
.ctl-journal span { font-weight: 500; }
.badge { position: absolute; top: 5px; left: 22px; width: 8px; height: 8px; border-radius: 50%; background: var(--atmo-acc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--atmo-acc) 35%, transparent); animation: breathe 1.6s infinite; }

/* scale ladder: the three levels of looking */
.scale { position: absolute; right: var(--edge); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.scale button { display: flex; align-items: center; gap: 10px; flex-direction: row-reverse; font-family: var(--font-mono); font-size: 10px; letter-spacing: .2em; padding: 6px 0; opacity: .45; transition: opacity var(--dur-mid); }
.scale button i { display: block; width: 18px; height: 1px; background: currentColor; transition: width var(--dur-mid) var(--ease-out); }
.scale button[aria-current="true"] { opacity: 1; }
.scale button[aria-current="true"] i { width: 42px; }
.scale button:hover { opacity: .9; }
.scale button span { opacity: 0; transform: translateX(6px); transition: opacity var(--dur-mid), transform var(--dur-mid) var(--ease-out); }
.scale:hover button span, .scale button[aria-current="true"] span { opacity: 1; transform: none; }
.scale-hint { margin: 10px 0 0; font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; opacity: 0; transition: opacity 1s; white-space: nowrap; }
.scale-hint.in { opacity: .75; animation: breathe var(--dur-breath) infinite; }

/* route: a river line, one node per place */
.route { position: absolute; left: 50%; bottom: calc(var(--edge) - 4px); transform: translateX(-50%); width: min(620px, 70vw); height: 54px; }
.route-line { position: absolute; left: 0; right: 0; top: 0; width: 100%; height: 40px; fill: none; stroke: currentColor; stroke-width: 1; opacity: .35; stroke-dasharray: 2 5; }
.route-nodes { position: absolute; inset: 0; }
.rnode { position: absolute; top: 0; transform: translate(-50%, 0); display: flex; flex-direction: column; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; white-space: nowrap; opacity: .4; transition: opacity var(--dur-mid); }
.rnode i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid currentColor; background: transparent; transition: background var(--dur-mid), transform var(--dur-mid) var(--ease-out); }
.rnode.known { opacity: .78; }
.rnode.known i { background: currentColor; }
.rnode.open:not(.known) { opacity: .65; }
.rnode.open:not(.known) i { animation: breathe 1.8s infinite; }
.rnode.here { opacity: 1; }
.rnode.here i { transform: scale(1.6); box-shadow: 0 0 0 4px color-mix(in srgb, var(--atmo-fg) 22%, transparent); }
.rnode:disabled { cursor: default; }
.rnode b { font-weight: 500; }
.rnode b .d { opacity: .6; }
.rnode:not(:disabled):hover { opacity: 1; }
.soundcue, #hud > .soundcue { position: absolute; inset: 0; pointer-events: none; }
.scue { position: absolute; width: 46px; height: 46px; margin: -23px 0 0 -23px; pointer-events: none; opacity: 0; transition: opacity .8s; font-family: var(--font-mono); font-size: 9px; letter-spacing: .14em; text-align: center; }
.scue.on { opacity: .8; }
.scue svg { width: 46px; height: 46px; fill: none; stroke: currentColor; stroke-width: 1.2; }
.scue svg path { animation: cue 2.2s infinite var(--ease-out); transform-origin: 50% 50%; }
.scue svg path:nth-child(2) { animation-delay: .35s; }
.scue svg path:nth-child(3) { animation-delay: .7s; }
.scue span { display: block; margin-top: -4px; text-transform: uppercase; }
@keyframes cue { 0% { opacity: 0; transform: scale(.6); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1.15); } }

/* ---------- ED WORD: the recurring typographic identity ---------- */
#edword { position: fixed; left: 0; right: 0; top: 20vh; z-index: 9; pointer-events: none; color: var(--atmo-fg); text-shadow: 0 2px 40px color-mix(in srgb, var(--atmo-bg) 55%, transparent); }
.ew-row { display: grid; grid-template-columns: 1fr auto auto 1fr; align-items: baseline; font-size: var(--t-edword); line-height: 1; font-variation-settings: var(--wordmark-axes); }
.ew-pre { grid-column: 1 / 3; justify-self: end; font-weight: 300; letter-spacing: .01em; white-space: nowrap; }
.ew-pre .l { display: inline-block; opacity: 0; transform: translateX(.4em); filter: blur(4px); transition: opacity .55s var(--ease-out), transform .7s var(--ease-out), filter .55s; }
.ew-pre .l.in { opacity: 1; transform: none; filter: none; }
.ew-dot { grid-column: 3; opacity: 0; color: var(--atmo-acc); transition: opacity .4s; margin: 0 .03em; position: absolute; }
.ew-ed { grid-column: 3; font-weight: 800; opacity: 0; transform: scale(.94); transition: opacity .6s var(--ease-out), transform .9s var(--ease-out); }
#edword .ew-row { position: relative; }
#edword.on .ew-ed, #edword.on .ew-dot { opacity: 1; transform: none; }
.ew-sub { margin: 14px 0 0; text-align: center; font-family: var(--font-mono); font-size: 12px; letter-spacing: var(--track-label); text-transform: uppercase; opacity: 0; transition: opacity .9s .4s; }
#edword.on .ew-sub { opacity: .85; }
/* the ED anchor sits on the exact centre line: prefix grows to its left */
.ew-row { grid-template-columns: 1fr auto 1fr; }
.ew-pre { grid-column: 1; }
.ew-ed { grid-column: 2; }
.ew-dot { position: static; grid-column: 1; justify-self: end; display: none; }
.ew-pre::after { content: '·'; color: var(--atmo-acc); margin: 0 .04em 0 .02em; opacity: 0; transition: opacity .4s; }
#edword.on .ew-pre::after { opacity: 1; }
#edword.small .ew-row { font-size: calc(var(--t-edword) * .62); }

/* ---------- hover chip: the available action, never the outcome ---------- */
#chip { position: fixed; left: 0; top: 0; z-index: 12; pointer-events: none; display: flex; align-items: center; gap: 8px; padding: 7px 12px 7px 9px; border-radius: 99px;
  background: color-mix(in srgb, var(--atmo-bg) 78%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--atmo-fg);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; opacity: 0; transform: translate(18px, 14px) scale(.96); transition: opacity var(--dur-fast), transform var(--dur-fast) var(--ease-out); white-space: nowrap; box-shadow: 0 0 0 1px color-mix(in srgb, var(--atmo-fg) 18%, transparent); }
#chip.on { opacity: 1; transform: translate(18px, 14px) scale(1); }
#chip.pinned { transform: translate(-50%, -150%); }
#chip.pinned.on { transform: translate(-50%, -150%); }
.chip-verb { font-weight: 500; text-transform: uppercase; padding: 2px 7px; border-radius: 99px; background: var(--atmo-fg); color: var(--atmo-bg); letter-spacing: .14em; }
.chip-label { text-transform: lowercase; }

/* traveler caption: our playful narration, set in italic */
#caption { position: fixed; left: 0; top: 0; z-index: 8; pointer-events: none; max-width: 260px; transform: translate(-50%, -100%); font-style: italic; font-size: 15px; line-height: 1.3; text-align: center; color: var(--atmo-fg);
  text-shadow: 0 1px 14px color-mix(in srgb, var(--atmo-bg) 80%, transparent), 0 0 2px color-mix(in srgb, var(--atmo-bg) 60%, transparent); opacity: 0; transition: opacity .5s; }
#caption.on { opacity: .95; }

#toast { position: fixed; right: var(--edge); top: 64px; z-index: 13; pointer-events: none; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.tst { display: flex; gap: 12px; align-items: center; padding: 10px 14px 10px 10px; border-radius: 10px; background: var(--paper); color: var(--pencil); box-shadow: 0 10px 30px rgba(16,30,39,.25);
  font-size: 14px; transform: translateX(30px) rotate(1.5deg); opacity: 0; transition: transform .6s var(--ease-out), opacity .4s; max-width: 330px; }
.tst.in { transform: rotate(-.6deg); opacity: 1; }
.tst svg { width: 40px; height: 40px; flex: none; }
.tst small { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; opacity: .7; }
.tst b { font-variation-settings: var(--wordmark-axes); font-weight: 700; }

/* ---------- FIELD JOURNAL ---------- */
#journal { position: fixed; top: 0; right: 0; bottom: 0; width: min(470px, 100vw); z-index: 15; background: var(--paper); color: var(--pencil);
  box-shadow: -30px 0 80px rgba(16,30,39,.35); transform: translateX(105%); transition: transform .7s var(--ease-out); display: flex; flex-direction: column;
  background-image: linear-gradient(rgba(112,75,54,.07) 1px, transparent 1px); background-size: 100% 28px; }
#journal.open { transform: none; }
.j-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 26px 28px 8px; }
.j-kicker { margin: 0; font-family: var(--font-mono); font-size: 10px; letter-spacing: .24em; text-transform: uppercase; opacity: .65; }
.j-head h2 { margin: 2px 0 0; font-variation-settings: var(--wordmark-axes); font-size: 44px; font-weight: 300; line-height: 1; }
.j-head h2 span { color: var(--desert-2); }
.j-close { font-size: 30px; line-height: 1; width: 40px; height: 40px; border-radius: 50%; opacity: .6; }
.j-close:hover { opacity: 1; background: rgba(112,75,54,.08); }
.j-tabs { display: flex; gap: 18px; padding: 6px 28px 10px; border-bottom: 1px solid rgba(112,75,54,.2); }
.j-tabs button { font-family: var(--font-mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; padding: 6px 0; opacity: .55; border-bottom: 1.5px solid transparent; }
.j-tabs button[aria-selected="true"] { opacity: 1; border-color: currentColor; }
.j-body { flex: 1; overflow-y: auto; padding: 18px 28px 40px; scrollbar-width: thin; scrollbar-color: rgba(112,75,54,.35) transparent; }
.j-count { font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; opacity: .6; margin: 0 0 14px; }
.jp { position: relative; padding: 16px 0 18px; border-bottom: 1px dashed rgba(112,75,54,.28); display: grid; grid-template-columns: 74px 1fr; gap: 16px; animation: pageIn .7s var(--ease-out) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px) rotate(.6deg); } to { opacity: 1; transform: none; } }
.jp svg { width: 74px; height: 74px; }
.jp h3 { margin: 0; font-variation-settings: var(--wordmark-axes); font-size: 23px; font-weight: 400; line-height: 1.05; letter-spacing: .01em; }
.jp h3 em { font-style: normal; color: var(--desert-2); font-weight: 800; }
.jp .where { margin: 3px 0 7px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; opacity: .6; }
.jp p { margin: 0 0 8px; font-size: 15px; line-height: 1.42; }
.jp .note { font-style: italic; color: var(--desert-1); }
.jp .note::before { content: 'field note — '; font-style: normal; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; opacity: .6; }
.jp .trace { font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; color: var(--water-2); }
.rec { margin: 10px 0 2px; padding: 10px 12px; border-left: 2px solid var(--jungle-2); background: rgba(49,86,58,.07); border-radius: 0 6px 6px 0; }
.rec b { display: block; font-family: var(--font-mono); font-size: 9.5px; font-weight: 500; letter-spacing: .2em; color: var(--jungle-2); margin-bottom: 4px; }
.rec p { font-size: 14.5px; margin: 0 0 4px; }
.rec q { font-style: italic; }
.rec .src { font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; opacity: .7; margin: 0; }
.jp.blank { grid-template-columns: 74px 1fr; opacity: .55; animation: none; }
.jp.blank .ph { width: 74px; height: 74px; border: 1px dashed rgba(112,75,54,.45); border-radius: 50%; display: grid; place-items: center; font-family: var(--font-mono); font-size: 18px; opacity: .6; }
.jp.blank h3 { font-size: 18px; letter-spacing: .3em; }
.jp.blank p { font-style: italic; font-size: 14px; }
.j-map .mapsvg { width: 100%; height: auto; display: block; margin: 6px 0 14px; }
.j-map .mp { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed rgba(112,75,54,.28); }
.j-map .mp b { font-variation-settings: var(--wordmark-axes); font-size: 21px; font-weight: 400; }
.j-map .mp small { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; opacity: .6; }
.j-map .mp button { font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; padding: 8px 12px; border: 1px solid currentColor; border-radius: 99px; }
.j-map .mp button:disabled { opacity: .3; cursor: default; }
.j-note { font-style: italic; line-height: 1.45; }
.j-note.small { font-size: 13px; opacity: .7; }
.legend p { font-size: 14.5px; line-height: 1.45; }
.legend b { display: inline-block; font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: .18em; padding: 2px 6px; border-radius: 3px; margin-right: 6px; }
.lg-rec { background: rgba(49,86,58,.12); color: var(--jungle-2); }
.lg-ours { background: rgba(163,111,70,.14); color: var(--desert-1); }
.j-reset { margin-top: 24px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; opacity: .55; border-bottom: 1px solid currentColor; padding-bottom: 2px; }
.j-reset:hover { opacity: 1; }

/* ---------- FINALE ---------- */
#finale { position: fixed; inset: 0; z-index: 14; display: grid; place-items: center; align-content: center; gap: 30px; pointer-events: none; color: var(--night-5); text-align: center; padding: var(--edge); }
.fin-lines { font-size: clamp(22px, 2.4vw, 38px); line-height: 1.35; font-weight: 320; min-height: 5em; }
.fin-lines p { margin: .1em 0; opacity: 0; transform: translateY(8px); transition: opacity 1.2s var(--ease-out), transform 1.2s var(--ease-out); text-shadow: 0 2px 30px rgba(16,30,39,.8); }
.fin-lines p.in { opacity: 1; transform: none; }
.fin-lines .big { font-variation-settings: var(--wordmark-axes); font-size: 1.9em; font-weight: 300; }
.fin-lines .big b { font-weight: 800; }
.fin-lines .tag { font-style: italic; color: var(--night-4); }
.fin-go { pointer-events: auto; font-family: var(--font-mono); font-size: 12px; letter-spacing: var(--track-label); text-transform: uppercase; padding: 12px 22px; border: 1px solid currentColor; border-radius: 99px; opacity: 0; transition: opacity 1s; }
.fin-go.in { opacity: .9; }
.fin-go:hover { background: rgba(203,219,160,.12); }

/* ---------- small screens & fallbacks ---------- */
#small, #nogl { position: fixed; inset: 0; z-index: 30; display: grid; place-content: center; gap: 6px; padding: 32px; text-align: center; background: rgba(16,30,39,.92); color: var(--night-5); font-size: 18px; line-height: 1.45; }
#small button { margin: 16px auto 0; font-family: var(--font-mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; padding: 12px 20px; border: 1px solid currentColor; border-radius: 99px; }
@media (max-width: 760px) {
  .ctl span { display: none; }
  .route { width: 86vw; }
  .rnode b { display: none; }
  .brand { font-size: 16px; }
  .day { display: none; }
  #edword { top: 14vh; }
  .scale button span { display: none; }
  .scale-hint { display: none; }
  .hud-tr { top: 10px; right: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .intro-enter.in, .badge, .scale-hint.in, .rnode.open i { animation: none; }
}
html.calm .intro-enter.in, html.calm .badge, html.calm .scale-hint.in, html.calm .rnode i { animation: none !important; }
html.calm .ew-pre .l { transition: opacity .5s; transform: none; filter: none; }

.fin-lines .principle { font-family: var(--font-mono); font-size: .42em; letter-spacing: var(--track-label); text-transform: uppercase; color: var(--night-4); }
