:root {
  --navy-900: #05060c;
  --navy-800: #0a0c16;
  --navy-700: #121524;
  --ink: #e9eefc;
  --ink-dim: #8e98b8;
  --accent: #7fb0e6;
  --accent-soft: #c2dcf5;
  --edge: rgba(150, 190, 240, 0.16);
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Space Grotesk", system-ui, -apple-system, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  background: var(--navy-900);
  color: var(--ink);
  font-family: var(--sans);
}
html {
  overflow-x: hidden;
}

/* Lenis smooth-scroll recommended styles */
html.lenis,
html.lenis body {
  height: auto;
}
.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}
.lenis.lenis-stopped {
  overflow: hidden;
}

body {
  /* Lenis sets up scrolling; we keep the real scroll on the html element. */
  /* Native cursor stays until the user clicks ENTER, then we swap to the custom one. */
  cursor: auto;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}
body.is-entered {
  cursor: none;
}

/* Hide the native cursor only on devices that have a precise pointer. */
@media (hover: none) {
  body,
  body.is-entered { cursor: auto; }
  .cursor { display: none; }
}

a,
button {
  font-family: inherit;
  color: inherit;
}

canvas#gl {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 0;
}

/* The scroll spacer is created in JS and gives the page its height. */
#scroll-spacer {
  position: relative;
  z-index: -1;
  pointer-events: none;
  width: 1px;
}

/* ---------- Grain + vignette ---------- */
.overlay-grain {
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  mix-blend-mode: soft-light;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}
.overlay-grain::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(125% 95% at 50% 42%, transparent 52%, rgba(2, 4, 9, 0.82) 100%);
  mix-blend-mode: normal;
}

/* ---------- Chrome / UI ---------- */
.chrome {
  position: fixed;
  z-index: 8;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: clamp(18px, 3vw, 38px);
  pointer-events: none;
  mix-blend-mode: screen;
}
.chrome--bottom {
  top: auto;
  bottom: 0;
  align-items: flex-end;
}

/* progressive-blur top bar (heaviest blur at the top, tapering to clear at the bottom) */
.chrome--top {
  mix-blend-mode: normal;
  padding-bottom: clamp(20px, 3vw, 34px);
}
.chrome__blur {
  position: absolute;
  inset: 0 0 -38px 0; /* extend below the bar so the blur dissolves into the page — no hard line */
  z-index: 0;
  pointer-events: none;
}
.chrome__blur > i {
  position: absolute;
  inset: 0;
  display: block;
}
.chrome__blur > i:nth-child(1) {
  -webkit-backdrop-filter: blur(2px) saturate(120%);
  backdrop-filter: blur(2px) saturate(120%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 70%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 70%, transparent 100%);
}
.chrome__blur > i:nth-child(2) {
  -webkit-backdrop-filter: blur(5px) saturate(120%);
  backdrop-filter: blur(5px) saturate(120%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 50%, transparent 80%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 50%, transparent 80%);
}
.chrome__blur > i:nth-child(3) {
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 32%, transparent 58%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 32%, transparent 58%);
}
.chrome__blur > i:nth-child(4) {
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 18%, transparent 42%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 18%, transparent 42%);
}
.chrome__blur::after {
  /* subtle dark tint over the blur for text legibility, fading out downward */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(8, 10, 18, 0.62) 0%,
    rgba(8, 10, 18, 0.32) 45%,
    rgba(8, 10, 18, 0) 100%
  );
}

