/* 한밤 - page shells: hub (place chooser), scene pages, places/credits page.
   Loaded after site.css. The old one-page composition styles stay in site.css
   because the scene pages reuse the chapter/copy/gallery primitives. */

/* --------------------------------------------------- cross-document transitions */
@view-transition { navigation: auto; }
.wordmark { view-transition-name: brand; }

@keyframes vt-leave { to { opacity: 0; transform: scale(0.994); } }
@keyframes vt-enter { from { opacity: 0; transform: scale(1.008); } }
::view-transition-old(root) { animation: 240ms var(--ease-out) both vt-leave; }
::view-transition-new(root) { animation: 340ms var(--ease-out) both vt-enter; }
::view-transition-old(brand), ::view-transition-new(brand) { animation-duration: 340ms; }

/* ------------------------------------------------------------------------ hub */
@keyframes hub-rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
body.is-ready .hub-head { animation: hub-rise 720ms var(--ease-out) both; }
body.is-ready .hub-list > li { animation: hub-rise 720ms var(--ease-out) both; }
body.is-ready .hub-list > li:nth-child(1) { animation-delay: 120ms; }
body.is-ready .hub-list > li:nth-child(2) { animation-delay: 180ms; }
body.is-ready .hub-list > li:nth-child(3) { animation-delay: 240ms; }
body.is-ready .hub-list > li:nth-child(4) { animation-delay: 300ms; }
body.is-ready .hub-preview { animation: hub-rise 900ms var(--ease-out) 160ms both; }

.hub-page { min-height: 100svh; overflow-x: hidden; }
.hub-page .site-head { background: transparent; }

.hub-bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background: var(--bg); pointer-events: none;
}
.hub-bg img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0;
  transform: scale(1.04);
  transition: opacity 1.1s var(--ease-out), transform 9s linear;
}
.hub-bg img.is-active { opacity: 1; transform: scale(1); }
.hub-bg::after { content: ""; position: absolute; inset: 0; background: rgba(9, 10, 13, 0.8); }

.hub {
  position: relative; z-index: 1;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
  grid-template-rows: auto 1fr auto;
  gap: clamp(14px, 2.4vh, 30px) clamp(24px, 4vw, 72px);
  padding: calc(var(--head-h) + clamp(16px, 3vh, 34px)) var(--margin) clamp(14px, 2.4vh, 24px);
}

.hub-head { grid-column: 1; grid-row: 1; }
.hub-title {
  font-family: var(--font-display);
  font-size: clamp(56px, 8.4vw, 124px);
  line-height: 0.84;
  letter-spacing: -0.025em;
  margin: 0;
}
.hub-lead {
  margin: clamp(14px, 2vh, 22px) 0 0;
  max-width: 38ch;
  font-size: clamp(16px, 1.25vw, 19px);
  line-height: 1.5;
  color: var(--ink-soft);
  word-break: keep-all;
}
.hub-meta { margin: 14px 0 0; font-size: var(--step-small); color: var(--ink-soft); }

.hub-list {
  grid-column: 1; grid-row: 2;
  align-self: end;
  list-style: none; margin: 0; padding: 0;
  width: min(100%, 760px);
}
.hub-list li + li { margin-top: 2px; }

.hub-place-link {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr) auto 26px;
  gap: clamp(12px, 1.6vw, 22px);
  align-items: center;
  padding: clamp(9px, 1.3vh, 14px) 10px;
  color: var(--ink);
  background: transparent;
  transition: background 220ms var(--ease-out), color 220ms var(--ease-out);
}
.hub-time { font-size: var(--step-small); color: var(--ink-soft); white-space: nowrap; }
.hub-name {
  display: flex; flex-direction: column; gap: 4px;
  font-family: var(--font-display);
  font-size: clamp(25px, 2.5vw, 38px);
  line-height: 1.02;
  letter-spacing: 0;
}
.hub-name small {
  font-family: var(--font-text);
  font-size: var(--step-small);
  letter-spacing: -0.01em;
  color: var(--ink-soft);
}
.hub-where { font-size: var(--step-small); color: var(--ink-soft); text-align: right; white-space: nowrap; }
.hub-go { font-size: 17px; color: var(--ink-soft); transition: transform 260ms var(--ease-out), color 220ms; }
.hub-place-link:hover,
.hub-place-link:focus-visible { background: var(--bg-2); }
.hub-place-link:hover .hub-go,
.hub-place-link:focus-visible .hub-go { transform: translateX(4px); color: var(--accent); }
.hub-place-link:hover .hub-name small,
.hub-place-link:focus-visible .hub-name small { color: var(--ink); }

.hub-preview {
  grid-column: 2; grid-row: 1 / span 2;
  align-self: end; justify-self: end;
  position: relative;
  width: 100%; height: min(56vh, 520px);
  margin: 0; overflow: hidden;
  background: var(--bg-2);
}
.hub-preview img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0;
  transition: opacity 620ms var(--ease-out);
}
.hub-preview img.is-active { opacity: 1; }
.hub-preview figcaption {
  position: absolute; left: 12px; bottom: 12px;
  padding: 6px 10px;
  background: rgba(9, 10, 13, 0.72);
  font-size: var(--step-small); color: var(--ink);
  word-break: keep-all;
}

.hub-foot {
  grid-column: 1 / -1; grid-row: 3;
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 24px;
  font-size: var(--step-small); color: var(--ink-soft);
}
.hub-foot a { color: var(--ink); }
.hub-foot a:hover { color: var(--accent); }

