/* ==========================================================================
   PHOTO ARCHIVE — INTERACTIVE 3D PHOTO ALBUM SHELF
   Editorial Japanese Minimalism · Physical Art Book Monograph System
   ========================================================================== */

:root {
  --paper: #EDEBE6;
  --sheet: #F4F2ED;
  --ink: #141414;
  --ink-soft: rgba(20, 20, 20, 0.72);
  --line: rgba(20, 20, 20, 0.14);
  --line-strong: rgba(20, 20, 20, 0.28);
  --muted: #6D6A63;
  --cobalt: #1F3FB0;
  --cobalt-dark: #162E85;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);

  --font-serif: "Newsreader", "Noto Serif SC", Georgia, serif;
  --font-sans: "Inter Tight", "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;

  /* Dynamic 3D Book Dimensions (updated by script.js on load/resize) */
  --book-h: 390px;
  --spine-w: 47px;
  --cover-w: 281px;
  --book-gap: 10px;
}

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

html,
body {
  width: 100%;
  height: 100%;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* Subtle SVG Paper Grain Texture */
.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

.paper-grain-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(20, 20, 20, 0.03) 1px, transparent 0),
    radial-gradient(rgba(109, 106, 99, 0.025) 1px, transparent 0);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  filter: url(#paper-grain);
  opacity: 0.85;
  mix-blend-mode: multiply;
}

/* ==========================================================================
   1. SINGLE-SCREEN SHELF LAYOUT
   ========================================================================== */

.shelf-app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  padding: clamp(18px, 2.6vh, 32px) clamp(20px, 3.8vw, 56px) clamp(14px, 2.2vh, 26px);
  overflow: hidden;
  z-index: 1;
}

/* Top 3-Column Navigation */
.top-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  width: 100%;
  z-index: 20;
}

.top-nav__left {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 6px 2px;
  transition: color 0.3s var(--ease), transform 0.3s var(--ease);
}

.nav-back__arrow {
  display: inline-block;
  font-size: 13px;
  transition: transform 0.3s var(--ease);
}

.nav-back:hover {
  color: var(--cobalt);
}

.nav-back:hover .nav-back__arrow {
  transform: translateX(-4px);
}

.top-nav__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 3px;
}

.brand-title {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink);
}

.brand-subtitle {
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 300;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
}

.top-nav__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  gap: 3px;
}

.collection-years {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
}

.collection-count {
  font-size: 9.5px;
  font-weight: 300;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ==========================================================================
   2. CATEGORY FILTER BAR
   ========================================================================== */

.category-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: clamp(10px, 1.8vh, 22px);
  z-index: 20;
}

.category-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  background: rgba(244, 242, 237, 0.45);
  padding: 2px;
}

.category-glider {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: 56px;
  background-color: var(--cobalt);
  transition:
    transform 0.48s var(--ease),
    width 0.48s var(--ease);
  pointer-events: none;
  z-index: 0;
}

.category-btn {
  position: relative;
  z-index: 1;
  appearance: none;
  border: none;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 7px 15px;
  cursor: pointer;
  transition: color 0.32s var(--ease);
  white-space: nowrap;
}

.category-btn:last-of-type {
  border-right: none;
}

.category-btn[aria-selected="true"] {
  color: var(--sheet);
}

.category-btn:not([aria-selected="true"]):hover {
  color: var(--cobalt);
}

.category-btn:focus-visible {
  outline: 1.5px solid var(--cobalt);
  outline-offset: -2px;
}

/* ==========================================================================
   3. CENTRAL 3D INTERACTIVE BOOKSHELF
   ========================================================================== */

.shelf-stage {
  position: relative;
  width: 100vw;
  margin-left: calc(-1 * clamp(20px, 3.8vw, 56px));
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  touch-action: pan-y;
}

/* Subtle architectural shelf horizon line */
.shelf-ambient-line {
  position: absolute;
  left: 4vw;
  right: 4vw;
  top: calc(50% + var(--book-h) * 0.5 + 16px);
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(20, 20, 20, 0.11) 15%,
    rgba(20, 20, 20, 0.18) 50%,
    rgba(20, 20, 20, 0.11) 85%,
    transparent 100%
  );
  pointer-events: none;
}

