/* After Hours v2. Words sit in the world, not on cards. Ghibli's ratio: ~60% greens and earth, ~30% sky and light, ~10% warm accent. */
:root {
  --cream: #fffaf0;
  --ink: #241e18;
  --accent: #e0703a;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --serif: "Shippori Mincho B1", Georgia, serif;
  --sans: "Zen Kaku Gothic New", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --gutter: max(22px, env(safe-area-inset-left));
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9cc4e4; font-family: var(--sans); color: var(--cream); -webkit-font-smoothing: antialiased; }
body { touch-action: none; cursor: crosshair; }
#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(130% 100% at 50% 45%, transparent 60%, rgb(30 24 40 / .28) 100%); }

/* HUD */
.hud { position: fixed; inset: 0 0 auto 0; display: flex; justify-content: space-between; align-items: center; padding: 20px var(--gutter); z-index: 5; }
.brand { font: 800 18px/1 var(--serif); color: var(--cream); text-decoration: none; text-shadow: 0 1px 12px rgb(20 40 70 / .45); }
.hud nav { display: flex; gap: 8px; }
.pill { font: 500 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--cream); text-decoration: none; background: rgb(20 30 50 / .22); border: 1px solid rgb(255 255 255 / .28); border-radius: 999px; padding: 10px 14px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; transition: background .2s var(--ease), transform .1s var(--ease); }
.pill:hover { background: rgb(20 30 50 / .36); }
.pill:active { transform: scale(.96); }
.bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 11px; }
.bars i { width: 2px; height: 3px; background: currentColor; border-radius: 1px; }
[aria-pressed="true"] .bars i { animation: bar 1.1s ease-in-out infinite; }
[aria-pressed="true"] { background: rgb(255 250 240 / .9); color: #241e18; border-color: transparent; }
.found { position: absolute; left: 50%; transform: translateX(-50%); cursor: default; transition: transform .25s var(--ease), background .2s var(--ease); }
.found.bump { transform: translateX(-50%) scale(1.12); }
.found b { font-weight: 500; }
.found .dot { width: 8px; height: 8px; border-radius: 50%; background: #fff3c4; box-shadow: 0 0 10px 3px rgb(255 230 150 / .8); }
body.pointing { cursor: pointer; }
.tip { margin: 16px auto 0; font: 500 11px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--cream); text-shadow: 0 1px 10px rgb(20 40 70 / .7); opacity: 0; }
.beat.side { left: auto; right: var(--gutter); transform: translateY(-50%); top: 30%; width: min(44vw, 560px); text-align: right; }
.beat.side .sub { margin-right: 0; }
.fact { position: fixed; left: 50%; bottom: 74px; z-index: 6; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; max-width: min(560px, 90vw); text-align: center; padding: 16px 22px; border-radius: 16px;
  background: rgb(255 250 240 / .9); color: #241e18; box-shadow: 0 20px 50px -20px rgb(40 30 20 / .45), 0 0 0 1px rgb(255 255 255 / .5) inset; backdrop-filter: blur(10px); transition: opacity .5s var(--ease), transform .7s var(--ease); }
.fact.in { opacity: 1; transform: translate(-50%, 0); }
.fact span { display: block; font: 500 10.5px/1 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: #c05a2a; margin-bottom: 8px; }
.fact p { margin: 0; font: 600 19px/1.4 var(--serif); }
.hint-scroll.done { opacity: 0; }
[aria-pressed="true"] .bars i:nth-child(2) { animation-delay: -.3s; } [aria-pressed="true"] .bars i:nth-child(3) { animation-delay: -.6s; } [aria-pressed="true"] .bars i:nth-child(4) { animation-delay: -.9s; }
@keyframes bar { 50% { height: 11px; } }

/* story beats: big words set in the scene */
.beats { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
.beat { position: absolute; left: 50%; top: 23%; transform: translate(-50%, -50%); width: min(92vw, 980px); text-align: center; visibility: hidden; }
.beat.intro { top: 40%; }
.beat.place { top: 19%; }
h1, h2 { margin: 0; font-family: var(--serif); font-weight: 800; letter-spacing: -.015em; line-height: 1; text-wrap: balance; color: var(--cream);
  text-shadow: 0 2px 2px rgb(30 50 90 / .18), 0 6px 40px rgb(30 50 90 / .45); }
h1 { font-size: clamp(64px, 12vw, 176px); }
h2 { font-size: clamp(38px, 5.6vw, 88px); }
.w { display: inline-block; white-space: nowrap; }
.ch { display: inline-block; will-change: transform, opacity, filter; opacity: 0; }
.eyebrow { margin: 0 0 18px; font: 500 11px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--cream); text-shadow: 0 1px 10px rgb(30 50 90 / .6); opacity: 0; }
.sub { margin: 22px auto 0; max-width: 34em; font-size: clamp(15px, 1.35vw, 19px); line-height: 1.6; color: var(--cream); text-shadow: 0 1px 14px rgb(20 40 70 / .75), 0 0 2px rgb(20 40 70 / .4); opacity: 0; }
.proto { margin: 28px auto 0; font: 500 11px/1.6 var(--mono); letter-spacing: .12em; text-transform: uppercase; opacity: 0; text-shadow: 0 1px 10px rgb(60 30 10 / .7); }
html.gold h1, html.gold h2 { text-shadow: 0 2px 2px rgb(90 40 20 / .2), 0 6px 40px rgb(110 50 20 / .5); }

/* hints and progress */
.hints { position: fixed; left: 0; right: 0; bottom: 26px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 4; pointer-events: none; }
.hints p { margin: 0; font: 500 11px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--cream); text-shadow: 0 1px 10px rgb(20 40 70 / .7); display: inline-flex; gap: 10px; align-items: center; transition: opacity .8s var(--ease); }
.hint-click.done { opacity: 0; }
.mouse { width: 14px; height: 22px; border: 1.5px solid currentColor; border-radius: 8px; position: relative; }
.mouse::after { content: ""; position: absolute; left: 50%; top: 4px; width: 2px; height: 5px; margin-left: -1px; background: currentColor; border-radius: 1px; animation: wheel 1.8s var(--ease) infinite; }
@keyframes wheel { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(7px); opacity: 0; } 100% { opacity: 0; } }
.progress { position: fixed; left: 0; right: 0; bottom: 0; height: 3px; z-index: 5; background: rgb(255 255 255 / .15); }
.progress i { display: block; height: 100%; background: var(--cream); transform-origin: left; transform: scaleX(0); }

/* curtain: a bird settles on the title while the valley loads */
.curtain { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; overflow: hidden; color: var(--ink);
  --veil: 1; --cb: 22px; --cs: .5; --hills: 1; --wash: 0; --lift: 0;
  -webkit-backdrop-filter: blur(var(--cb)) saturate(var(--cs)); backdrop-filter: blur(var(--cb)) saturate(var(--cs)); }
.curtain.done { visibility: hidden; }
/* paper veil: opaque while loading; thins to frosted glass over the real (blurred) valley once it is ready; clears as the robin dives */
.c-veil { position: absolute; inset: 0; opacity: var(--veil); pointer-events: none;
  background: radial-gradient(120% 90% at 50% 40%, #fbf5e8 0%, #f3e8d3 62%, #e6d5b8 100%); }
.c-grain { position: absolute; inset: -50%; opacity: calc(var(--veil) * .5); pointer-events: none; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .37 0 0 0 0 .27 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
/* sketched hills: pencil lines first; the colour washes in from the left as the valley loads (each layer drifts at its own depth) */
.c-hills { position: absolute; left: -4%; right: -4%; bottom: 0; width: 108%; height: 58vh; opacity: var(--hills); pointer-events: none; }
.c-hills g { transform: translate(calc(var(--mx, 0) * var(--d) * 1px), calc(var(--my, 0) * var(--d) * .4px)); transition: transform .9s cubic-bezier(.23, 1, .32, 1); }
.c-hills .line { fill: none; stroke: rgb(70 54 38 / .32); stroke-width: 1.4; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.c-motes i { position: absolute; bottom: -10px; width: var(--s); height: var(--s); border-radius: 50%; background: rgb(255 236 200 / .9); filter: blur(var(--b));
  opacity: calc(var(--veil) * .7); animation: mote var(--t) linear var(--dl) infinite; pointer-events: none; }
@keyframes mote { from { transform: translate(0, 0); } to { transform: translate(var(--dx), -105vh); } }
.c-stage { position: relative; text-align: center; opacity: calc(1 - var(--lift)); transform: translateY(calc(var(--lift) * -18px)) scale(calc(1 + var(--lift) * .04)); }
.c-title { text-shadow: 0 1px 0 rgb(255 250 240 / .6), 0 18px 40px rgb(120 84 40 / .14); }
@media (prefers-reduced-motion: reduce) { .c-motes { display: none; } }
.c-sound { position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid rgb(36 30 24 / .18); border-radius: 999px;
  background: rgb(255 250 240 / .55); color: rgb(36 30 24 / .7); font: 500 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; cursor: pointer; opacity: calc(1 - var(--lift));
  transition: background .15s, border-color .15s, transform .1s; }
.c-sound:hover { background: rgb(255 250 240 / .85); border-color: rgb(36 30 24 / .3); }
.c-sound:active { transform: translateX(-50%) scale(.96); }
.c-sound .bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 10px; }
.c-sound .bars i { width: 2px; height: 3px; background: currentColor; border-radius: 1px; }
.c-sound[aria-pressed="true"] .bars i { animation: cbar .9s ease-in-out infinite; } .c-sound[aria-pressed="true"] .bars i:nth-child(2) { animation-delay: -.3s; } .c-sound[aria-pressed="true"] .bars i:nth-child(3) { animation-delay: -.6s; } .c-sound[aria-pressed="true"] .bars i:nth-child(4) { animation-delay: -.15s; }
@keyframes cbar { 0%, 100% { height: 3px; } 50% { height: 10px; } }
.c-title { font: 800 clamp(56px, 9vw, 120px)/1 var(--serif); margin: 0 0 26px; letter-spacing: -.015em; }
.perch { display: inline-block; transition: transform .45s cubic-bezier(.34, 1.8, .64, 1); }
.perch.landed { transform: translateY(5px) scaleY(.97); }
.c-bar { width: 160px; height: 2px; margin: 0 auto; background: rgb(36 30 24 / .12); overflow: hidden; border-radius: 2px; }
.c-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s var(--ease); }
.c-soft { max-width: 420px; margin: 14px auto 0; font: 400 12px/1.5 var(--sans, system-ui); color: rgb(36 30 24 / .6); }
.c-note { margin: 16px 0 0; font: 500 11px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: rgb(36 30 24 / .55); }
.birdfx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.bird { position: absolute; left: 0; top: 0; width: 150px; height: 112.5px; opacity: 0; transform-origin: 50% 87.8%; transform: translate(-200px, -200px); will-change: transform; pointer-events: none; overflow: visible; }
.bird .legs { transition: opacity .2s; }

@media (max-width: 760px) {
  .beat { top: 30%; }
  .beat.side { left: 50%; right: auto; transform: translate(-50%, -50%); width: 92vw; text-align: center; }
  .hud nav .pill:first-child { display: none; }
  .found { top: 64px; }
  .pill { padding: 9px 11px; }
}
@media (prefers-reduced-motion: reduce) { .mouse::after, .bars i { animation: none !important; } }

/* ---------- inside the house ---------- */
.fade { position: fixed; inset: 0; z-index: 7; pointer-events: none; opacity: 0; background: radial-gradient(60% 60% at 50% 55%, #fff1d6 0%, #f3c98a 55%, #9a5a2a 100%); }
.hint-door { opacity: 0; transition: opacity .6s var(--ease); }
.hint-door.show { opacity: 1; }
body:not(.inside) :is(.spots, .room, .room-nav, .step-out, .to-night, .caption, .zoom-hint, .leak) { display: none !important; }
body.inside .spots, body.inside .room, body.inside .room-nav, body.inside .step-out { display: revert; }
body.inside .beats, body.inside .hints, body.inside .found { display: none; }
body.inside { cursor: default; }
.spots { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.spot { position: absolute; left: 0; top: 0; width: 0; height: 0; padding: 0; border: 0; background: none; pointer-events: auto; cursor: pointer; transition: opacity .4s var(--ease); }
.spot i { position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%; background: rgb(255 240 210 / .9); box-shadow: 0 0 0 0 rgb(255 220 160 / .7), 0 0 18px 4px rgb(255 210 140 / .55); animation: ping 2.4s var(--ease) infinite; }
.spot span { position: absolute; left: 16px; top: -13px; white-space: nowrap; font: 500 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: #241e18; background: rgb(255 250 240 / .92); padding: 7px 10px; border-radius: 999px; opacity: 0; transform: translateX(-6px); transition: opacity .2s var(--ease), transform .3s var(--ease); pointer-events: none; }
.spot:hover span, .spot:focus-visible span { opacity: 1; transform: none; }
.spot:active i { transform: scale(.85); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgb(255 220 160 / .7), 0 0 18px 4px rgb(255 210 140 / .55); } 70%, 100% { box-shadow: 0 0 0 18px rgb(255 220 160 / 0), 0 0 18px 4px rgb(255 210 140 / .55); } }
.room { position: fixed; left: var(--gutter); bottom: 86px; z-index: 5; max-width: min(460px, 86vw); padding: 20px 24px; border-radius: 16px; background: linear-gradient(180deg, rgb(30 18 10 / .55), rgb(30 18 10 / .72)); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--cream); }
.room .name { margin: 0 0 8px; font: 500 10.5px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: #ffd9a0; }
.room h2 { font-size: clamp(28px, 3vw, 42px); margin: 0 0 8px; text-shadow: none; }
.room .sub { margin: 0; opacity: 1; font-size: 15px; text-shadow: none; }
.room.in > * { animation: roomIn .9s var(--ease) both; }
.room.in > :nth-child(2) { animation-delay: .08s; } .room.in > :nth-child(3) { animation-delay: .16s; }
@keyframes roomIn { from { opacity: 0; transform: translateY(12px); filter: blur(6px); } }
.room-nav { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 5; display: flex; gap: 6px; padding: 5px; border-radius: 999px; background: rgb(30 18 10 / .5); backdrop-filter: blur(8px); }
body.inside .room-nav { display: flex; }
.room-nav button { font: 500 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--cream); background: none; border: 0; padding: 10px 14px; border-radius: 999px; cursor: pointer; transition: background .2s var(--ease); }
.room-nav button[aria-current="true"] { background: rgb(255 240 210 / .92); color: #241e18; }
.step-out { position: fixed; left: var(--gutter); top: 66px; z-index: 6; }
body.inside .step-out { display: inline-flex; }
@media (max-width: 760px) { .room { bottom: 76px; left: 12px; right: 12px; max-width: none; } }

/* ---------- v6: walking between rooms, zooming in, switches, the night ---------- */
.fade.cool { background: radial-gradient(70% 70% at 50% 50%, #2a3560 0%, #121a36 60%, #070a18 100%); }
.leak { position: fixed; inset: -10%; z-index: 3; pointer-events: none; opacity: 0; mix-blend-mode: screen;
  background: radial-gradient(40% 55% at 85% 40%, rgb(255 190 110 / .75), transparent 70%), radial-gradient(30% 40% at 10% 70%, rgb(255 140 80 / .45), transparent 70%), linear-gradient(100deg, transparent 30%, rgb(255 230 190 / .35) 50%, transparent 70%); }
.to-night { position: fixed; right: var(--gutter); bottom: 86px; z-index: 6; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .5s var(--ease), transform .5s var(--ease); }
.to-night.show { opacity: 1; transform: none; pointer-events: auto; }
body.inside .to-night { display: inline-flex; }
.spot.on i { background: #ffcf7a; box-shadow: 0 0 0 0 rgb(255 200 120 / .8), 0 0 26px 8px rgb(255 190 100 / .75); }
.caption { position: fixed; left: 50%; bottom: 40px; z-index: 6; transform: translate(-50%, 10px); margin: 0; max-width: min(560px, 88vw); text-align: center; font: italic 500 18px/1.5 "Shippori Mincho B1", Georgia, serif; color: var(--cream); text-shadow: 0 1px 12px rgb(0 0 0 / .6); opacity: 0; transition: opacity .5s var(--ease), transform .5s var(--ease); pointer-events: none; }
.zoom-hint { position: fixed; right: var(--gutter); top: 66px; z-index: 6; margin: 0; font: 500 10.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--cream); opacity: 0; transition: opacity .4s var(--ease); pointer-events: none; }
body.zoomed .caption { opacity: 1; transform: translate(-50%, 0); }
body.zoomed .zoom-hint { opacity: .8; }
body.zoomed :is(.room, .room-nav, .step-out, .to-night, .spots) { opacity: 0 !important; pointer-events: none !important; transition: opacity .4s var(--ease); }
body.zoomed { cursor: zoom-out; }
body.inside :is(.room, .room-nav, .step-out) { transition: opacity .4s var(--ease); }
.nightline { position: fixed; left: var(--gutter); top: 50%; z-index: 4; max-width: min(520px, 86vw); transform: translateY(-40%); opacity: 0; transition: opacity 1.2s var(--ease), transform 1.2s var(--ease); pointer-events: none; color: var(--cream); }
.nightline.in { opacity: 1; transform: translateY(-50%); }
.nightline h2 { margin: 6px 0 8px; font: 600 clamp(30px, 3.6vw, 52px)/1.1 "Shippori Mincho B1", Georgia, serif; text-shadow: 0 2px 24px rgb(0 0 0 / .45); }
.nightline .eyebrow { margin: 0; font: 500 10.5px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: #ffd9a0; }
.nightline .sub { margin: 0; font-size: 15px; opacity: .85; }
.nightline.dawn { left: auto; right: var(--gutter); text-align: right; }
body.night-mode .beats, body.night-mode .found { opacity: 0; pointer-events: none; }
.room { transition: opacity .8s var(--ease), transform .8s var(--ease); }
.room.rest { opacity: 0; transform: translateY(10px); pointer-events: none; }

/* v8: words stay readable over any sky: a soft, feathered shade behind them (like a film subtitle), heavier body text */
.beat::before { content: ""; position: absolute; inset: -18% -10%; z-index: -1; pointer-events: none; opacity: var(--shade, 0);
  background: radial-gradient(closest-side, rgb(14 24 44 / .42), rgb(14 24 44 / .22) 55%, transparent 100%); filter: blur(6px); transition: opacity .6s var(--ease); }
html.gold .beat::before { background: radial-gradient(closest-side, rgb(48 22 10 / .38), rgb(48 22 10 / .2) 55%, transparent 100%); }
.beat.side::before { inset: -20% -14% -20% -30%; }
.sub { font-weight: 500; text-shadow: 0 1px 2px rgb(10 20 40 / .55), 0 2px 18px rgb(10 20 40 / .8); }
.hints .hint-click { transition: opacity 1s var(--ease); }

/* v8 interior: the object itself is the button; this label names it and says what clicking does */
.otip { position: fixed; left: 0; top: 0; z-index: 6; pointer-events: none; opacity: 0; transition: opacity .18s var(--ease); }
.otip.on { opacity: 1; }
.otip > div { position: absolute; left: 0; bottom: 14px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; white-space: nowrap; }
.otip b { font: 500 10px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: #ffe2b8; text-shadow: 0 1px 8px rgb(20 10 4 / .9); }
.otip span { padding: 7px 12px 8px; border-radius: 999px; font: 600 15px/1 var(--serif); color: #241e18; background: rgb(255 248 236 / .94); box-shadow: 0 6px 20px rgb(20 10 4 / .35); }
.otip span:empty { display: none; }
.otip::after { content: ""; position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: #ffe2b0; box-shadow: 0 0 0 3px rgb(255 226 176 / .3), 0 0 14px 3px rgb(255 200 120 / .6); }
body.inside.pointing { cursor: pointer; }
body.sitting :is(.room, .room-nav, .step-out, .to-night) { opacity: 0 !important; pointer-events: none !important; transition: opacity .6s var(--ease); }
body:not(.inside) .otip { display: none; }
.spots { display: none !important; }
