:root {
  color-scheme: dark;
  --paper: #f3f1eb;
  --muted: rgba(243, 241, 235, 0.58);
  --faint: rgba(243, 241, 235, 0.18);
  --ink: #050505;
  --ease-cinematic: cubic-bezier(0.22, 1, 0.36, 1);
  --safe-top: max(26px, env(safe-area-inset-top));
  --safe-right: max(28px, env(safe-area-inset-right));
  --safe-bottom: max(26px, env(safe-area-inset-bottom));
  --safe-left: max(28px, env(safe-area-inset-left));
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
}

body,
button {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

button {
  color: inherit;
}

button:focus-visible {
  outline: 1px solid var(--paper);
  outline-offset: 5px;
}

.catalog,
.intro {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100svh;
  background: var(--ink);
}

.catalog {
  z-index: 1;
  opacity: 0;
  visibility: hidden;
  transition: opacity 900ms var(--ease-cinematic), visibility 0s linear 900ms;
}

.catalog.is-active,
.catalog-entered .catalog {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.gallery-stage,
.fallback-image,
.webgl-canvas,
.gallery-shade,
.intro-cover,
.intro-glow,
.film-grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.gallery-stage {
  overflow: hidden;
  background: #080808;
  cursor: grab;
  touch-action: pan-y;
}

.gallery-stage.is-dragging {
  cursor: grabbing;
}

.fallback-image,
.intro-cover {
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.fallback-image {
  z-index: 1;
  filter: saturate(0.86) contrast(1.04) brightness(0.78);
  transform: scale(1.025);
  transition: opacity 450ms ease, transform 1200ms var(--ease-cinematic), filter 600ms ease;
}

.fallback-image.is-changing {
  opacity: 0.1;
  transform: scale(1.075);
  filter: saturate(0.7) contrast(1.08) brightness(0.5);
}

.webgl-canvas {
  z-index: 2;
  display: block;
  opacity: 0;
  transition: opacity 650ms ease;
}

.webgl-ready .webgl-canvas {
  opacity: 1;
}

.webgl-ready .fallback-image {
  opacity: 0;
}

.gallery-shade {
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.52) 0%, transparent 25%, transparent 62%, rgba(0, 0, 0, 0.68) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.25), transparent 24%, transparent 76%, rgba(0, 0, 0, 0.22));
}

.film-grain {
  z-index: 4;
  overflow: hidden;
  opacity: 0.15;
  pointer-events: none;
  mix-blend-mode: soft-light;
}

.film-grain::before {
  content: "";
  position: absolute;
  inset: -60%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
  animation: grain 0.24s steps(2) infinite;
}

@keyframes grain {
  0% { transform: translate3d(0, 0, 0); }
  25% { transform: translate3d(3%, -4%, 0); }
  50% { transform: translate3d(-5%, 2%, 0); }
  75% { transform: translate3d(4%, 5%, 0); }
  100% { transform: translate3d(-2%, -3%, 0); }
}

.interface-layer {
  position: absolute;
  z-index: 6;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 700ms ease, transform 900ms var(--ease-cinematic);
}

.catalog-entered .interface-layer {
  opacity: 1;
  transform: translateY(0);
}

.catalog-header {
  top: var(--safe-top);
  right: var(--safe-right);
  left: var(--safe-left);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  transition-delay: 460ms;
}

.catalog-logo {
  width: clamp(144px, 15vw, 224px);
  height: auto;
  filter: invert(1);
}

.catalog-header-actions {
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 48px);
}

.render-status,
.catalog-kicker,
.catalog-hint,
.intro-edition,
.intro-caption,
.intro-location,
.intro-sound {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.render-status {
  display: flex;
  align-items: center;
  gap: 9px;
}

.render-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #8e8e8a;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06);
}

.webgl-ready .render-status-dot {
  background: #b7ff8a;
  box-shadow: 0 0 9px rgba(183, 255, 138, 0.75);
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(243, 241, 235, 0.25);
}

.language-option {
  min-width: 24px;
  padding: 4px 0;
  border: 0;
  color: rgba(243, 241, 235, 0.44);
  background: none;
  font-size: 10px;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: color 180ms ease;
}

.language-option:hover,
.language-option.is-active {
  color: var(--paper);
}

.catalog-meta {
  bottom: var(--safe-bottom);
  left: var(--safe-left);
  max-width: min(520px, 60vw);
  transition-delay: 590ms;
}

.catalog-kicker {
  margin-bottom: 14px;
}

.catalog-title {
  margin: 0 0 14px;
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 4.3vw, 70px);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.catalog-hint {
  color: rgba(243, 241, 235, 0.43);
}

.catalog-controls {
  right: var(--safe-right);
  bottom: var(--safe-bottom);
  display: flex;
  align-items: center;
  gap: 12px;
  transition-delay: 680ms;
}

.round-control {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(243, 241, 235, 0.3);
  border-radius: 50%;
  background: rgba(5, 5, 5, 0.08);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: color 220ms ease, border-color 220ms ease, background 220ms ease, transform 220ms ease;
}