.shelf {
  position: relative;
  width: 100%;
  height: var(--book-h);
  perspective: 2200px;
  perspective-origin: 50% 46%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.shelf.is-dragging {
  cursor: grabbing;
}

.shelf-world {
  position: relative;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
}

/* Individual 3D Book Object */
.album {
  position: absolute;
  top: calc(-0.5 * var(--book-h));
  left: calc(-0.5 * var(--spine-w));
  width: var(--spine-w);
  height: var(--book-h);
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  will-change: transform;
  cursor: pointer;
}

.album-book {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}

/* Ground Shadow under each Book */
.album-shadow {
  position: absolute;
  left: var(--spine-w);
  bottom: -22px;
  width: var(--cover-w);
  height: 26px;
  background: radial-gradient(
    ellipse at center,
    rgba(20, 20, 20, 0.30) 0%,
    rgba(20, 20, 20, 0.12) 52%,
    rgba(20, 20, 20, 0) 76%
  );
  transform-origin: 0% 50%;
  transform: rotateY(90deg);
  filter: blur(9px);
  opacity: 0;
  pointer-events: none;
}

/* ==========================================================================
   3A. BOOK SPINE (.album-spine)
   ========================================================================== */

.album-spine {
  position: absolute;
  inset: 0;
  width: var(--spine-w);
  height: var(--book-h);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background-color: var(--spine-bg, #243D63);
  color: var(--spine-fg, #F4F2ED);
  border-radius: 2px 1px 1px 2px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px;
  box-shadow:
    inset 3px 0 6px rgba(255, 255, 255, 0.16),
    inset -3px 0 7px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 10px 22px rgba(20, 20, 20, 0.16);
}

/* Cloth / Linen Binding Weave & Crease Grooves on Spine */
.album-spine::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.03) 0px,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px,
      transparent 3px
    ),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.14) 0%,
      transparent 14%,
      transparent 82%,
      rgba(0, 0, 0, 0.28) 100%
    );
  pointer-events: none;
}

/* Top & Bottom Embossed Bookbinder Bands */
.album-spine::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 42px;
  bottom: 44px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  pointer-events: none;
}

.spine-vol {
  position: relative;
  z-index: 1;
  font-family: var(--font-sans);
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  opacity: 0.78;
  text-transform: uppercase;
}

.spine-title-wrap {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  padding: 12px 0;
  overflow: hidden;
}

.spine-title-en {
  font-family: var(--font-serif);
  font-size: clamp(11px, 1.35vh, 14px);
  font-weight: 400;
  letter-spacing: 0.09em;
  white-space: nowrap;
  color: inherit;
}

.spine-title-zh {
  font-family: "Noto Serif SC", serif;
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 0.18em;
  opacity: 0.72;
  white-space: nowrap;
}

.spine-year {
  position: relative;
  z-index: 1;
  font-family: var(--font-sans);
  font-size: 8.5px;
  font-weight: 400;
  letter-spacing: 0.14em;
  opacity: 0.8;
  padding-top: 3px;
}

/* ==========================================================================
   3B. FRONT COVER (.album-cover) & 3D PAGE BLOCK
   ========================================================================== */

/* Hinged at the right edge of the spine (x = var(--spine-w)), rotated +90deg into depth */
.album-cover {
  position: absolute;
  top: 0;
  left: var(--spine-w);
  width: var(--cover-w);
  height: var(--book-h);
  transform-origin: 0% 50%;
  transform: rotateY(90deg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background-color: var(--cover-bg, #F4F2ED);
  color: var(--cover-fg, #141414);
  border-radius: 1px 3px 3px 1px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow:
    inset 8px 0 14px rgba(0, 0, 0, 0.14),
    inset 1px 0 0 rgba(255, 255, 255, 0.35),
    inset 0 0 0 1px rgba(20, 20, 20, 0.12);
}

/* Physical Bookbinding Hinge Crease on Left Edge of Front Cover */
.cover-hinge {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 16px;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.22) 0%,
    rgba(255, 255, 255, 0.16) 35%,
    rgba(0, 0, 0, 0.15) 68%,
    rgba(255, 255, 255, 0.08) 85%,
    transparent 100%
  );
  z-index: 6;
  pointer-events: none;
}

/* Fine Linen / Art Paper Texture & Specular Glaze on Cover */
.cover-glaze {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      125deg,
      rgba(255, 255, 255, 0.22) 0%,
      rgba(255, 255, 255, 0.04) 38%,
      rgba(0, 0, 0, 0.06) 72%,
      rgba(0, 0, 0, 0.18) 100%
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.018) 0px,
      rgba(255, 255, 255, 0.018) 1px,
      transparent 1px,
      transparent 3px
    );
  z-index: 5;
  pointer-events: none;
}

