:root {
  --ink: #1c1a16;
  --muted: #6f6a62;
  --canvas: #f2efea;
  --canvas-deep: #e6e1da;
  --accent: #2a7d8c;
  --react-rgb: 129, 152, 158;
  --shadow: rgba(25, 23, 20, 0.12);
  --max-width: 1100px;
}

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

body {
  margin: 0;
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #f4f0ea 0%, #ece7e0 45%, #e1dbd2 100%);
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 16% 18%, rgba(var(--react-rgb), 0.2) 0%, rgba(var(--react-rgb), 0) 52%),
    radial-gradient(circle at 85% 86%, rgba(var(--react-rgb), 0.13) 0%, rgba(var(--react-rgb), 0) 46%);
  opacity: 0.55;
  transition: background 0.7s ease, opacity 0.7s ease;
}

.intro-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.9), rgba(242, 238, 231, 0.96) 62%);
  z-index: 10;
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: none;
  isolation: isolate;
  overflow: hidden;
}

.intro-overlay::before,
.intro-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.intro-overlay::before {
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.2) 0 1px,
    rgba(255, 255, 255, 0.04) 1px 3px
  );
  opacity: 0.1;
  mix-blend-mode: soft-light;
}

.intro-overlay::after {
  inset: -25%;
  background: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0) 24%,
    rgba(255, 112, 128, 0.25) 33%,
    rgba(255, 255, 255, 0.8) 45%,
    rgba(255, 188, 106, 0.55) 52%,
    rgba(82, 210, 255, 0.2) 58%,
    rgba(255, 255, 255, 0) 70%
  );
  transform: translateX(-85%) rotate(1deg);
  opacity: 0;
  mix-blend-mode: screen;
}

.intro-title {
  display: grid;
  gap: 12px;
  text-align: center;
  font-family: "Fraunces", "Times New Roman", serif;
  color: var(--ink);
  letter-spacing: 0.04em;
  transform: translate3d(0, 0, 0);
  will-change: transform, opacity, filter;
}

.intro-name {
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  font-weight: 600;
  text-transform: lowercase;
}