.round-control:hover {
  color: var(--ink);
  border-color: var(--paper);
  background: var(--paper);
  transform: scale(1.04);
}

.round-control svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.25;
}

.fullscreen-control {
  margin-left: 8px;
}

.catalog-progress {
  display: flex;
  min-width: clamp(126px, 16vw, 214px);
  align-items: center;
  gap: 12px;
  margin: 0 8px;
  color: var(--paper);
  font-size: 10px;
  letter-spacing: 0.15em;
}

.total-index {
  color: var(--muted);
}

.progress-line {
  position: relative;
  flex: 1;
  height: 1px;
  overflow: hidden;
  background: rgba(243, 241, 235, 0.25);
}

.progress-line span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 14.2857%;
  background: var(--paper);
  transform-origin: left;
  transition: width 700ms var(--ease-cinematic);
}

.intro {
  z-index: 20;
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  transition: opacity 950ms var(--ease-cinematic), visibility 0s linear 950ms;
}

.intro.is-leaving,
.catalog-entered .intro {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-cover {
  z-index: 1;
  filter: brightness(0.62) contrast(1.12);
  transform: scale(1.035);
  transition: transform 1600ms var(--ease-cinematic), filter 1000ms ease;
}

.intro.is-leaving .intro-cover {
  filter: brightness(0.25) contrast(1.15);
  transform: scale(1.12);
}

.intro-glow {
  z-index: 2;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.06), transparent 35%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.28), transparent 35%, rgba(0, 0, 0, 0.4));
}

.intro .film-grain {
  z-index: 3;
}

.intro-header,
.intro-footer,
.intro-center {
  position: absolute;
  z-index: 5;
}

.intro-header {
  top: var(--safe-top);
  right: var(--safe-right);
  left: var(--safe-left);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.intro-center {
  top: 48%;
  left: 50%;
  width: min(530px, 72vw);
  text-align: center;
  transform: translate(-50%, -50%);
}

.intro-logo {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  filter: invert(1);
}

.intro-caption {
  margin-top: clamp(22px, 4vh, 42px);
  color: rgba(243, 241, 235, 0.48);
  font-size: 10px;
  letter-spacing: 0.38em;
}

.intro-footer {
  right: var(--safe-right);
  bottom: var(--safe-bottom);
  left: var(--safe-left);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.intro-sound {
  justify-self: end;
}

.enter-button {
  display: inline-flex;
  min-width: 180px;
  align-items: center;
  justify-content: center;
  gap: 17px;
  padding: 17px 22px;
  border: 1px solid rgba(243, 241, 235, 0.46);
  border-radius: 999px;
  color: var(--paper);
  background: rgba(5, 5, 5, 0.16);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 10px;
  letter-spacing: 0.25em;
  cursor: pointer;
  transition: color 300ms ease, background 300ms ease, border-color 300ms ease, transform 300ms var(--ease-cinematic);
}

.enter-button:hover {
  color: var(--ink);
  border-color: var(--paper);
  background: var(--paper);
  transform: translateY(-2px);
}

.enter-button-line {
  width: 28px;
  height: 1px;
  background: currentColor;
  transition: width 300ms var(--ease-cinematic);
}

.enter-button:hover .enter-button-line {
  width: 40px;
}

.enter-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.25;
}

@media (max-width: 760px) {
  :root {
    --safe-top: max(20px, env(safe-area-inset-top));
    --safe-right: max(18px, env(safe-area-inset-right));
    --safe-bottom: max(20px, env(safe-area-inset-bottom));
    --safe-left: max(18px, env(safe-area-inset-left));
  }

  .intro-edition,
  .intro-sound,
  .render-status,
  .catalog-hint {
    display: none;
  }

  .intro-header {
    justify-content: flex-end;
  }

  .intro-center {
    width: min(430px, 78vw);
  }

  .intro-footer {
    grid-template-columns: 1fr;
    justify-items: center;
    row-gap: 18px;
  }

  .intro-location {
    order: 2;
  }

  .enter-button {
    width: min(240px, 72vw);
  }

  .catalog-header-actions {
    gap: 14px;
  }

  .catalog-meta {
    right: var(--safe-right);
    bottom: 106px;
    max-width: none;
  }

  .catalog-title {
    max-width: 84vw;
    font-size: clamp(30px, 9vw, 48px);
  }

  .catalog-controls {
    right: var(--safe-right);
    left: var(--safe-left);
    justify-content: space-between;
  }

  .catalog-progress {
    min-width: 0;
    flex: 1;
  }

  .fullscreen-control {
    display: none;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .intro-caption,
  .intro-location,
  .catalog-hint,
  .catalog-kicker {
    display: none;
  }

  .catalog-meta {
    bottom: var(--safe-bottom);
  }

  .catalog-title {
    margin-bottom: 0;
    font-size: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.no-js .enter-button {
  display: none;
}