/* Cover Layout Variant 1: Classic Editorial Monograph (Paper Frame + Inset Plate) */
.album-cover--editorial {
  padding: 16px 16px 14px 22px;
  background: #F3F0E8;
  color: #141414;
}

/* Cover Layout Variant 2: Clothbound Art Edition (Tinted Cloth + Inset Plate) */
.album-cover--cloth {
  padding: 16px 16px 14px 22px;
  background: var(--spine-bg, #243D63);
  color: #F4F2ED;
}

/* Cover Layout Variant 3: Full-Bleed Cinema Plate with Archival Band */
.album-cover--bleed {
  padding: 0;
  background: #141414;
  color: #F4F2ED;
}

.cover-header {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-sans);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.78;
  padding-bottom: 8px;
  border-bottom: 1px solid currentColor;
}

.album-cover--bleed .cover-header {
  padding: 14px 16px 10px 22px;
  background: linear-gradient(180deg, rgba(12, 12, 12, 0.72) 0%, transparent 100%);
  border-bottom: none;
}

.cover-title-block {
  position: relative;
  z-index: 3;
  padding: 9px 0 8px;
}

.album-cover--bleed .cover-title-block {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 36px 16px 14px 22px;
  background: linear-gradient(0deg, rgba(10, 10, 10, 0.88) 0%, rgba(10, 10, 10, 0.48) 62%, transparent 100%);
}

.cover-title {
  font-family: var(--font-serif);
  font-size: clamp(15px, 2vh, 21px);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.cover-subtitle {
  display: block;
  margin-top: 4px;
  font-family: "Noto Serif SC", var(--font-sans);
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 0.14em;
  opacity: 0.78;
}

.cover-photo-frame {
  position: relative;
  z-index: 2;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: calc(var(--book-h) - 118px);
  margin: auto 0;
  overflow: hidden;
  background: #EAE6DC;
  box-shadow: inset 0 0 0 1px rgba(20, 20, 20, 0.12);
}

.album-cover--bleed .cover-photo-frame {
  position: absolute;
  inset: 0;
  height: 100%;
}

.cover-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  filter: contrast(1.03) saturate(0.97);
  transition: transform 0.7s var(--ease);
}

.album.is-active:hover .cover-photo {
  transform: scale(1.035);
}

.cover-footer {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  font-family: var(--font-sans);
  font-size: 7.5px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.72;
}

.album-cover--bleed .cover-footer {
  display: none;
}

/* 3D Back Cover & Cream Paper Fore-Edge Block */
.album-back {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--cover-w);
  height: var(--book-h);
  transform-origin: 0% 50%;
  transform: rotateY(90deg);
  background-color: var(--spine-bg, #243D63);
  filter: brightness(0.76);
  border-radius: 1px 3px 3px 1px;
  pointer-events: none;
}

.album-pages {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: calc(var(--spine-w) - 3px);
  transform-origin: 0% 50%;
  transform: translate3d(var(--spine-w), 0, calc(-1 * var(--cover-w) + 2px)) rotateY(180deg);
  background:
    repeating-linear-gradient(
      90deg,
      #ECE8DF 0px,
      #ECE8DF 2px,
      #DCD6C8 2px,
      #DCD6C8 3px
    );
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

/* ==========================================================================
   4. BELOW-SHELF INFORMATION AREA & ARROWS
   ========================================================================== */

.shelf-caption {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 5vw, 72px);
  margin-top: clamp(4px, 1vh, 12px);
  z-index: 20;
}

.shelf-arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background-color 0.3s var(--ease),
    border-color 0.3s var(--ease),
    color 0.3s var(--ease),
    transform 0.3s var(--ease);
}

