/* ===================================================================== towers v4
   Home: six full-screen scenes, one per tower. Tower page: the whole tower, click a floor to walk in.
   Easing is cubic-bezier(.16,1,.3,1) throughout; everything is off under reduced motion. */

/* ---------------------------------------------------------------- home: scenes */
html.home-snap { scroll-snap-type: y mandatory; scroll-padding-top: 64px; }
.scenes { display: block; }
.scene { position: relative; display: flex; align-items: center; min-height: calc(100vh - 64px); overflow: hidden; scroll-snap-align: start; scroll-snap-stop: always;
  --hw: min(36vw, 440px, calc((100vh - 64px - 110px) * .619)); --ho: 1;
  background: radial-gradient(700px 500px at 72% 80%, rgba(255, 196, 40, .18), transparent 70%), linear-gradient(180deg, #070604, #191307 80%, #2a200b); }
.scene-sky { position: absolute; inset: 0; pointer-events: none; opacity: .7;
  background-image: radial-gradient(1.2px 1.2px at 12% 18%, #f3e6c0 50%, transparent 51%), radial-gradient(1px 1px at 27% 34%, #f3e6c0 50%, transparent 51%), radial-gradient(1.4px 1.4px at 44% 12%, #f3e6c0 50%, transparent 51%), radial-gradient(1px 1px at 61% 28%, #f3e6c0 50%, transparent 51%), radial-gradient(1.2px 1.2px at 79% 14%, #f3e6c0 50%, transparent 51%), radial-gradient(1px 1px at 91% 38%, #f3e6c0 50%, transparent 51%), radial-gradient(1px 1px at 6% 44%, #f3e6c0 50%, transparent 51%); }
.scene-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 70px; background: linear-gradient(180deg, #2c2210, #130e05); border-top: 2px solid #574519; z-index: 1; }

/* the other five towers: dim, blurred, drifting slower than the page */
.scene-bg { position: absolute; left: 0; right: 0; bottom: 70px; display: flex; justify-content: space-around; align-items: flex-end; opacity: .25; filter: blur(1.5px); pointer-events: none; padding: 0 2vw; }
.scene-bg .tw-svg { width: var(--sw, 110px); margin-bottom: calc(var(--sw, 110px) * -0.108 + 8px); overflow: visible; flex: none; }
.scene-bg .tw-svg:nth-child(5n+1) { --sw: 104px; } .scene-bg .tw-svg:nth-child(5n+2) { --sw: 128px; } .scene-bg .tw-svg:nth-child(5n+3) { --sw: 96px; }
.scene-bg .tw-svg:nth-child(5n+4) { --sw: 120px; } .scene-bg .tw-svg:nth-child(5n+5) { --sw: 108px; }
.scene-bg .tw-svg > rect:first-of-type, .scene-bg .tw-ground, .scene-bg .tw-star, .scene-bg .tw-no, .scene-bg .tw-here { display: none; }
.scene-bg .tw-svg * { animation: none !important; }
@keyframes scene-drift { from { transform: translateY(70px); } to { transform: translateY(-70px); } }
@supports (animation-timeline: view()) {
  .scene-bg { animation: scene-drift linear both; animation-timeline: view(); }
}

/* the hero tower */
.scene-hero { position: absolute; z-index: 1; right: 12%; bottom: calc(70px - var(--hw) * .108 + 8px); width: var(--hw); display: block; text-decoration: none;
  opacity: 0; transform: translateY(120px); transition: transform 1.1s cubic-bezier(.16,1,.3,1), opacity .8s cubic-bezier(.16,1,.3,1); }
.scene-hero .tw-svg { width: 100%; max-width: none; overflow: visible; filter: drop-shadow(0 0 40px rgba(255, 200, 40, .25)); }
.scene-hero .tw-svg > rect:first-of-type, .scene-hero .tw-ground, .scene-hero .tw-no, .scene-hero .tw-star { display: none; }
.scene.in .scene-hero { opacity: var(--ho); transform: none; }
.scene.out .scene-hero { opacity: 0; transform: translateY(90px) scale(.97); transition-duration: .6s; }
.scene:not(.in) .scene-hero .tw-svg * { animation: none; } /* floors build when the scene enters */

.scene-in { position: relative; z-index: 2; padding-bottom: 96px; padding-top: 24px; }
.scene-copy { max-width: 560px; }
.sc-k { display: block; color: var(--accent); font-weight: 700; font-size: 1rem; }
.sc-h { font-size: clamp(2.6rem, 6vw, 5rem); line-height: .98; letter-spacing: -.03em; margin: 14px 0 18px; }
.sc-p { color: #d8ccaa; font-size: 1.1rem; max-width: 40ch; margin: 0; }
.sc-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 22px; margin-top: 22px; }
.sc-go { font-size: 1.1rem; padding: 16px 26px; }
.sc-ghost { color: var(--text); font-weight: 500; text-decoration: none; border-bottom: 1px solid var(--border-strong); padding-bottom: 2px; }
.sc-ghost:hover, .sc-ghost:focus-visible { color: var(--accent); border-color: var(--accent); }
.scene-copy > *, .sc-actions > * { transition: transform .9s cubic-bezier(.16,1,.3,1), opacity .7s cubic-bezier(.16,1,.3,1); }
.scene:not(.in) .scene-copy > * { opacity: 0; transform: translateX(-48px); }
.scene.out .scene-copy > * { opacity: 0; transform: translateY(-24px); transition-duration: .4s; }
.scene.in .scene-copy > :nth-child(1) { transition-delay: .10s; } .scene.in .scene-copy > :nth-child(2) { transition-delay: .20s; }
.scene.in .scene-copy > :nth-child(3) { transition-delay: .30s; } .scene.in .scene-copy > :nth-child(4) { transition-delay: .40s; }

/* tower pills, fixed along the bottom */
.scene-pills { position: fixed; z-index: 40; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 8px; max-width: calc(100vw - 24px); overflow-x: auto; scrollbar-width: none; padding: 4px; }
.scene-pills::-webkit-scrollbar { display: none; }
.scene-pills a { flex: none; padding: 8px 14px; border-radius: 99px; background: rgba(0, 0, 0, .62); border: 1px solid #4a3b18; color: var(--text); text-decoration: none; font-size: .9rem; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: background .3s, color .3s, border-color .3s; }
.scene-pills a:hover { border-color: var(--accent); }
.scene-pills a.on { background: var(--accent); color: #1a1405; border-color: var(--accent); font-weight: 700; }

@media (max-width: 700px) {
  .scene { --hw: min(58vw, 240px); --ho: .55; }
  .scene-hero { right: -34px; }
  .scene-in { padding-top: 8px; padding-bottom: 88px; }
  .sc-h { font-size: clamp(2.3rem, 11vw, 3.2rem); }
  .sc-p { font-size: 1rem; max-width: 30ch; }
  .scene-bg .tw-svg { --sw: 72px !important; }
  .scene-pills { left: 0; right: 0; transform: none; max-width: none; padding: 4px 12px; bottom: 12px; }
}

/* ---------------------------------------------------------------- tower page */
.tp { position: relative; min-height: calc(100vh - 64px); overflow: hidden;
  background: radial-gradient(700px 520px at 50% 90%, rgba(255, 196, 40, .16), transparent 70%), linear-gradient(180deg, #070604, #191307 80%, #2a200b); }
.tp-view { position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden; }
.tp-view.gone { display: none; }
.tp-view::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 44px; background: linear-gradient(180deg, #2c2210, #130e05); border-top: 2px solid #574519; z-index: 0; }
.tp-head { position: absolute; z-index: 3; top: 22px; left: max(20px, 4vw); max-width: min(380px, 32vw); transition: opacity .4s cubic-bezier(.16,1,.3,1); }
.tp-crumb { color: var(--muted); font-size: .9rem; text-decoration: none; } .tp-crumb:hover { color: var(--accent); }
.tp-head h1 { margin: 6px 0 4px; font-size: clamp(1.8rem, 3vw, 2.6rem); letter-spacing: -.02em; line-height: 1.05; }
.tp-prog { margin: 0; color: var(--muted); font-size: .92rem; }
.tp-continue, .tp-buy { margin-top: 12px; font-size: .95rem; padding: 10px 16px; white-space: normal; text-align: left; display: inline-flex; max-width: 100%; }
.tp-buy { display: flex; }
.tp-hint { position: absolute; z-index: 3; left: 0; right: 0; bottom: 10px; margin: 0; text-align: center; color: var(--muted); font-size: .9rem; letter-spacing: .04em; pointer-events: none; transition: opacity .4s; }
.tp-stage { position: relative; z-index: 1; flex: 1; min-height: 0; display: flex; justify-content: center; align-items: stretch; padding: 6px 0 0; }
.tp-zoom { height: 100%; will-change: transform; transition: transform .7s cubic-bezier(.16,1,.3,1); }
.tp-zoom .tw-svg { height: 100%; width: auto; max-width: none; display: block; overflow: visible; filter: drop-shadow(0 0 40px rgba(255, 200, 40, .2)); }
.tp-zoom .tw-svg > rect:first-of-type, .tp-zoom .tw-ground, .tp-zoom .tw-star { display: none; }
.tp.zooming .tp-head, .tp.zooming .tp-hint { opacity: 0; }
.tp.zooming .tp-zoom .tw-svg { filter: none; }

.tp .tw-fl, .tp .tw-board, .tp .tw-board-t { cursor: pointer; outline: none; }
.tp .tw-fl .tw-wall, .tp .tw-board { transition: stroke .25s, fill .25s; }
.tp .tw-fl:hover .tw-wall, .tp .tw-fl:focus-visible .tw-wall { stroke: #fff2b0; stroke-width: 3; }
.tp .tw-fl:not(.locked):hover .tw-window, .tp .tw-fl:not(.locked):focus-visible .tw-window { fill: #ffe27a; transition: fill .25s; }
.tp .tw-fl:hover, .tp .tw-fl:focus-visible { filter: drop-shadow(0 0 10px rgba(255, 220, 110, .45)); }
.tp .tw-board:hover, .tp .tw-board:focus-visible { stroke: #fff2b0; stroke-width: 3; }
.tp .tw-fl.is-target .tw-window { fill: #fff2b0 !important; transition: fill .5s; }
.tp .tw-board.is-target { stroke: #fff2b0; }
.tw-lockg circle { fill: #0d0b06; stroke: #5c4b22; stroke-width: 1.5; }
.tw-lockg rect { fill: #9a8855; }
.tw-lockg .sh { fill: none; stroke: #9a8855; stroke-width: 2.6; }

/* the room */
.tp-room { position: relative; min-height: calc(100vh - 64px); opacity: 0; transform: scale(1.04); transition: opacity .5s cubic-bezier(.16,1,.3,1), transform .7s cubic-bezier(.16,1,.3,1); }
.tp-room[hidden] { display: none; }
.tp-room.show { opacity: 1; transform: none; }
.room-in { max-width: 840px; margin: 0 auto; padding: 28px 20px 90px; }
.room-back { margin-bottom: 22px; }
.room-k { margin: 0; color: var(--accent); font-weight: 700; }
.room-h { margin: 6px 0 6px; font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1; letter-spacing: -.03em; }
.room-sub { margin: 0 0 24px; }
.room-list { display: grid; gap: 12px; }
.room-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto auto; gap: 14px; align-items: center; padding: 18px 20px; border-radius: 16px; border: 1px solid var(--border); background: var(--raised); color: var(--text); text-decoration: none; font-size: 1.12rem;
  transition: border-color .2s, background .2s, transform .35s cubic-bezier(.16,1,.3,1); }
a.room-row:hover, a.room-row:focus-visible { border-color: var(--accent); background: var(--surface-2); transform: translateX(4px); }
.room-row .tw-tick { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: .95rem; }
.room-row.is-done .tw-tick { background: var(--accent); color: var(--on-accent); }
.room-row.is-next { border-color: var(--accent); }
.room-row.is-next .tw-tick { border: 2px solid var(--accent); color: var(--accent); background: transparent; }
.rr-t { font-weight: 600; min-width: 0; }
.rr-next { color: var(--on-accent); background: var(--accent); font-weight: 700; font-size: .8rem; padding: 4px 10px; border-radius: 99px; }
.rr-min { font-size: .9rem; white-space: nowrap; }
.room-row.is-locked { opacity: .55; }
.room-lock { padding: 16px 20px; border-radius: 14px; border: 1px dashed var(--border-strong); margin-bottom: 14px; } .room-lock p { margin: 4px 0 0; }
.room-acts { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.room-projects { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.room-cert { margin-top: 22px; }

@media (max-width: 700px) {
  .tp-head { position: absolute; max-width: calc(100% - 36px); left: 18px; top: 14px; }
  .tp-head h1 { font-size: 1.7rem; }
  .tp-prog { font-size: .82rem; }
  .tp-stage { padding-top: 96px; }
  .tp-continue, .tp-buy { font-size: .85rem; padding: 8px 12px; }
  .room-row { grid-template-columns: 36px minmax(0, 1fr) auto; padding: 14px; font-size: 1rem; gap: 10px; }
  .room-row .rr-next { grid-column: 3; grid-row: 1; } .room-row .rr-min { grid-column: 2; grid-row: 2; }
  .room-row .pill { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .scene-hero, .scene-copy > *, .sc-actions > * { opacity: 1 !important; transform: none !important; transition: none !important; }
  .scene-hero { opacity: var(--ho) !important; }
  .scene-bg { animation: none !important; }
  .tp-zoom, .tp-room, .tp-head, .tp-hint, .room-row { transition: none !important; }
  .tp-room { transform: none; }
}

/* ===== side-to-side street (overrides the vertical scene stack above) ===== */
html.home-snap { scroll-snap-type: none; }
.scenes { display: flex; height: calc(100vh - 64px); overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.scenes::-webkit-scrollbar { display: none; }
.scene { flex: 0 0 100%; min-height: 0; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; }
.scene-bg { animation: none !important; will-change: transform; left: -12%; right: -12%; }
/* towers slide in from the side they arrive from, instead of rising */
.scene.out .scene-hero { transform: translateX(14vw) scale(.94); }
.scene.out .scene-copy > * { transform: translateX(-30px); }
.scene-arrow { position: fixed; z-index: 41; top: 50%; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: rgba(0, 0, 0, .55); border: 1px solid #4a3b18; color: var(--text); transition: border-color .2s, color .2s, opacity .2s; }
.scene-arrow svg { width: 22px; height: 22px; }
.scene-arrow:hover, .scene-arrow:focus-visible { border-color: var(--accent); color: var(--accent); }
.scene-arrow:disabled { opacity: 0; pointer-events: none; }
.scene-arrow.prev { left: 18px; } .scene-arrow.next { right: 18px; }
@media (max-width: 700px) { .scene-arrow { top: auto; bottom: 64px; width: 44px; height: 44px; } }
@media (prefers-reduced-motion: reduce) { .scenes { scroll-behavior: auto; } }
