.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg);
}

.hero--css-bg {
  background:
    radial-gradient(65% 70% at 72% 42%, rgba(91, 67, 137, 0.2), transparent 64%),
    radial-gradient(52% 58% at 48% 74%, rgba(19, 91, 101, 0.18), transparent 68%),
    radial-gradient(46% 50% at 84% 16%, rgba(23, 60, 114, 0.22), transparent 70%),
    var(--bg);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(11, 11, 14, 0.84) 0%, rgba(11, 11, 14, 0.42) 25%, transparent 48%);
}

#heroBg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

body.no-webgl #heroBg,
body.reduced-motion #heroBg {
  display: none;
}

#heroRail {
  position: absolute;
  z-index: 10;
  top: 9%;
  bottom: 7%;
  left: 3%;
  width: clamp(260px, 22vw, 340px);
  display: flex;
  flex-direction: column;
  color: var(--ink);
}

.rail-brand {
  font-family: var(--cn);
  font-size: clamp(24px, 2.25vw, 38px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.rail-brand span {
  display: block;
  margin-top: 4px;
  font-family: var(--serif);
  font-size: 0.44em;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.09em;
  color: var(--ink-soft);
}

.rail-intro {
  max-width: 280px;
  margin: 18px 0 0;
  font-family: var(--serif);
  font-size: 13px;
  font-style: italic;
  line-height: 1.55;
  color: var(--ink-soft);
}

.rail-hr {
  width: 100%;
  height: 1px;
  margin: 24px 0 20px;
  border: 0;
  background: var(--line);
}

.rail-label {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.view-switch {
  display: grid;
  gap: 6px;
}

.view-switch button,
.cat-index button {
  min-height: 42px;
  border: 1px solid var(--line);
  background: rgba(20, 20, 25, 0.42);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}

.view-switch button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}

.view-switch button[aria-checked="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.view-switch button:focus-visible,
.cat-index button:focus-visible,
.hw-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.rail-label--archive {
  margin-top: 0;
}

.cat-index {
  display: grid;
  gap: 4px;
}

.cat-index button {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}

.cat-index button[aria-pressed="true"] {
  border-color: rgba(199, 162, 74, 0.72);
  color: var(--ink);
}

.cat-index__num,
.cat-index__count {
  color: var(--gold);
}

.rail-copy {
  margin: auto 0 0;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.7;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

#heroStage {
  position: absolute;
  z-index: 2;
  top: 10%;
  right: 3%;
  bottom: 21%;
  left: calc(6% + clamp(260px, 22vw, 340px));
  perspective: 1000px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

#heroStage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4000;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 62% 45%,
    rgba(11, 11, 14, 0) 30%,
    rgba(11, 11, 14, 0.55) 100%
  );
}

#heroDeck {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

#heroDeck.is-transitioning .hw-card {
  box-shadow: none !important;
}

#heroDeck.is-transitioning .hw-card::after {
  opacity: 0 !important;
  transition: none !important;
}

.hw-card {
  position: absolute;
  left: var(--x, 2%);
  top: var(--y, 34%);
  width: clamp(140px, 14vw, 220px);
  aspect-ratio: 3 / 4;
  padding: 0;
  overflow: hidden;
  transform: translateZ(var(--z, 0)) rotateY(-10deg) rotateZ(-0.3deg);
  transform-style: preserve-3d;
  backface-visibility: hidden;
  contain: layout paint;
  border: 1px solid rgba(238, 234, 225, 0.26);
  background: var(--surface);
  box-shadow: -8px 12px 22px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transition:
    scale 0.22s cubic-bezier(0.2, 0.7, 0.3, 1),
    translate 0.22s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.hw-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: rgba(11, 11, 14, 0.25);
  transition: opacity 0.25s ease;
}

.hw-card.is-focus::after,
.hw-card.is-prox-hot::after {
  opacity: 0;
}

#heroDeck.is-wall .hw-card,
#heroDeck.is-orbit .hw-card,
#heroDeck.is-gallery .hw-card {
  left: 0;
  top: 0;
}

#heroDeck.is-gallery .hw-card {
  aspect-ratio: 1;
}

#heroStage.is-gallery {
  overflow: auto;
  perspective: none;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
}