.shelf-arrow:hover {
  background-color: var(--cobalt);
  border-color: var(--cobalt);
  color: var(--sheet);
  transform: scale(1.06);
}

.shelf-arrow:active {
  transform: scale(0.96);
}

.caption-center {
  min-width: min(440px, 68vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.info-mask {
  overflow: hidden;
  width: 100%;
  display: flex;
  justify-content: center;
}

.info-mask--title {
  padding: 2px 0;
}

.info-line {
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  will-change: transform;
}

.info-title {
  font-family: var(--font-serif);
  font-size: clamp(24px, 3.2vw, 38px);
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: -0.015em;
  color: var(--ink);
  will-change: transform;
}

.info-location {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cobalt);
  margin-top: 2px;
  will-change: transform;
}

.info-meta {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  will-change: transform;
}

.shelf-hint {
  text-align: center;
  margin-top: 8px;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.68;
  pointer-events: none;
}

/* ==========================================================================
   5. PAPER EXPANSION SHEET & CINEMATIC PHOTOGRAPHY GALLERY
   ========================================================================== */

.paper-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  background-color: var(--sheet);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.45) 0%, rgba(237, 235, 230, 0.3) 100%);
  box-shadow: 0 30px 90px rgba(20, 20, 20, 0.28);
  pointer-events: none;
  opacity: 0;
  clip-path: inset(50% 50% 50% 50% round 6px);
  will-change: clip-path, opacity;
}

.paper-sheet.is-active {
  opacity: 1;
}

.gallery-overlay {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  flex-direction: column;
  background: transparent;
  color: var(--ink);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s var(--ease), visibility 0.35s var(--ease);
}

.gallery-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Sticky Top Bar inside Gallery */
.gallery-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 18px clamp(20px, 4vw, 56px);
  background: rgba(244, 242, 237, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.gallery-back-btn {
  justify-self: start;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 0;
  transition: color 0.25s var(--ease);
}

.gallery-back-btn__arrow {
  transition: transform 0.25s var(--ease);
}

.gallery-back-btn:hover {
  color: var(--cobalt);
}

.gallery-back-btn:hover .gallery-back-btn__arrow {
  transform: translateX(-4px);
}

.gallery-topbar__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}

.gallery-topbar__title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 400;
  color: var(--ink);
}

.gallery-topbar__sub {
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cobalt);
}

.gallery-topbar__right {
  justify-self: end;
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Gallery Scroll Viewport */
.gallery-scroller {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.gallery-article {
  max-width: 1440px;
  margin: 0 auto;
  padding: clamp(28px, 5vh, 64px) clamp(20px, 4.5vw, 72px) 120px;
}

/* Gallery Hero Section */
.gallery-hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(28px, 4.5vw, 64px);
  align-items: end;
  margin-bottom: clamp(48px, 8vh, 96px);
}

.gallery-hero__title-col {
  padding-bottom: 12px;
}

.gallery-mask {
  overflow: hidden;
  display: block;
}

.gallery-mask__inner {
  display: block;
  transform: translateY(108%);
  transition: transform 0.78s var(--ease-out-expo);
}

.gallery-overlay.is-revealed .gallery-mask__inner {
  transform: translateY(0%);
}

.gallery-eyebrow {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--cobalt);
  margin-bottom: 14px;
}

.gallery-main-title {
  font-family: var(--font-serif);
  font-size: clamp(36px, 5.2vw, 72px);
  font-weight: 300;
  line-height: 1.04;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.gallery-sub-zh {
  font-family: "Noto Serif SC", var(--font-serif);
  font-size: clamp(18px, 2.1vw, 26px);
  font-weight: 400;
  color: var(--muted);
  margin-top: 12px;
  letter-spacing: 0.08em;
}

.gallery-hero__meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line-strong);
}

.meta-cell__label {
  display: block;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.meta-cell__val {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--ink);
}

/* Hero Cover Frame with Ken Burns + Parallax */
.gallery-hero-plate {
  position: relative;
  width: 100%;
  height: min(76vh, 760px);
  overflow: hidden;
  background: #1B1B1B;
  margin-bottom: clamp(56px, 10vh, 110px);
  cursor: pointer;
  clip-path: inset(100% 0 0 0);
  transition: clip-path 0.95s var(--ease-out-expo);
}

