/* ============================================================
   PHOTOGRAPHY ARCHIVE — Interactive Digital Exhibition
   Loaded ONLY on /archive/. Shares tokens with css/style.css
   (--bg, --ink, --accent, --line, --pad, --ease, font vars).
   Lightbox is namespaced .xlb so it can never collide with the
   homepage .lightbox viewer.
   ============================================================ */

body {
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

body.is-fixed-mode {
  overflow: hidden;
  height: 100vh;
}

/* ============================================================
   ENTRANCE OVERLAY (+ hard failsafe)
   ============================================================ */
.archive-entrance {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
}

.archive-entrance__panel {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50.5%;
  background: #080807;
  will-change: transform;
}

.archive-entrance__panel--top {
  top: 0;
}

.archive-entrance__panel--bottom {
  bottom: 0;
}

.archive-entrance__inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.archive-entrance__title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(40px, 6vw, 70px);
  letter-spacing: 0.01em;
  color: var(--accent);
  line-height: 1;
}

.archive-entrance__dot {
  font-family: var(--font-pixel);
  font-style: normal;
  color: var(--accent);
  font-size: 0.6em;
  margin-left: 2px;
}

.archive-entrance__meta {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--ink-dim);
}

.archive-entrance__bar {
  position: relative;
  width: 240px;
  height: 1px;
  background: var(--line-soft);
  overflow: hidden;
}

.archive-entrance__bar i {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

/* JS/GSAP died → force the page usable (mirrors homepage fx-failsafe) */
html.archive-failsafe .archive-entrance {
  display: none !important;
}

html.archive-failsafe .gallery-item {
  opacity: 1 !important;
  transform: none !important;
  visibility: visible !important;
}

html.archive-failsafe .mode-selector,
html.archive-failsafe .archive-counter {
  opacity: 1 !important;
  transform: none !important;
}

/* ============================================================
   PAGE WIPE (archive → home)
   ============================================================ */
.wipe {
  position: fixed;
  inset: 0;
  z-index: 400;
  pointer-events: none;
  visibility: hidden;
}

.wipe.is-active {
  visibility: visible;
  pointer-events: auto;
}

.wipe__panel {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50.5%;
  background: #080807;
  will-change: transform;
}

.wipe__panel--top {
  top: 0;
  transform: translateY(-101%);
}

.wipe__panel--bottom {
  bottom: 0;
  transform: translateY(101%);
}

.wipe__label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0;
}

/* ============================================================
   HEADER
   ============================================================ */
.archive-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px var(--pad);
  border-bottom: 1px solid transparent;
  transition: background 0.5s var(--ease), border-color 0.5s var(--ease);
}

.archive-header.is-scrolled {
  background: rgba(12, 12, 10, 0.72);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border-bottom-color: var(--line-soft);
}

.archive-header__logo {
  position: relative;
  display: inline-grid;
  flex-shrink: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(21px, 2.4vw, 28px);
  letter-spacing: 0.01em;
  line-height: 1;
}

.archive-header__logo-short,
.archive-header__logo-full {
  grid-area: 1 / 1;
  white-space: nowrap;
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease), filter 0.5s var(--ease);
}