.intro-tagline {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(0.95rem, 1.6vw, 1.2rem);
  color: var(--muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.intro-name,
.intro-tagline {
  position: relative;
  display: inline-block;
}

.intro-name::before,
.intro-name::after,
.intro-tagline::before,
.intro-tagline::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.intro-name::before,
.intro-tagline::before {
  color: rgba(255, 72, 110, 0.85);
  transform: translateX(-3px);
  mix-blend-mode: multiply;
}

.intro-name::after,
.intro-tagline::after {
  color: rgba(56, 212, 255, 0.85);
  transform: translateX(3px);
  mix-blend-mode: screen;
}

body.intro .gallery,
body.intro .meta {
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
}

body.intro .page {
  pointer-events: none;
}

body.intro-done .intro-overlay {
  animation: intro-card-out 1.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  pointer-events: none;
}

body.intro-done .intro-overlay::before {
  animation: intro-scanlines 1.55s linear forwards;
}

body.intro-done .intro-overlay::after {
  animation: intro-sweep 1.55s ease-out forwards;
}

body.intro-done .intro-title {
  animation: intro-title-glitch 1.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

body.intro-done .intro-name::before,
body.intro-done .intro-tagline::before {
  animation: intro-ghost-red 1.55s ease-out forwards;
}

body.intro-done .intro-name::after,
body.intro-done .intro-tagline::after {
  animation: intro-ghost-cyan 1.55s ease-out forwards;
}

body.intro-done .gallery,
body.intro-done .meta {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.65s ease, transform 0.65s ease;
  transition-delay: 0.35s;
}

@keyframes intro-card-out {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
    filter: none;
  }
  28% {
    opacity: 1;
    transform: translate(0, 0) scale(1.001);
  }
  40% {
    opacity: 1;
    transform: translate(-4px, 1px) scale(1.006);
  }
  52% {
    opacity: 0.96;
    transform: translate(5px, -2px) scale(1.01);
  }
  64% {
    opacity: 0.88;
    transform: translate(-7px, 2px) scale(1.015);
    filter: saturate(1.15);
  }
  76% {
    opacity: 0.72;
    transform: translate(8px, -3px) scale(1.022);
    filter: saturate(1.25) contrast(1.04);
  }
  88% {
    opacity: 0.48;
    transform: translate(-9px, 4px) scale(1.03);
    filter: blur(2.6px) saturate(1.35);
  }
  94% {
    opacity: 0.28;
    transform: translate(6px, -3px) scale(1.036);
    filter: blur(4.6px) saturate(1.4);
  }
  100% {
    opacity: 0;
    transform: translate(-3px, -10px) scale(1.04);
    filter: blur(7px) saturate(1.45);
    visibility: hidden;
  }
}

@keyframes intro-title-glitch {
  0% {
    opacity: 1;
    transform: translate(0, 0);
    filter: none;
  }
  24% {
    opacity: 1;
    transform: translate(0, 0);
  }
  34% {
    transform: translate(4px, -2px) skewX(-0.8deg);
  }
  42% {
    transform: translate(-5px, 2px) skewX(0.9deg);
  }
  54% {
    transform: translate(7px, -3px) skewX(-1.1deg);
  }
  66% {
    transform: translate(-6px, 3px) skewX(1.2deg);
  }
  78% {
    opacity: 0.9;
    transform: translate(5px, -2px) skewX(-0.6deg);
    filter: blur(0.5px);
  }
  90% {
    opacity: 0.56;
    transform: translate(-3px, 2px);
    filter: blur(1.8px);
  }
  100% {
    opacity: 0;
    transform: translate(0, -6px);
    filter: blur(3px);
  }
}

@keyframes intro-ghost-red {
  0% {
    opacity: 0;
    transform: translate(0, 0);
    clip-path: inset(0 0 0 0);
  }
  24% {
    opacity: 0.8;
    transform: translate(-10px, -2px);
    clip-path: inset(8% 0 58% 0);
  }
  40% {
    opacity: 0.62;
    transform: translate(-6px, 2px);
    clip-path: inset(40% 0 22% 0);
  }
  56% {
    opacity: 0.52;
    transform: translate(-12px, -3px);
    clip-path: inset(16% 0 62% 0);
  }
  72% {
    opacity: 0.34;
    transform: translate(-9px, 3px);
    clip-path: inset(64% 0 9% 0);
  }
  88% {
    opacity: 0.18;
    transform: translate(-5px, -1px);
    clip-path: inset(34% 0 36% 0);
  }
  100% {
    opacity: 0;
    transform: translate(0, 0);
    clip-path: inset(0 0 0 0);
  }
}

@keyframes intro-ghost-cyan {
  0% {
    opacity: 0;
    transform: translate(0, 0);
    clip-path: inset(0 0 0 0);
  }
  28% {
    opacity: 0.78;
    transform: translate(10px, 2px);
    clip-path: inset(14% 0 50% 0);
  }
  44% {
    opacity: 0.58;
    transform: translate(7px, -3px);
    clip-path: inset(48% 0 18% 0);
  }
  60% {
    opacity: 0.46;
    transform: translate(13px, 3px);
    clip-path: inset(20% 0 61% 0);
  }
  76% {
    opacity: 0.28;
    transform: translate(9px, -2px);
    clip-path: inset(66% 0 8% 0);
  }
  90% {
    opacity: 0.16;
    transform: translate(6px, 2px);
    clip-path: inset(36% 0 34% 0);
  }
  100% {
    opacity: 0;
    transform: translate(0, 0);
    clip-path: inset(0 0 0 0);
  }
}

@keyframes intro-sweep {
  0% {
    opacity: 0;
    transform: translateX(-85%) rotate(1deg);
  }
  24% {
    opacity: 0.35;
  }
  42% {
    opacity: 0.92;
  }
  62% {
    opacity: 0.62;
  }
  84% {
    opacity: 0.22;
  }
  100% {
    opacity: 0;
    transform: translateX(115%) rotate(1deg);
  }
}

@keyframes intro-scanlines {
  0% {
    opacity: 0.1;
  }
  26% {
    opacity: 0.2;
  }
  44% {
    opacity: 0.3;
  }
  62% {
    opacity: 0.16;
  }
  80% {
    opacity: 0.22;
  }
  100% {
    opacity: 0;
  }
}

.page {
  min-height: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  padding: calc(24px + env(safe-area-inset-top)) clamp(16px, 4vw, 48px) calc(32px + env(safe-area-inset-bottom));
  position: relative;
  z-index: 1;
}

.page::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0)),
    repeating-linear-gradient(135deg, rgba(0, 0, 0, 0.03) 0 1px, transparent 1px 6px);
  opacity: 0.4;
  pointer-events: none;
}

.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 16px;
}