@media (max-width: 1000px) {
  .hub { grid-template-columns: 1fr; }
  .hub-preview { display: none; }
  .hub-title { font-size: clamp(64px, 15vw, 128px); }
  .hub-list { width: 100%; }
}

@media (max-width: 760px) {
  .hub { padding-top: calc(var(--head-h) + 26px); gap: 16px; }
  .hub-title { font-size: clamp(56px, 19vw, 88px); }
  .hub-lead { margin-top: 14px; font-size: 16px; max-width: 32ch; }
  .hub-meta { margin-top: 10px; font-size: 12px; }
  .hub-place-link {
    grid-template-columns: minmax(0, 1fr) 24px;
    grid-template-areas: "time go" "name name" "where where";
    gap: 2px 12px;
    padding: 10px 8px;
  }
  .hub-time { grid-area: time; }
  .hub-name { grid-area: name; font-size: 24px; }
  .hub-name small { font-size: 13px; }
  .hub-where { grid-area: where; text-align: left; }
  .hub-go { grid-area: go; align-self: center; }
  .hub-foot { flex-direction: column; gap: 8px; }
}

/* --------------------------------------------------------------- scene page */
.scene-page { height: 100svh; overflow: hidden; }
.scene-head {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: var(--head-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 0 var(--margin);
  background: var(--bg);
}
.scene-head-actions { display: flex; align-items: center; gap: 10px; }
.scene-pager { display: flex; align-items: center; gap: 2px; }
.pager-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px;
  font-size: 17px; color: var(--ink-soft);
  transition: color 180ms, background 180ms;
}
.pager-link:hover, .pager-link:focus-visible { color: var(--ink); background: var(--bg-2); }

.scene-page .chapter { height: 100svh; }
.scene-page .chapter-canvas { z-index: 0; }

/* the second canvas: the scene paints only its lights here, CSS blurs it and
   screens it over the frame - a cheap, GPU-composited bloom pass */
.scene-glow {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  pointer-events: none;
  mix-blend-mode: screen;
  filter: blur(clamp(6px, 0.75vw, 12px));
  opacity: 0.9;
  will-change: filter;
  transform: translateZ(0);
}
.scene-page .chapter-copy { z-index: 2; }

/* entrance: the plate settles, then the words arrive */
.scene-page .chapter-canvas,
.scene-page .scene-glow {
  opacity: 0; transform: scale(1.015);
  transition: opacity 800ms var(--ease-out), transform 1500ms var(--ease-out);
}
.scene-page.is-ready .chapter-canvas,
.scene-page.is-ready .scene-glow { opacity: 1; transform: none; }
.scene-page .chapter-copy > * {
  opacity: 0; transform: translateY(14px);
  transition: opacity 620ms var(--ease-out), transform 620ms var(--ease-out);
}
.scene-page.is-ready .chapter-copy > * { opacity: 1; transform: none; }
.scene-page.is-ready .chapter-copy > *:nth-child(1) { transition-delay: 90ms; }
.scene-page.is-ready .chapter-copy > *:nth-child(2) { transition-delay: 170ms; }
.scene-page.is-ready .chapter-copy > *:nth-child(3) { transition-delay: 250ms; }
.scene-page.is-ready .chapter-copy > *:nth-child(4) { transition-delay: 330ms; }
.scene-page.is-ready .chapter-copy > *:nth-child(5) { transition-delay: 410ms; }

/* -------------------------------------------------------------- places page */
.places-page { min-height: 100svh; }
.places-page .scene-head { background: var(--bg); }
.places {
  max-width: 1320px;
  margin: 0 auto;
  padding: calc(var(--head-h) + clamp(28px, 6vh, 64px)) var(--margin) clamp(80px, 12vh, 140px);
}
.places-head { max-width: min(100%, 920px); margin-bottom: clamp(36px, 7vh, 84px); }
.places-head h1 { font-family: var(--font-display); font-size: clamp(44px, 5.2vw, 82px); line-height: 0.98; letter-spacing: -0.02em; margin: 0 0 20px; word-break: keep-all; }
.places-head p { color: var(--ink-soft); font-size: clamp(17px, 1.3vw, 19px); max-width: 46ch; }
.places .real { padding: 0; }
.places .about { padding: 0; }
.places .foot-legal { margin-top: clamp(48px, 8vh, 96px); padding-top: 0; }
.places-scenes {
  display: flex; flex-wrap: wrap; gap: 8px 24px;
  list-style: none; margin: 22px 0 0; padding: 0;
  font-size: var(--step-small);
}
.places-scenes a { color: var(--ink); }
.places-scenes a:hover { color: var(--accent); }
.places-credits { margin-top: clamp(64px, 10vh, 120px); }
.places-credits .foot-credits { margin-top: clamp(24px, 3vh, 36px); }

/* ---------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root),
  ::view-transition-old(brand), ::view-transition-new(brand) { animation: none; }
  .scene-page .chapter-canvas,
  .scene-page .scene-glow,
  .scene-page .chapter-copy > * { transition: none; opacity: 1; transform: none; }
  .hub-bg img { transition: opacity 200ms linear; transform: none; }
  body.is-ready .hub-head,
  body.is-ready .hub-list > li,
  body.is-ready .hub-preview { animation: none; }
}
