:root {
  --bg: #f7f4ef;
  --paper: #fffbf7;
  --ink: #2c2722;
  --muted: #645b53;
  --line: #e8e2d9;
  --accent: #8b7355;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", Arial, sans-serif;
  color: #f5efe6;
  background: radial-gradient(circle at top, #2a2722 0%, #161412 58%, #0e0d0c 100%);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding: 18px 24px 10px;
  border-bottom: 1px solid rgba(240, 231, 217, 0.2);
  background: rgba(20, 18, 16, 0.94);
  backdrop-filter: blur(6px);
}

.brand h1 {
  margin: 0;
  font-family: "GFS Didot", serif;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.brand p {
  margin: 4px 0 0;
  color: #b8ae9f;
  font-size: 0.9rem;
}

.counter {
  font-size: 0.85rem;
  color: #d2c8ba;
}

.stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  padding: 0 0 16px;
  background: linear-gradient(180deg, rgba(40, 36, 31, 0.55) 0%, rgba(16, 15, 13, 0.62) 100%);
}

.gallery-rail {
  width: 100%;
  min-width: 0;
  position: relative;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(112, 102, 88, 0.18) 0%, rgba(34, 31, 28, 0.44) 46%, rgba(8, 8, 7, 0.82) 100%),
    linear-gradient(180deg, #1f1c19 0%, #10100f 100%);
  background-blend-mode: soft-light, normal;
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 220, 0.05),
    inset 0 -42px 80px rgba(0, 0, 0, 0.36);
  isolation: isolate;
}

.gallery-rail > * {
  position: relative;
  z-index: 1;
}

.gallery-rail::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 5px),
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0) 36%, rgba(0, 0, 0, 0.34) 82%, rgba(0, 0, 0, 0.62) 100%),
    linear-gradient(90deg, rgba(14, 13, 12, 0.78) 0%, rgba(14, 13, 12, 0) 22%, rgba(14, 13, 12, 0) 78%, rgba(14, 13, 12, 0.78) 100%);
}

.gallery-rail::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  mask-image: linear-gradient(90deg, #000 0%, transparent 30%, transparent 70%, #000 100%);
  -webkit-mask-image: linear-gradient(90deg, #000 0%, transparent 30%, transparent 70%, #000 100%);
}

.gallery-window {
  position: relative;
  z-index: 0;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.gallery-window::-webkit-scrollbar {
  display: none;
}

.gallery-strip {
  display: flex;
  align-items: flex-start;
  gap: var(--item-gap, 80px);
  padding: var(--rail-top-padding, 0px) var(--edge-pad, 0px) 14px;
  width: max-content;
  background:
    linear-gradient(180deg, rgba(22, 20, 18, 0.34) 0%, rgba(9, 9, 8, 0.72) 100%),
    var(--wall-bg-image, url("./assets/dusty-concrete-wall.jpg")) left top / var(--wall-bg-size, 1040px auto) var(--wall-bg-repeat, repeat-x);
  background-blend-mode: multiply, normal;
}

.slot {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 1;
  position: relative;
  z-index: 1;
  transition: filter 220ms ease, opacity 220ms ease, transform 220ms ease;
}

.slot.is-current {
  z-index: 2;
}

.artwork-wrap {
  width: var(--image-width, 420px);
  height: auto;
  overflow: visible;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.artwork-wrap img {
  width: var(--image-width, 420px);
  height: auto;
  max-height: none;
  object-fit: initial;
  filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.5));
  image-rendering: auto;
  transform: scale(1);
  transform-origin: center top;
  transition: transform 260ms ease, filter 260ms ease;
  will-change: transform;
}

.slot.is-current.is-zooming .artwork-wrap img {
  filter: drop-shadow(0 26px 48px rgba(0, 0, 0, 0.68));
  transform: translate3d(var(--zoom-pan-x, 0px), var(--zoom-pan-y, 0px), 0) scale(2);
}

.gallery-rail.is-zooming .slot:not(.is-current) {
  filter: blur(7px);
  opacity: 0.34;
}

.gallery-rail.is-zooming::before {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 5px),
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0.52) 72%, rgba(0, 0, 0, 0.76) 100%),
    linear-gradient(90deg, rgba(14, 13, 12, 0.88) 0%, rgba(14, 13, 12, 0) 28%, rgba(14, 13, 12, 0) 72%, rgba(14, 13, 12, 0.88) 100%);
}

.title-box {
  width: var(--image-width, 420px);
  margin-top: 12px;
  border: 1px solid rgba(224, 208, 182, 0.35);
  background: rgba(20, 18, 16, 0.8);
  border-radius: 10px;
  padding: 12px 14px;
  min-height: 92px;
  color: #f2e6d2;
}

.item-title {
  font-family: "GFS Didot", serif;
  font-size: clamp(1rem, 1.3vw, 1.35rem);
  text-align: center;
  margin-bottom: 8px;
}

.item-text {
  color: #d8cebf;
  font-size: 0.86rem;
  line-height: 1.45;
  max-height: 110px;
  overflow: auto;
}

.rich-text-box {
  border-top: 1px solid rgba(224, 208, 182, 0.22);
  padding-top: 8px;
}

.item-text p {
  margin: 0 0 8px;
}

.item-text strong,
.item-text b {
  color: #f4ead8;
  font-weight: 600;
}

.item-text em,
.item-text i {
  color: #eadcc4;
}

.item-text ul,
.item-text ol {
  margin: 0 0 8px 18px;
  padding: 0;
}

.item-text p:last-child {
  margin-bottom: 0;
}

.nav-btn {
  position: absolute;
  top: 50%;
  z-index: 5;
  transform: translateY(-50%);
  border: 1px solid rgba(224, 208, 182, 0.35);
  background: rgba(20, 18, 16, 0.8);
  color: #f2e6d2;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  font-size: 1.4rem;
  cursor: pointer;
}

.nav-btn.left {
  left: 18px;
}

.nav-btn.right {
  right: 18px;
}

.nav-btn:hover {
  border-color: #e0c89d;
}

.nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .stage {
    gap: 8px;
    padding: 10px;
  }
  .slot {
    padding: 4px 0 10px;
  }
  .artwork-wrap {
    height: auto;
  }
}