.archive-header__logo-short {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

.archive-header__logo-full {
  opacity: 0;
  transform: translateY(-6px);
  filter: blur(3px);
}

.archive-header__logo:hover .archive-header__logo-short {
  opacity: 0;
  transform: translateY(6px);
  filter: blur(3px);
}

.archive-header__logo:hover .archive-header__logo-full {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

.archive-header__logo-dot {
  font-family: var(--font-pixel);
  font-style: normal;
  color: var(--accent);
  font-size: 0.68em;
  margin-left: 1px;
}


.archive-header__center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  display: flex;
  align-items: center;
  gap: 10px;
}

.archive-header__center em {
  font-style: normal;
  color: var(--accent);
  display: inline-block;
  min-width: 64px;
  text-align: left;
}

.archive-header__close {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  transition: color 0.3s var(--ease);
}

.archive-header__close:hover {
  color: var(--ink);
}

.archive-header__close svg {
  transition: transform 0.4s var(--ease);
}

.archive-header__close:hover svg {
  transform: rotate(90deg);
}

/* ============================================================
   HUD — mode selector / counter / hint / zoom
   ============================================================ */
.mode-selector {
  position: fixed;
  bottom: 1.6rem;
  left: 50%;
  z-index: 150;
  opacity: 0;
  transform: translate(-50%, 24px);
  /* animated in by JS */
}

.mode-selector__pill {
  display: flex;
  gap: 4px;
  padding: 6px;
  background: rgba(12, 12, 10, 0.7);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid var(--line);
  border-radius: 60px;
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 15px 7px;
  border-radius: 50px;
  color: var(--ink-dim);
  transition: color 0.35s var(--ease), background-color 0.35s var(--ease), transform 0.35s var(--ease);
  position: relative;
}

.mode-btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.mode-btn__label {
  font-size: 8px;
  letter-spacing: 0.14em;
  opacity: 0.55;
  transition: opacity 0.3s;
}

.mode-btn:hover {
  color: var(--ink);
  transform: translateY(-2px);
}

.mode-btn:hover .mode-btn__label {
  opacity: 1;
}

.mode-btn.is-active {
  color: var(--bg);
  background: var(--accent);
}

.mode-btn.is-active .mode-btn__label {
  color: var(--bg);
  opacity: 1;
}

.mode-btn:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

.archive-counter {
  position: fixed;
  bottom: 2rem;
  right: var(--pad);
  z-index: 150;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  text-align: right;
  opacity: 0;
  /* animated in */
}

.archive-counter #counterCurrent {
  color: var(--ink);
}

.gallery-hint {
  position: fixed;
  bottom: 2rem;
  left: var(--pad);
  z-index: 150;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  opacity: 0;
  pointer-events: none;
}

.zoom-hud {
  position: fixed;
  bottom: 4.4rem;
  left: var(--pad);
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: rgba(12, 12, 10, 0.7);
  border: 1px solid var(--line-soft);
  border-radius: 40px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease), visibility 0s 0.45s;
}

.zoom-hud.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

.zoom-hud button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: color 0.3s, background-color 0.3s;
}

.zoom-hud button:hover {
  color: var(--bg);
  background: var(--accent);
}

.zoom-hud__val {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  min-width: 40px;
  text-align: center;
}

/* Orbit focus caption */
.orbit-caption {
  position: fixed;
  bottom: 6.4rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 140;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

.orbit-caption.is-visible {
  visibility: visible;
}

.orbit-caption__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(15px, 1.6vw, 20px);
  color: var(--ink);
}

.orbit-caption__meta {
  margin-top: 4px;
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
}

/* ============================================================
   GALLERY — shared
   ============================================================ */
.archive-main {
  min-height: 100vh;
  padding-top: 96px;
  position: relative;
}

.gallery {
  width: 100%;
  position: relative;
  min-height: calc(100vh - 96px);
}

.gallery__wrapper {
  width: 100%;
  position: relative;
}

.gallery.is-switching {
  pointer-events: none;
}

/* Orbit ring hairline */
.orbit-ring {
  position: absolute;
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}

/* ---------- Item ---------- */
.gallery-item {
  position: relative;
  cursor: pointer;
  border-radius: 4px;
  background: var(--bg-soft);
  will-change: transform;
  transform-style: preserve-3d;
  outline: none;
}

.gallery-item:focus-visible {
  box-shadow: 0 0 0 1.5px var(--accent);
}

.gallery-item__media {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  transform: translateZ(0);
}

.gallery-item__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transform: scale(1.1);
  filter: blur(16px) brightness(0.85) saturate(0.9);
  transition: opacity 0.7s var(--ease), transform 1.2s var(--ease), filter 1s var(--ease);
}