.gallery-overlay.is-revealed .gallery-hero-plate {
  clip-path: inset(0% 0 0 0);
}

.gallery-hero-plate__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.08);
  animation: kenBurnsHero 18s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes kenBurnsHero {
  0% {
    transform: scale(1.08) translate3d(0, 12px, 0);
  }
  100% {
    transform: scale(1.01) translate3d(-10px, -12px, 0);
  }
}

.gallery-hero-plate__badge {
  position: absolute;
  left: 24px;
  bottom: 24px;
  background: rgba(244, 242, 237, 0.92);
  color: var(--ink);
  padding: 10px 16px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
}

/* Editorial Story / Field Notes Intro */
.gallery-intro {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: clamp(24px, 5vw, 80px);
  padding: clamp(24px, 4vh, 48px) 0 clamp(64px, 11vh, 128px);
  border-top: 1px solid var(--line-strong);
}

.gallery-intro__kicker {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--cobalt);
  line-height: 1.8;
}

.gallery-intro__body {
  max-width: 760px;
}

.gallery-intro__en {
  font-family: var(--font-serif);
  font-size: clamp(21px, 2.3vw, 30px);
  font-weight: 300;
  line-height: 1.48;
  color: var(--ink);
  margin-bottom: 20px;
}

.gallery-intro__zh {
  font-family: "Noto Serif SC", var(--font-sans);
  font-size: clamp(15px, 1.35vw, 18px);
  font-weight: 400;
  line-height: 1.85;
  color: var(--muted);
}

/* ==========================================================================
   6. EDITORIAL PHOTO SPREADS (ASYMMETRIC / FULL-BLEED / PORTRAIT / 2-COL)
   ========================================================================== */

.gallery-spreads {
  display: flex;
  flex-direction: column;
  gap: clamp(72px, 13vh, 150px);
}

.photo-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.photo-frame {
  position: relative;
  overflow: hidden;
  background: #DFDCD4;
  cursor: pointer;
}

.photo-frame__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  will-change: transform;
  transition: filter 0.45s var(--ease);
}

.photo-frame:hover .photo-frame__img {
  filter: contrast(1.04) brightness(1.02);
}

/* 4 Distinct Viewport Reveal Animations */
.photo-frame[data-reveal="clip-up"] {
  clip-path: inset(100% 0 0 0);
  transition: clip-path 1.05s var(--ease-out-expo);
}
.photo-frame[data-reveal="clip-up"].is-inview {
  clip-path: inset(0% 0 0 0);
}

.photo-frame[data-reveal="mask-slide"] {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 1.08s var(--ease-out-expo);
}
.photo-frame[data-reveal="mask-slide"].is-inview {
  clip-path: inset(0 0% 0 0);
}

.photo-frame[data-reveal="vertical-wipe"] {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.05s var(--ease-out-expo);
}
.photo-frame[data-reveal="vertical-wipe"].is-inview {
  clip-path: inset(0 0 0% 0);
}

.photo-frame[data-reveal="scale-reveal"] {
  clip-path: inset(12% 12% 12% 12%);
  opacity: 0.01;
  transition:
    clip-path 1.1s var(--ease-out-expo),
    opacity 0.75s var(--ease);
}
.photo-frame[data-reveal="scale-reveal"].is-inview {
  clip-path: inset(0% 0% 0% 0%);
  opacity: 1;
}

.photo-caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  will-change: transform;
}

.photo-caption__num {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--cobalt);
  text-transform: uppercase;
  white-space: nowrap;
}

.photo-caption__text {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
}

.photo-caption__title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 400;
  color: var(--ink);
}

.photo-caption__desc {
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}

/* Spread Layout 1: Asymmetric Two-Column Composition */
.spread--asymmetric {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}

.spread--asymmetric .photo-card--primary .photo-frame {
  aspect-ratio: 4 / 4.4;
}

.spread--asymmetric .photo-card--secondary {
  margin-top: clamp(48px, 11vh, 130px);
}

.spread--asymmetric .photo-card--secondary .photo-frame {
  aspect-ratio: 4 / 3.2;
}

