@font-face {
  font-family: Manrope;
  src: url("./assets/fonts/manrope-400.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Manrope;
  src: url("./assets/fonts/manrope-700.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --mood-bg: #060709;
  --background: #060709;
  --foreground: #f0f1f3;
  --secondary: #a7a9ae;
  --subtle: #8c8f95;
  --accent: #f0f1f3;
  --line: #303238;
  --font-display: 'DM Serif Display', serif;
  --inset: clamp(24px, 4.2vw, 72px);
  --icon-arrow-up-right: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M7 7h10v10'/%3E%3C/svg%3E");
  font-family: Manrope, Arial, Helvetica, sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--background); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100dvh; color: var(--foreground); background: var(--background); transition: background-color 600ms ease; }
button, a { -webkit-tap-highlight-color: transparent; color: inherit; }
button { font: inherit; border: 0; padding: 0; background: none; cursor: pointer; }
a { text-decoration: none; }
button:focus, a:focus, #stage:focus { outline: none; }
:root[data-input-modality="keyboard"] :is(button, a, #stage):focus { outline: 2px solid var(--accent); outline-offset: 6px; }
button:active { transform: scale(.97); }
button:disabled { opacity: .42; cursor: default; }
::selection { background: var(--foreground); color: var(--background); }
.page-inset { padding-inline: var(--inset); max-width: 1600px; margin-inline: auto; }
.skip-link { position: fixed; z-index: 20; top: 10px; left: 20px; padding: 12px 18px; background: var(--foreground); color: var(--background); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.site-header { height: 104px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; }
.icon-arrow-up-right, .has-trailing-arrow::after {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask: var(--icon-arrow-up-right) center / contain no-repeat;
  mask: var(--icon-arrow-up-right) center / contain no-repeat;
}
.has-trailing-arrow::after { content: ""; }
.wordmark { display: inline-flex; align-items: center; justify-self: start; gap: 10px; font-size: 20px; font-weight: 700; letter-spacing: -.055em; white-space: nowrap; }
.wordmark-sign { filter: invert(1); display: inline-block; font: italic 700 36px/1 Arial, sans-serif; letter-spacing: -.22em; padding-right: 6px; transform: translateY(-1px); }
.header-nav { justify-self: end; font-size: 13px; }
.header-nav button { min-height: 44px; display: inline-flex; align-items: center; gap: 20px; }
.header-nav button span { font-size: 20px; transition: transform 180ms ease; }
.header-nav button:hover span { transform: translate(2px, -2px); }
.intro { text-align: center; }
.intro h1 { margin: 0; font-size: clamp(25px, 3vw, 40px); font-weight: 400; letter-spacing: -.06em; line-height: 1.18; }
.intro p { margin: 7px 0 0; font-size: 12px; line-height: 1.5; color: var(--secondary); }

#stage { position: relative; width: 100%; height: calc(100dvh - 250px); min-height: 360px; overflow: hidden; isolation: isolate; touch-action: pan-y; cursor: grab; outline-offset: -5px !important; }
#stage:active, #stage.is-dragging { cursor: grabbing; }
#webgl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#fallback { height: 100%; width: 100%; display: flex; align-items: center; gap: 28px; overflow-x: auto; overflow-y: hidden; padding: 18px max(22px, calc((100vw - 320px) / 2)); scroll-snap-type: x mandatory; }
#fallback .fallback-card { flex: 0 0 min(72vw, 320px); height: 94%; position: relative; overflow: hidden; border-radius: 6px; scroll-snap-align: center; }
#fallback img { display: block; width: 100%; height: 100%; object-fit: cover; }
#loading { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; align-content: center; gap: 18px; background: var(--background); color: var(--secondary); font-size: 12px; }
.loading-card { height: min(58dvh, 550px); max-height: 85%; aspect-ratio: 4 / 5; background: #1b1d21; border-radius: 8px; }
#drag-cursor { display: none; }

.gallery-footer { height: 146px; padding-top: 10px; padding-bottom: 22px; max-width: 1160px; }
.selected-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 24px; min-height: 88px; border-top: 1px solid var(--line); padding-top: 14px; }
.selected-info { min-width: 0; }
.selected-info h2 { margin: 0; font-size: clamp(32px, 3.5vw, 46px); font-weight: 400; letter-spacing: -.065em; line-height: 1.1; }
.selected-info p { margin: 7px 0 0; color: var(--secondary); font-size: 13px; line-height: 1.5; }
.gallery-actions { display: flex; align-items: center; gap: 34px; }
.open-city { display: inline-flex; align-items: center; justify-content: center; gap: 22px; padding: 0 0 2px; min-height: 44px; border-bottom: 1px solid var(--foreground); font-size: 13px; white-space: nowrap; }
.open-city span { font-size: 22px; line-height: 1; transition: transform 180ms ease; }
.open-city:hover span { transform: translate(3px, -3px); }
.navigation-controls { display: flex; align-items: center; gap: 8px; }
.counter { display: inline-flex; gap: 8px; margin-right: 12px; font-size: 12px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.counter-divider, #counter-total { color: var(--secondary); }
.arrow-button { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; font: 23px/1 Arial, sans-serif; transition: background 180ms ease, color 180ms ease, border-color 180ms ease; }
.arrow-button:hover { background: var(--foreground); color: var(--background); border-color: var(--foreground); }
#next { background: var(--foreground); border-color: var(--foreground); color: var(--background); }
#next:hover { background: #c5c7cb; border-color: #c5c7cb; }
#gallery-help { margin: 11px 0 0; text-align: center; color: var(--secondary); font-size: 11px; line-height: 1.6; }
#gallery-help span { padding-inline: 7px; }

dialog { padding: 0; border: 1px solid var(--line); color: var(--foreground); background: #141519; max-height: calc(100dvh - 48px); border-radius: 10px; overflow: auto; box-shadow: 0 26px 120px rgb(0 0 0 / .5); }
dialog::backdrop { background: rgb(0 0 0 / .8); backdrop-filter: blur(12px); }
.close-button { position: absolute; z-index: 2; top: 18px; right: 18px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: #1b1d21; border: 1px solid var(--line); font: 26px/1 Arial, sans-serif; color: var(--foreground); }
.close-button:hover { background: var(--foreground); border-color: var(--foreground); color: var(--background); }
/* A real photo mask separates the foreground from the recessed frame. */
.detail-dialog { width: min(1100px, calc(100vw - 40px)); max-height: calc(100dvh - 32px); background: transparent; border: 0; box-shadow: none; border-radius: 0; }
.detail-dialog[open] { display: grid; grid-template-columns: 1.4fr 1fr; align-items: center; gap: 12px; }
.detail-dialog::backdrop { background: rgb(246 245 242 / .94); backdrop-filter: blur(18px); }
.detail-dialog .close-button { position: absolute; z-index: 8; top: 8px; right: 8px; }
.detail-photo { min-height: 0; height: min(760px, calc(100dvh - 56px)); display: grid; place-items: center; perspective: 1100px; }
.breakout-scene { --frame-top: 23%; --tilt-x: 0deg; --tilt-y: 0deg; --drift-x: 0px; --drift-y: 0px; position: relative; width: min(100%, 480px, calc((100dvh - 170px) * .8)); aspect-ratio: 4 / 5; transform-style: preserve-3d; transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)); transition: transform 240ms ease-out; }
.breakout-frame { position: absolute; inset: 0; transform-origin: 50% 85%; transition: transform 950ms cubic-bezier(.18,.75,.2,1); filter: drop-shadow(12px 22px 18px rgb(32 27 28 / .17)); }
.breakout-frame img { display: block; position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; object-fit: contain; border-radius: 8px; }
#detail-plate { opacity: 0; }
.breakout-ground { position: absolute; width: 70%; height: 7%; left: 15%; bottom: 4%; background: #28222e; filter: blur(19px); opacity: 0; transform: scale(.6); transition: opacity 850ms, transform 850ms; }
.breakout-subject { position: absolute; inset: 0; opacity: 0; pointer-events: none; transform-origin: var(--subject-origin, 50% 92%); transform: translate3d(0,0,0) scale(1); transition: transform 1100ms cubic-bezier(.16,.8,.18,1), opacity 300ms ease; filter: drop-shadow(9px 18px 10px rgb(22 16 33 / .22)); mask-image: linear-gradient(#000 94%, transparent 100%); -webkit-mask-image: linear-gradient(#000 94%, transparent 100%); }
.breakout-subject img { display: block; width: 100%; height: 100%; object-fit: contain; mask-size: 100% 100%; mask-repeat: no-repeat; -webkit-mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; }
.has-depth .breakout-frame img { clip-path: inset(0 0 0 round 6px); border-radius: 0; transition: clip-path 1000ms cubic-bezier(.16,.8,.18,1); }
.is-revealed .breakout-frame img { clip-path: inset(var(--frame-top) 9% 7% round 6px); }
.has-depth .breakout-frame::after { content: ''; position: absolute; inset: 0; transition: inset 1000ms cubic-bezier(.16,.8,.18,1); border: 5px solid rgb(255 255 255 / .83); border-radius: 6px; pointer-events: none; }
.is-revealed .breakout-frame::after { inset: var(--frame-top) 9% 7%; }
.is-resetting .breakout-frame, .is-resetting .breakout-frame img, .is-resetting .breakout-frame::after, .is-resetting .breakout-subject, .is-resetting .breakout-ground { transition: none; }
.has-depth #detail-image { opacity: 0; }
.has-depth #detail-plate { opacity: 1; }
.has-depth .breakout-subject { opacity: 1; }
.is-revealed .breakout-frame { transform: perspective(1000px) rotateY(-13deg) rotateX(9deg) rotateZ(-3deg) scale(.96); }
.is-revealed .breakout-subject { transform: translate3d(var(--drift-x), calc(-16px + var(--drift-y)), 65px) scale(var(--subject-scale, 1.07)); }
.is-revealed .breakout-ground { opacity: .17; transform: scale(1); }
.detail-copy { padding: 64px 40px 42px 20px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.detail-time { margin: 0 0 16px; color: var(--accent); font: 11px/1.6 monospace; }
.detail-copy h2 { font-size: clamp(42px, 5.5vw, 78px); line-height: 1.08; letter-spacing: -.06em; font-weight: 400; margin: 0 0 24px; }
.detail-description { margin: 0; color: var(--secondary); font-size: 15px; line-height: 1.7; max-width: 32ch; }
.detail-replay { margin-top: 25px; min-height: 44px; display: inline-flex; align-items: center; gap: 18px; font-size: 13px; border-bottom: 1px solid #a8a49e; }
.detail-replay span { font-size: 23px; }
.detail-replay:hover { border-color: var(--foreground); }
.artwork-note { margin: 34px 0 0; font-size: 10px; letter-spacing: .03em; color: var(--secondary); line-height: 1.5; }
.about-dialog { width: min(590px, calc(100vw - 40px)); padding: 55px 50px 48px; }
.about-brand { color: var(--foreground) !important; font-size: 11px !important; letter-spacing: .1em; margin: 0 0 28px !important; }
.about-dialog h2 { font-size: clamp(36px, 4vw, 48px); font-weight: 700; letter-spacing: -.05em; line-height: 1.12; margin: 0 0 30px; }
.about-dialog p { color: var(--secondary); font-size: 14px; line-height: 1.75; margin: 0 0 20px; }
.about-dialog p:last-child { margin-bottom: 0; }
.credits-link { display: inline-flex; align-items: center; gap: 14px; margin-top: 10px; padding-block: 8px; font-size: 11px; border-bottom: 1px solid #aaa7a0; }
.credits-link:hover { border-color: var(--foreground); }
.noscript { padding: 20px var(--inset); color: var(--accent); line-height: 1.6; }

@media (max-width: 900px) {
  .site-header { gap: 18px; }
  .wordmark { font-size: 18px; }
  .intro h1 { font-size: 29px; }
  .intro p { font-size: 11px; }
  .selected-row { gap: 18px; }
  .gallery-actions { gap: 24px; }
  .detail-copy { padding-inline: 30px; }
}
@media (max-width: 600px) {
  :root { --inset: 24px; }
  .site-header { height: 138px; grid-template-columns: 1fr auto; grid-template-rows: 62px 76px; row-gap: 0; }
  .wordmark { font-size: 19px; }
  .wordmark-sign { font-size: 32px; }
  .header-nav { font-size: 12px; grid-column: 2; grid-row: 1; }
  .header-nav button { gap: 13px; }
  .intro { grid-column: 1 / -1; grid-row: 2; text-align: left; align-self: start; padding-top: 8px; }
  .intro h1 { font-size: 32px; }
  .intro p { font-size: 11px; margin-top: 5px; }
  #stage { height: calc(100dvh - 312px); min-height: 300px; }
  .gallery-footer { height: 174px; padding-top: 8px; padding-bottom: 38px; }
  .selected-row { grid-template-columns: 1fr auto; min-height: 98px; padding-top: 14px; }
  .selected-info h2 { font-size: 36px; }
  .selected-info p { max-width: 170px; font-size: 11px; margin-top: 6px; }
  .gallery-actions { flex-direction: column; align-items: flex-end; gap: 8px; }
  .open-city { min-height: 32px; font-size: 12px; gap: 16px; }
  .counter { font-size: 11px; gap: 5px; margin-right: 5px; }
  .navigation-controls { gap: 6px; }
  .arrow-button { width: 40px; height: 40px; font-size: 21px; }
  #gallery-help { font-size: 10px; margin-top: 14px; text-align: left; }
  #gallery-help span { padding-inline: 4px; }
  .close-button { top: 12px; right: 12px; width: 40px; height: 40px; }
  .about-dialog { padding: 54px 26px 32px; }
  .about-dialog h2 { font-size: 36px; }
  .about-dialog p { font-size: 13px; }
}
@media (max-width: 760px) {
  .detail-dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
  .detail-dialog[open] { display: block; }
  .detail-dialog .close-button { top: 4px; right: 4px; }
  .detail-photo { height: min(57dvh, 550px); min-height: 290px; padding-top: 48px; }
  .breakout-scene { width: min(87%, 390px, calc(47dvh * .8)); }
  .detail-copy { padding: 8px 28px 26px; }
  .detail-copy h2 { font-size: 42px; margin-bottom: 13px; }
  .detail-time { margin-bottom: 9px; font-size: 10px; }
  .detail-description { font-size: 13px; max-width: 42ch; }
  .detail-replay { margin-top: 12px; min-height: 40px; font-size: 12px; }
  .artwork-note { margin-top: 19px; }
}
@media (max-width: 380px) {
  :root { --inset: 20px; }
  .selected-info h2 { font-size: 30px; }
  .selected-info p { max-width: 140px; }
  .counter { margin-right: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