.gallery-item.is-loaded .gallery-item__media img {
  opacity: 1;
  transform: none;
  filter: brightness(0.85) saturate(0.9);
}

.gallery-item.is-loaded:hover .gallery-item__media img,
.gallery-item.is-loaded.is-focus .gallery-item__media img {
  transform: scale(1.05);
  filter: brightness(1) saturate(1);
}

/* depth shadow on hover */
.gallery-item::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.65);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  pointer-events: none;
  z-index: -1;
}

.gallery-item:hover::after {
  opacity: 1;
}

/* glass overlay + meta */
.gallery-item__glass {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, transparent 42%, rgba(8, 8, 7, 0.88) 100%);
  backdrop-filter: blur(0px);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  pointer-events: none;
}

.gallery-item:hover .gallery-item__glass {
  opacity: 1;
}

.gallery-item__info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transform: translateY(10px);
  opacity: 0;
  transition: transform 0.5s var(--ease), opacity 0.5s var(--ease);
  pointer-events: none;
}

.gallery-item:hover .gallery-item__info {
  transform: none;
  opacity: 1;
}

.gallery-item__num {
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--accent);
}

.gallery-item__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.25;
  color: var(--ink);
}

.gallery-item__meta {
  font-size: 8.5px;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
}

/* aspect ratio from manifest — keeps every layout CLS-free */
.gallery-item[data-orient="portrait"] {
  aspect-ratio: 3 / 4;
}

.gallery-item[data-orient="landscape"] {
  aspect-ratio: 4 / 3;
}

.gallery-item[data-orient="square"] {
  aspect-ratio: 1 / 1;
}

/* ============================================================
   MODE: FLOW — vertical masonry
   ============================================================ */
.gallery[data-mode="vertical"] {
  padding: 2vh var(--pad) 18vh;
}

.gallery[data-mode="vertical"] .gallery__wrapper {
  columns: 3;
  column-gap: 1.4rem;
}

.gallery[data-mode="vertical"] .gallery-item {
  break-inside: avoid;
  margin-bottom: 1.4rem;
}

@media (max-width: 1100px) {
  .gallery[data-mode="vertical"] .gallery__wrapper {
    columns: 2;
  }
}

@media (max-width: 620px) {
  .gallery[data-mode="vertical"] .gallery__wrapper {
    columns: 1;
  }
}

@media (min-width: 1700px) {
  .gallery[data-mode="vertical"] .gallery__wrapper {
    columns: 4;
  }
}

/* ============================================================
   MODE: ORBIT — the wheel
   ============================================================ */
.gallery[data-mode="circular"] {
  height: calc(100vh - 96px);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.gallery[data-mode="circular"].is-dragging {
  cursor: grabbing;
}

.gallery[data-mode="circular"] .gallery__wrapper {
  position: absolute;
  inset: 0;
}

.gallery[data-mode="circular"] .gallery-item {
  position: absolute;
  left: 0;
  top: 0;
  width: clamp(120px, 13vw, 210px);
  aspect-ratio: 3 / 4;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
}

@media (max-width: 768px) {
  .gallery[data-mode="circular"] .gallery-item {
    width: clamp(96px, 26vw, 150px);
  }
}

/* ============================================================
   MODE: SCATTER — floating canvas
   ============================================================ */
.gallery[data-mode="floating"] {
  height: calc(100vh - 96px);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.gallery[data-mode="floating"].is-dragging {
  cursor: grabbing;
}

.gallery[data-mode="floating"] .gallery__wrapper {
  position: absolute;
  inset: 0;
  will-change: transform;
}

.gallery[data-mode="floating"] .gallery-item {
  position: absolute;
  left: 0;
  top: 0;
  width: clamp(170px, 17vw, 300px);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
  .gallery[data-mode="floating"] .gallery-item {
    width: clamp(120px, 32vw, 210px);
  }
}

/* ============================================================
   LIGHTBOX — namespaced .xlb (exhibition lightbox)
   ============================================================ */
.xlb {
  position: fixed;
  inset: 0;
  z-index: 500;
  visibility: hidden;
  pointer-events: none;
}

.xlb.is-open {
  visibility: visible;
  pointer-events: auto;
}

.xlb__bg {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 7, 0.94);
  backdrop-filter: blur(26px) saturate(1.05);
  -webkit-backdrop-filter: blur(26px) saturate(1.05);
  opacity: 0;
}

.xlb__content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  z-index: 1;
}