.spread-quote {
  margin-top: 36px;
  padding: 22px 0 0;
  border-top: 1px solid var(--line-strong);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(19px, 1.9vw, 25px);
  line-height: 1.45;
  color: var(--ink);
}

.spread-quote__cite {
  display: block;
  margin-top: 10px;
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cobalt);
}

/* Spread Layout 2: Full-Bleed Cinema Landscape */
.spread--bleed {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding: 0 clamp(20px, 4.5vw, 72px);
}

.spread--bleed .photo-frame {
  width: 100%;
  height: min(74vh, 720px);
}

/* Spread Layout 3: Large Vertical Portrait + Editorial Side Note */
.spread--portrait {
  display: grid;
  grid-template-columns: 4fr 8fr;
  gap: clamp(28px, 5vw, 76px);
  align-items: center;
}

.spread--portrait__note {
  border-top: 1px solid var(--line-strong);
  padding-top: 20px;
}

.spread--portrait__note-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cobalt);
  margin-bottom: 12px;
}

.spread--portrait__note-text {
  font-family: var(--font-serif);
  font-size: clamp(18px, 1.7vw, 23px);
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 14px;
}

.spread--portrait__note-zh {
  font-family: "Noto Serif SC", var(--font-sans);
  font-size: 14px;
  line-height: 1.8;
  color: var(--muted);
}

.spread--portrait .photo-frame {
  aspect-ratio: 4 / 3.4;
}

/* Spread Layout 4: Editorial Pair (Balanced Diptych) */
.spread--diptych {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 3.8vw, 52px);
  align-items: start;
}

.spread--diptych .photo-frame {
  aspect-ratio: 4 / 3.4;
}