.brand {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(1.1rem, 1rem + 0.6vw, 1.4rem);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.brand-name {
  font-weight: 600;
  font-size: 1.15em;
}

.brand-tagline {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-weight: 500;
  color: var(--muted);
  font-size: 0.76em;
}

.gallery {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(12px, 3vw, 28px);
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  touch-action: pan-y;
  height: 100%;
  min-height: 0;
}

.stage {
  --stage-pad-base: calc(clamp(18px, 3.2vw, 32px) * 1.25);
  --stage-pad: var(--stage-pad-base);
  position: relative;
  width: min(78vw, 900px);
  height: min(72vh, 720px);
  min-height: 0;
  margin: 0 auto;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.8)),
    rgba(var(--react-rgb), 0.09);
  border: 1px solid rgba(var(--react-rgb), 0.22);
  border-radius: 12px;
  box-shadow:
    0 28px 70px rgba(25, 23, 20, 0.12),
    0 0 0 1px rgba(var(--react-rgb), 0.07);
  transition: background 0.7s ease, border-color 0.7s ease, box-shadow 0.7s ease;
}

.stage[data-orientation="portrait"] {
  --stage-pad: calc(var(--stage-pad-base) * 1.08);
}

.stage[data-orientation="landscape"] {
  --stage-pad: calc(var(--stage-pad-base) * 0.92);
}

.stage[data-orientation="square"] {
  --stage-pad: var(--stage-pad-base);
}

.slide {
  position: absolute;
  inset: var(--stage-pad);
  margin: 0;
  opacity: 0;
  transform: none;
  transition: none;
  display: grid;
  place-items: center;
  align-content: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  overflow: hidden;
}

.slide.is-active {
  opacity: 1;
  transform: none;
}

.slide img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
  margin: 0 auto;
  border-radius: 6px;
  background: #fff;
}

.slide.is-portrait img {
  max-width: 96%;
  max-height: 96%;
}

.slide.is-landscape img {
  max-width: 100%;
  max-height: 100%;
}

.slide figcaption {
  font-size: 0.92rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.nav-button {
  width: clamp(40px, 6vw, 54px);
  height: clamp(40px, 6vw, 54px);
  border-radius: 999px;
  border: 1px solid rgba(28, 26, 22, 0.12);
  background: rgba(255, 255, 255, 0.85);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(30, 28, 25, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-mobile {
  display: none;
}

.nav-button svg {
  width: 22px;
  height: 22px;
  stroke: var(--ink);
  stroke-width: 2;
  fill: none;
}

.nav-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(30, 28, 25, 0.16);
}

.nav-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.meta {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.counter {
  font-weight: 600;
  color: var(--ink);
}

.empty {
  text-align: center;
  color: var(--muted);
  max-width: 420px;
}

.empty code {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  font-weight: 600;
}

@media (max-width: 900px) {
  .page {
    gap: 14px;
    padding: calc(12px + env(safe-area-inset-top)) 12px calc(88px + env(safe-area-inset-bottom));
  }

  .gallery {
    grid-template-columns: 1fr;
  }

  .nav-desktop {
    display: none;
  }

  .nav-mobile {
    display: grid;
    position: static;
    width: 42px;
    height: 42px;
    transform: none;
    box-shadow: 0 8px 18px rgba(30, 28, 25, 0.1);
  }

  .nav-mobile:hover {
    transform: scale(1.02);
  }

  .nav-mobile svg {
    width: 20px;
    height: 20px;
  }

  .stage {
    --stage-pad-base: calc(clamp(16px, 4vw, 24px) * 1.25);
    --stage-pad: var(--stage-pad-base);
    width: min(100%, 560px);
    height: min(100%, 560px);
    min-height: 0;
    border-radius: 10px;
  }

  .meta {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(14px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: auto auto auto;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 5;
    pointer-events: auto;
  }

  .counter {
    text-align: center;
    min-width: 68px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }

  .slide,
  .nav-button {
    transition: none !important;
  }

  body.intro .gallery,
  body.intro .meta {
    opacity: 1;
    transform: none;
  }

  .intro-overlay {
    transition: none;
  }

  body.intro-done .intro-overlay {
    animation: none;
    opacity: 0;
    visibility: hidden;
  }
  body.intro-done .intro-title {
    animation: none;
    opacity: 0;
  }
  body.intro-done .intro-overlay::before {
    animation: none;
    opacity: 0;
  }
  body.intro-done .intro-overlay::after {
    animation: none;
    opacity: 0;
  }
  body.intro-done .intro-name::before,
  body.intro-done .intro-name::after,
  body.intro-done .intro-tagline::before,
  body.intro-done .intro-tagline::after {
    animation: none;
    opacity: 0;
  }
}