.xlb__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px var(--pad);
  opacity: 0;
}

.xlb__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1rem, 2vw, 1.35rem);
  color: var(--ink);
  margin-bottom: 4px;
}

.xlb__info {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-dim);
}

.xlb__close {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  transition: color 0.3s var(--ease);
  flex-shrink: 0;
  padding: 4px 0 4px 16px;
}

.xlb__close:hover {
  color: var(--ink);
}

.xlb__close svg {
  transition: transform 0.4s var(--ease);
}

.xlb__close:hover svg {
  transform: rotate(90deg);
}

.xlb__stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(60px, 9vw, 130px);
  min-height: 0;
  opacity: 0;
}

.xlb__stage img {
  max-width: 100%;
  max-height: calc(100vh - 210px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 40px 110px rgba(0, 0, 0, 0.75);
  cursor: zoom-in;
}

.xlb__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-soft);
  color: var(--ink-dim);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
  opacity: 0;
  z-index: 2;
}

.xlb__arrow:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.xlb__arrow svg {
  width: 20px;
  height: 20px;
}

.xlb__arrow--prev {
  left: calc(var(--pad) * 0.6);
}

.xlb__arrow--next {
  right: calc(var(--pad) * 0.6);
}

.xlb__counter {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  opacity: 0;
}

/* clone that flies from the clicked thumbnail to the stage */
.xlb-flight {
  position: fixed;
  z-index: 510;
  object-fit: cover;
  border-radius: 4px;
  pointer-events: none;
  box-shadow: 0 40px 110px rgba(0, 0, 0, 0.7);
}

@media (max-width: 768px) {
  .archive-header__center {
    display: none;
  }

  .archive-main {
    padding-top: 84px;
  }

  .gallery,
  .gallery[data-mode="horizontal"],
  .gallery[data-mode="circular"],
  .gallery[data-mode="floating"] {
    min-height: calc(100vh - 84px);
    height: calc(100vh - 84px);
  }

  .gallery[data-mode="vertical"] {
    height: auto;
  }

  .archive-counter {
    display: none;
  }

  .gallery-hint {
    bottom: 6rem;
  }

  .zoom-hud {
    bottom: 8.2rem;
  }

  .orbit-caption {
    bottom: 7.6rem;
  }

  .mode-selector {
    bottom: 1.1rem;
  }

  .mode-btn {
    padding: 8px 11px 5px;
  }

  .mode-btn__label {
    font-size: 7px;
  }

  .xlb__stage {
    padding: 0 6vw;
  }

  .xlb__stage img {
    max-height: calc(100vh - 170px);
  }

  .xlb__arrow {
    width: 42px;
    height: 42px;
    top: auto;
    bottom: 60px;
    transform: none;
  }

  .xlb__arrow--prev {
    left: auto;
    right: calc(var(--pad) + 52px);
  }

  .xlb__arrow--next {
    right: var(--pad);
  }

  .xlb__counter {
    left: var(--pad);
    transform: none;
  }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {

  .gallery-item__media img,
  .gallery-item__glass,
  .gallery-item__info,
  .gallery-item::after {
    transition-duration: 0.01s !important;
  }

  .gallery-item__media img {
    transform: none !important;
    filter: brightness(0.9) !important;
  }
}