/* Gallery Footer & Return to Shelf CTA */
.gallery-footer {
  margin-top: clamp(80px, 14vh, 150px);
  padding-top: 48px;
  border-top: 1px solid var(--line-strong);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.gallery-return-cta {
  appearance: none;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--sheet);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  padding: 16px 32px;
  cursor: pointer;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.gallery-return-cta:hover {
  background: var(--cobalt);
  border-color: var(--cobalt);
}

.gallery-next-book {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 16px 28px;
  cursor: pointer;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}

.gallery-next-book:hover {
  border-color: var(--cobalt);
  color: var(--cobalt);
}

/* ==========================================================================
   7. PHOTO LIGHTBOX (FULLSCREEN VIEWER)
   ========================================================================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  grid-template-rows: auto 1fr auto;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.38s var(--ease), visibility 0.38s var(--ease);
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 18, 17, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 0;
}

.lightbox__header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px clamp(20px, 4vw, 56px);
  color: #F4F2ED;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.lightbox__album-tag {
  color: rgba(244, 242, 237, 0.65);
}

.lightbox__close {
  appearance: none;
  border: 1px solid rgba(244, 242, 237, 0.24);
  background: transparent;
  color: #F4F2ED;
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.lightbox__close:hover {
  background: var(--cobalt);
  border-color: var(--cobalt);
}

.lightbox__stage {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(12px, 2.5vw, 36px);
  padding: 0 clamp(16px, 3.5vw, 48px);
  min-height: 0;
}

.lightbox__viewport {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: 74vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lightbox__img {
  max-width: 100%;
  max-height: 74vh;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  will-change: transform, opacity, clip-path;
}

.lightbox__img--next {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.lightbox__nav {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(244, 242, 237, 0.25);
  background: rgba(255, 255, 255, 0.03);
  color: #F4F2ED;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.28s var(--ease), border-color 0.28s var(--ease), transform 0.28s var(--ease);
}

.lightbox__nav:hover {
  background: var(--cobalt);
  border-color: var(--cobalt);
  transform: scale(1.06);
}

.lightbox__footer {
  position: relative;
  z-index: 2;
  padding: 18px clamp(20px, 4vw, 56px) 28px;
  text-align: center;
  color: #F4F2ED;
}

.lightbox__title {
  font-family: var(--font-serif);
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: 400;
  margin-bottom: 4px;
}

.lightbox__desc {
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: rgba(244, 242, 237, 0.68);
}

/* ==========================================================================
   8. CUSTOM CURSOR (DESKTOP HOVER ONLY)
   ========================================================================== */

.custom-cursor {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .custom-cursor {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 58px;
    height: 58px;
    margin-left: -29px;
    margin-top: -29px;
    pointer-events: none;
    z-index: 999;
    will-change: transform;
  }

  .custom-cursor__ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid rgba(20, 20, 20, 0.42);
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
      transform 0.34s var(--ease),
      background-color 0.34s var(--ease),
      border-color 0.34s var(--ease);
  }

  .custom-cursor__dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--ink);
    transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
  }

  .custom-cursor__label {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #F4F2ED;
    opacity: 0;
    transform: scale(0.75);
    transition: opacity 0.28s var(--ease), transform 0.28s var(--ease);
    line-height: 1.15;
  }

  .custom-cursor__label-en {
    font-family: var(--font-sans);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
  }

  .custom-cursor__label-zh {
    font-family: "Noto Sans SC", var(--font-sans);
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 0.14em;
    opacity: 0.88;
  }

  /* State: Hovering a Book Spine */
  .custom-cursor.is-spine .custom-cursor__ring {
    transform: scale(0.58);
    border-color: var(--cobalt);
    background-color: rgba(31, 63, 176, 0.08);
  }

  /* State: Hovering Center Open Cover */
  .custom-cursor.is-cover .custom-cursor__ring {
    transform: scale(1.48);
    background-color: var(--cobalt);
    border-color: var(--cobalt);
    box-shadow: 0 12px 30px rgba(31, 63, 176, 0.34);
  }

  .custom-cursor.is-cover .custom-cursor__dot {
    opacity: 0;
    transform: scale(0);
  }

  .custom-cursor.is-cover .custom-cursor__label {
    opacity: 1;
    transform: scale(0.68);
  }

  /* State: Hovering Gallery Photo */
  .custom-cursor.is-photo .custom-cursor__ring {
    transform: scale(1.36);
    background-color: rgba(20, 20, 20, 0.9);
    border-color: rgba(20, 20, 20, 0.9);
  }

  .custom-cursor.is-photo .custom-cursor__dot {
    opacity: 0;
    transform: scale(0);
  }

  .custom-cursor.is-photo .custom-cursor__label {
    opacity: 1;
    transform: scale(0.72);
  }

  /* State: Hovering UI Button/Link */
  .custom-cursor.is-link .custom-cursor__ring {
    transform: scale(0.72);
    border-color: var(--cobalt);
  }
}

/* ==========================================================================
   9. RESPONSIVE DESIGN (TABLET & MOBILE)
   ========================================================================== */

@media (max-width: 960px) {
  .gallery-hero {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .gallery-intro {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .spread--asymmetric,
  .spread--portrait,
  .spread--diptych {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .spread--asymmetric .photo-card--secondary {
    margin-top: 0;
  }
}

@media (max-width: 680px) {
  .shelf-app {
    padding: 14px 14px 16px;
  }

  .top-nav {
    grid-template-columns: auto 1fr auto;
    gap: 8px;
  }

  .brand-subtitle,
  .collection-count {
    display: none;
  }

  .brand-title,
  .collection-years,
  .nav-back {
    font-size: 9.5px;
    letter-spacing: 0.16em;
  }

  .category-track {
    max-width: 94vw;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .category-track::-webkit-scrollbar {
    display: none;
  }

  .category-btn {
    padding: 6px 10px;
    font-size: 9px;
    letter-spacing: 0.16em;
  }

  .shelf-caption {
    gap: 12px;
  }

  .caption-center {
    min-width: 0;
    flex: 1;
  }

  .shelf-arrow {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
  }

  .gallery-topbar {
    grid-template-columns: auto 1fr;
    padding: 14px 16px;
  }

  .gallery-topbar__right {
    display: none;
  }

  .gallery-topbar__center {
    align-items: flex-end;
    text-align: right;
  }

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

  .lightbox__nav {
    position: absolute;
    bottom: -8px;
    z-index: 5;
    width: 40px;
    height: 40px;
  }

  .lightbox__nav--prev {
    left: 20px;
  }

  .lightbox__nav--next {
    right: 20px;
  }
}

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