.chrome__brand {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
}
.chrome__logo {
  height: clamp(20px, 2.8vw, 28px);
  width: auto;
  display: block;
  opacity: 0.96;
  filter: drop-shadow(0 0 10px rgba(127, 176, 230, 0.45));
}
.chrome__mark {
  font-size: 20px;
  color: var(--accent);
  animation: spin 14s linear infinite;
  filter: drop-shadow(0 0 10px rgba(127, 176, 230, 0.7));
  text-shadow: 0 0 2px rgba(200, 220, 255, 0.8);
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.chrome__title {
  font-size: 15px;
  letter-spacing: 0.42em;
  font-weight: 500;
}
.chrome__meta {
  position: relative;
  z-index: 2;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chrome__meta-line {
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.chrome__count { color: var(--accent-soft); }

.chrome__hint {
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.chrome__year {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.04em;
  color: var(--ink);
  opacity: 0.85;
}

/* ---------- Scroll progress ---------- */
.progress {
  position: fixed;
  z-index: 8;
  right: clamp(14px, 2vw, 26px);
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 26vh;
  background: var(--edge);
  border-radius: 2px;
  overflow: hidden;
}
.progress__bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: linear-gradient(var(--accent-soft), var(--accent));
  box-shadow: 0 0 14px rgba(127, 176, 230, 0.7);
}

/* ---------- Loader ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: var(--navy-900);
  transition: opacity 0.9s ease, visibility 0.9s ease;
}
.loader.is-done {
  opacity: 0;
  visibility: hidden;
}
.loader__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}
.loader__logo {
  height: clamp(52px, 12vw, 104px);
  width: auto;
  display: block;
  opacity: 0.97;
  filter: drop-shadow(0 0 22px rgba(127, 176, 230, 0.4));
}
/* progress + ENTER share one cell so they cross-fade in place (no layout shift) */
.loader__action {
  display: grid;
  min-height: 54px;
}
.loader__action > * {
  grid-area: 1 / 1;
  justify-self: center;
  align-self: center;
}
/* progress shown while assets load, then fades out as ENTER fades in */
.loader__progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition: opacity 0.5s ease;
}
.loader.is-ready .loader__progress {
  opacity: 0;
  pointer-events: none;
}
.loader__bar {
  width: clamp(160px, 30vw, 280px);
  height: 1px;
  background: var(--edge);
  position: relative;
  overflow: hidden;
}
.loader__fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: var(--accent-soft);
  box-shadow: 0 0 12px var(--accent);
}
.loader__pct {
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--ink-dim);
}
/* ENTER button — hidden until assets are ready, then it fades up over the progress */
.loader__enter {
  margin: 0;
  padding: 14px 46px;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  background: linear-gradient(
    to bottom,
    rgba(150, 190, 240, 0.12),
    rgba(150, 190, 240, 0.04)
  );
  border: 1px solid rgba(150, 190, 240, 0.35);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 8px 30px rgba(0, 0, 0, 0.35), 0 0 0 rgba(127, 176, 230, 0);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.6s ease 0.15s, transform 0.6s ease 0.15s,
    box-shadow 0.4s ease, border-color 0.4s ease, background 0.4s ease;
}
.loader.is-ready .loader__enter {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.loader__enter:hover {
  border-color: rgba(170, 205, 250, 0.7);
  background: linear-gradient(
    to bottom,
    rgba(150, 190, 240, 0.22),
    rgba(150, 190, 240, 0.08)
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 8px 30px rgba(0, 0, 0, 0.4), 0 0 26px rgba(127, 176, 230, 0.45);
  text-shadow: 0 0 12px rgba(200, 220, 255, 0.6);
}
.loader__enter:active {
  transform: translateY(1px) scale(0.99);
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 14;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 11, 0.62);
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
}
.lightbox__figure {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  max-width: min(86vw, 720px);
  will-change: transform, opacity;
}
.lightbox__img {
  max-width: 100%;
  max-height: 74vh;
  border-radius: 10px;
  display: block;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(190, 210, 250, 0.14),
    0 0 80px rgba(90, 140, 230, 0.22);
}
.lightbox__caption {
  /* out of flow so the IMAGE (not image+caption) is centered — keeps the ‹ › arrows
     aligned to the middle of the artwork */
  position: absolute;
  top: calc(100% + 18px);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.lightbox__cap-index {
  font-size: 11px;
  letter-spacing: 0.34em;
  color: var(--accent-soft);
}
.lightbox__cap-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(22px, 4vw, 34px);
  letter-spacing: 0.02em;
}
.lightbox__cap-meta {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.lightbox__close {
  position: absolute;
  z-index: 3;
  top: clamp(18px, 3vw, 34px);
  right: clamp(18px, 3vw, 34px);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--edge);
  border-radius: 100px;
  padding: 10px 18px;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: none;
  transition: background 0.3s, border-color 0.3s;
}
.lightbox__close:hover {
  background: rgba(127, 176, 230, 0.18);
  border-color: var(--accent);
}
.lightbox__nav {
  position: absolute;
  z-index: 3;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  font-size: 30px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--edge);
  border-radius: 50%;
  cursor: none;
  color: var(--ink);
  transition: background 0.3s, border-color 0.3s, transform 0.3s;
}
.lightbox__nav:hover {
  background: rgba(127, 176, 230, 0.2);
  border-color: var(--accent);
}
.lightbox__nav--prev { left: clamp(12px, 4vw, 48px); }
.lightbox__nav--next { right: clamp(12px, 4vw, 48px); }
@media (max-width: 720px) {
  .lightbox__nav { width: 44px; height: 44px; font-size: 22px; }
}

/* ---------- Custom cursor ---------- */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  pointer-events: none;
  transform: translate(-50%, -50%);
  mix-blend-mode: screen;
  opacity: 0; /* hidden until the user enters */
  transition: opacity 0.5s ease;
}
body.is-entered .cursor {
  opacity: 1;
}
.cursor__dot,
.cursor__ring {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.cursor__dot {
  width: 5px;
  height: 5px;
  background: var(--accent-soft);
}
.cursor__ring {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(170, 200, 245, 0.55);
  transition: width 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
    height 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.32s, border-color 0.32s;
}
.cursor.is-hover .cursor__ring {
  width: 64px;
  height: 64px;
  background: rgba(127, 176, 230, 0.12);
  border-color: var(--accent);
}
.cursor.is-down .cursor__ring {
  width: 22px;
  height: 22px;
}
.cursor__label {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0;
  transition: opacity 0.3s;
}
.cursor.is-hover .cursor__label { opacity: 0.9; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .chrome__mark { animation: none; }
}