.hw-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hw-card:nth-child(1)  { --x: 2%;    --y: 34%;   --z: 0px; }
.hw-card:nth-child(2)  { --x: 6.9%;  --y: 31.4%; --z: -90px; }
.hw-card:nth-child(3)  { --x: 11.8%; --y: 28.8%; --z: -180px; }
.hw-card:nth-child(4)  { --x: 16.7%; --y: 26.2%; --z: -270px; }
.hw-card:nth-child(5)  { --x: 21.6%; --y: 23.6%; --z: -360px; }
.hw-card:nth-child(6)  { --x: 26.5%; --y: 21%;   --z: -450px; }
.hw-card:nth-child(7)  { --x: 31.4%; --y: 18.4%; --z: -540px; }
.hw-card:nth-child(8)  { --x: 36.3%; --y: 15.8%; --z: -630px; }
.hw-card:nth-child(9)  { --x: 41.2%; --y: 13.2%; --z: -720px; }
.hw-card:nth-child(10) { --x: 46.1%; --y: 10.6%; --z: -810px; }
.hw-card:nth-child(11) { --x: 51%;   --y: 8%;    --z: -900px; }
.hw-card:nth-child(12) { --x: 55.9%; --y: 5.4%;  --z: -990px; }

#heroMeta {
  position: absolute;
  z-index: 10;
  right: 3%;
  bottom: 7%;
  width: min(28%, 390px);
  text-align: right;
}

.hero-meta__title {
  display: block;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink);
}

.hero-meta__sub {
  margin: 0;
  font-family: var(--serif);
  font-size: 13px;
  font-style: italic;
  line-height: 1.5;
  color: var(--ink-soft);
}

.ns-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 0 32px;
  list-style: none;
}

.ns-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

@media (max-width: 1279px) {
  #heroStage {
    left: calc(5% + clamp(260px, 22vw, 340px));
  }

  .ns-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .hero {
    min-height: 100svh;
  }

  .hero::after {
    background: linear-gradient(180deg, rgba(11, 11, 14, 0.84), transparent 34%);
  }

  #heroRail {
    top: 60px;
    right: 0;
    bottom: auto;
    left: 0;
    width: auto;
    height: 56px;
    padding: 0 12px;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    background: rgba(11, 11, 14, 0.92);
    backdrop-filter: blur(12px);
  }

  .rail-brand {
    flex: 0 0 auto;
    font-size: 19px;
  }

  .rail-brand span,
  .rail-intro,
  .rail-hr,
  .rail-label,
  .rail-copy {
    display: none;
  }

  .view-switch {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    flex: 1;
    gap: 3px;
  }

  .view-switch button {
    min-height: 34px;
    justify-content: center;
    padding: 0 6px;
    font-size: 8px;
    letter-spacing: 0.04em;
  }

  .cat-index {
    position: absolute;
    top: 56px;
    left: 0;
    width: 100%;
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    overflow-x: auto;
    background: linear-gradient(180deg, rgba(11, 11, 14, 0.9), rgba(11, 11, 14, 0.25));
    scrollbar-width: none;
  }

  .cat-index::-webkit-scrollbar {
    display: none;
  }

  .cat-index button {
    flex: 0 0 auto;
    min-height: 32px;
    grid-template-columns: auto auto;
    padding: 0 10px;
    font-size: 9px;
  }

  .cat-index__count {
    display: none;
  }

  #heroStage {
    top: 164px;
    right: 3%;
    bottom: 19%;
    left: 3%;
  }

  .hw-card {
    width: clamp(112px, 32vw, 148px);
  }

  #heroMeta {
    right: 12px;
    bottom: 4%;
    width: min(76%, 310px);
  }

  .hero-meta__sub {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .ns-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.lb {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  place-items: center;
  gap: 18px;
  padding: 28px;
  background: rgba(5, 5, 7, 0.94);
  backdrop-filter: blur(16px);
}

.lb[hidden] {
  display: none;
}

.lb__figure {
  display: grid;
  place-items: center;
  gap: 12px;
  margin: 0;
}

.lb__img {
  display: block;
  max-width: min(82vw, 1500px);
  max-height: 86vh;
  object-fit: contain;
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.68);
}

.lb__close,
.lb__prev,
.lb__next {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(20, 20, 25, 0.8);
  color: var(--ink);
  font-size: 24px;
  cursor: pointer;
}

.lb__close {
  position: absolute;
  top: 22px;
  right: 22px;
}

.lb button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.lb__counter {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
}

body.lb-open {
  overflow: hidden;
}

@media (max-width: 767px) {
  .lb {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    gap: 6px;
    padding: 18px 8px;
  }

  .lb__img {
    max-width: calc(100vw - 100px);
    max-height: 82vh;
  }

  .lb__prev,
  .lb__next {
    width: 38px;
    height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hw-card,
  .view-switch button,
  .cat-index button,
  .lb {
    transition-duration: 0.2s !important;
  }
}
