/* =============================================================
   STORY PAGE — Gallery walk styles
   Tokens: from styles.css :root (loaded before story.css)
   Dark wall background: #1e1c19
   ============================================================= */

/* ---- Base: prevent page scroll; full viewport ---- */

.story-body {
  overflow: hidden;
  height: 100vh;
  background: #807f7a;
  transition: background 600ms ease;
}

/* Global room light: lit-wall gradient (day) crossfading to night-room.
   Real layers because gradients cannot interpolate. */
.wall-luminance {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.wall-luminance::before,
.wall-luminance::after {
  content: "";
  position: absolute;
  inset: 0;
  transition: opacity 600ms ease;
}

.wall-luminance::before {
  background: linear-gradient(
    180deg,
    #1e1e1c 0%,
    #3f3e3a 12%,
    #8b8a84 32%,
    #c2c1bb 48%,
    #c6c5bf 58%,
    #a3a29c 76%,
    #807f7a 100%
  );
  opacity: 1;
}

.wall-luminance::after {
  background: linear-gradient(
    180deg,
    #0b0b0a 0%,
    #131312 18%,
    #272725 38%,
    #343432 50%,
    #2b2b29 64%,
    #181816 86%,
    #0f0f0e 100%
  );
  opacity: 0;
}

body.wall-dark .wall-luminance::before { opacity: 0; }
body.wall-dark .wall-luminance::after { opacity: 1; }

.story-body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(
    ellipse 82% 95% at 50% 46%,
    rgba(22, 22, 20, 0) 52%,
    rgba(22, 22, 20, 0.12) 80%,
    rgba(22, 22, 20, 0.26) 100%
  );
}

/* ---- Header: clean top bar (not scroll-condensed variant) ---- */

.story-body .brand,
.story-body .brand .brand-mark {
  color: var(--paper);
}

.story-body .site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 28px;
  padding: 20px clamp(20px, 4vw, 48px);
  background: transparent;
  border-bottom: none;
  backdrop-filter: none;
  transition: color 400ms ease;
}

/* Suppress the landing condensed-header scroll behavior on story page */
.story-body .site-header.is-condensed {
  background: transparent;
  border-bottom: none;
  backdrop-filter: none;
  padding-block: 20px;
}

.gallery-title {
  font: 500 11px/1.2 var(--mono);
  letter-spacing: 0.1em;
  color: rgba(246, 245, 241, 0.55);
  text-transform: uppercase;
  text-align: center;
  transition: color 400ms ease;
}

.gallery-exit {
  justify-self: end;
  font: 500 11px/1.2 var(--mono);
  letter-spacing: 0.04em;
  color: rgba(246, 245, 241, 0.55);
  transition: color 180ms ease;
}

.gallery-exit:hover {
  color: var(--paper);
}

/* ---- Gallery main mount ---- */

main#gallery {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  overflow: hidden;
}

/* ---- Stage: contains the wall + controls ---- */

.gallery-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 78vh;
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* ---- Wall: horizontal strip of exhibits ---- */

.gallery-wall {
  display: flex;
  flex-direction: row;
  width: 100%;
  flex: 1;
  transition: transform 750ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- Each exhibit ---- */

.exhibit {
  flex: 0 0 100%;
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 0 clamp(16px, 4vw, 48px);
  position: relative;
}

.exhibit::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 32% 26% at 50% 43%,
      rgba(255, 255, 253, 0.40) 0%,
      rgba(255, 255, 253, 0) 70%
    ),
    radial-gradient(
      ellipse 40% 32% at 50% 44%,
      rgba(255, 255, 253, 0.55) 0%,
      rgba(255, 255, 253, 0.22) 48%,
      rgba(255, 255, 253, 0) 72%
    ),
    radial-gradient(
      ellipse 47% 43% at 50% 48%,
      rgba(255, 255, 253, 0.16) 0%,
      rgba(255, 255, 253, 0) 74%
    );
  opacity: 1;
  transition: opacity 300ms ease;
}

.gallery-stage.is-walking .exhibit::before { opacity: 0; }

/* Spotlights are for artworks only — text walls and the guestbook hang unlit */
.exhibit-text::before,
.exhibit-walltext::before,
.exhibit-guestbook::before {
  background: none;
}

/* ---- Artwork plate ---- */

.exhibit-plate {
  background: var(--white);
  padding: clamp(8px, 1.2vw, 14px);
  border: 1px solid var(--line);
  border-radius: 3px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 300ms ease;
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.9),
    inset -1px -1px 0 rgba(54, 50, 44, 0.12),
    0 22px 28px -16px rgba(30, 26, 20, 0.35),
    0 36px 70px -20px rgba(30, 26, 20, 0.18);
}

.exhibit-plate::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.16);
}

.exhibit-plate img {
  display: block;
  max-height: 52vh;
  width: auto;
  max-width: min(86vw, 980px);
}

/* ---- Wall label (museum format) ---- */

figcaption.wall-label {
  border-left: 1px solid rgba(40, 36, 30, 0.28);
  padding-left: 14px;
  max-width: min(86vw, 480px);
  transition: opacity 300ms ease;
  transition-delay: 120ms;
}

.wall-label-title {
  display: block;
  font: 500 12px/1.5 var(--mono);
  color: var(--ink);
  margin-bottom: 2px;
  transition: color 400ms ease;
}

.wall-label-lines {
  display: block;
  font: 400 11px/1.6 var(--mono);
  color: #5c574f;
  transition: color 400ms ease;
}

.curator-note {
  display: block;
  font: 400 italic 15px/1.6 var(--serif);
  color: #524e47;
  max-width: 44ch;
  margin-top: 10px;
  transition: color 400ms ease;
}

/* ---- Walk choreography: plate shrinks + label fades during transition ---- */

.gallery-stage.is-walking .exhibit-plate {
  transform: scale(0.985);
}

.gallery-stage.is-walking figcaption.wall-label {
  opacity: 0;
  transition-delay: 0ms;
}

/* ---- Controls bar ---- */

.gallery-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 18px;
  flex-shrink: 0;
}

button.gallery-prev,
button.gallery-next {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(40, 36, 30, 0.32);
  background: transparent;
  color: var(--ink);
  font: 500 14px/1 var(--mono);
  cursor: pointer;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 220ms ease, border-color 220ms ease;
}

button.gallery-prev::before,
button.gallery-next::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: scaleY(0);
  transform-origin: bottom;
  z-index: -1;
  transition: transform 220ms ease;
}

button.gallery-prev:hover:not(:disabled)::before,
button.gallery-next:hover:not(:disabled)::before {
  transform: scaleY(1);
}

button.gallery-prev:hover:not(:disabled),
button.gallery-next:hover:not(:disabled) {
  color: var(--paper);
  border-color: var(--ink);
}

button.gallery-prev:disabled,
button.gallery-next:disabled {
  opacity: 0.3;
  cursor: default;
}

span.gallery-counter {
  font: 500 11px/1.2 var(--mono);
  letter-spacing: 0.06em;
  color: #524e47;
  transition: color 400ms ease;
}

/* ---- TEXT exhibit (#13): no plate, large serif ---- */

.exhibit-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 0 clamp(16px, 4vw, 48px);
}

.exhibit-text-headline {
  font: 450 clamp(28px, 4vw, 52px)/1.08 var(--serif);
  color: var(--ink);
  max-width: 18ch;
  margin: 0;
  letter-spacing: -0.012em;
}

.exhibit-text-sub {
  font: 500 12px/1.5 var(--mono);
  color: #524e47;
  letter-spacing: 0.04em;
  margin: 0;
}

/* ---- WALL-TEXT exhibit (room intro panel) ---- */

.exhibit-walltext {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  padding: 0 clamp(16px, 4vw, 48px);
}

.walltext-kicker {
  font: 500 11px/1.2 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5c574f;
  margin: 0;
  transition: color 400ms ease;
}

.walltext-rule {
  display: block;
  width: 24px;
  height: 1px;
  background: rgba(40, 36, 30, 0.32);
  transition: background 400ms ease;
}

.walltext-statement {
  font: 450 clamp(26px, 3.2vw, 40px)/1.25 var(--serif);
  color: var(--ink);
  max-width: 30ch;
  margin: 0;
  letter-spacing: -0.008em;
  transition: color 400ms ease;
}

/* ---- GUESTBOOK exhibit (#14) ---- */

.guestbook {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
  max-width: 440px;
  width: 100%;
  padding: 0 clamp(16px, 4vw, 32px);
}

.guestbook-kicker {
  font: 500 11px/1.2 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #524e47;
  margin: 0;
}

.guestbook-headline {
  font: 450 clamp(22px, 2.2vw, 32px)/1.2 var(--serif);
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.005em;
  max-width: 26ch;
}

/* Signing line: hairline input + pill, light-on-wall */
.guestbook-form {
  width: 100%;
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

.guestbook-line {
  display: flex;
  align-items: stretch;
  gap: 14px;
}

.guestbook-line input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(23, 23, 23, 0.35);
  color: var(--ink);
  font: 400 13px/1.2 var(--mono);
  padding: 10px 2px;
  outline: none;
  border-radius: 0;
  transition: border-color 200ms ease;
}

.guestbook-line input::placeholder {
  color: rgba(23, 23, 23, 0.35);
}

.guestbook-line input:focus {
  border-bottom-color: var(--ink);
}

.guestbook-line button {
  border: 1px solid rgba(23, 23, 23, 0.4);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  font: 500 12px/1 var(--mono);
  padding: 0 20px;
  min-height: 40px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 200ms ease, color 200ms ease, border-color 200ms ease;
}

.guestbook-line button:hover:not(:disabled) {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.guestbook-line button:disabled {
  opacity: 0.4;
  cursor: wait;
}

.guestbook-note {
  font: 400 11px/1.5 var(--mono);
  color: #4a463f;
  margin: 0;
  text-align: left;
}

.guestbook .form-status {
  font: 400 12px/1.4 var(--mono);
  color: #3f3b35;
  min-height: 16px;
  margin: 0;
  text-align: left;
}

/* ---- DARK WALL: body.wall-dark ---- */

body.wall-dark {
  background: #1e1c19;
  transition: background 600ms ease;
}

body.wall-dark .gallery-title {
  color: var(--quiet);
}

body.wall-dark .gallery-exit {
  color: var(--quiet);
}

body.wall-dark .gallery-exit:hover {
  color: var(--paper);
}

body.wall-dark .brand {
  color: var(--paper);
}

body.wall-dark .wall-label-title {
  color: var(--paper);
}

body.wall-dark .wall-label-lines {
  color: rgba(246, 245, 241, 0.45);
}

body.wall-dark .curator-note {
  color: rgba(246, 245, 241, 0.65);
}

body.wall-dark figcaption.wall-label {
  border-left-color: rgba(246, 245, 241, 0.18);
}

body.wall-dark span.gallery-counter {
  color: var(--quiet);
}

body.wall-dark button.gallery-prev,
body.wall-dark button.gallery-next {
  border-color: rgba(246, 245, 241, 0.22);
  color: var(--paper);
}

/* On dark wall, the ink-fill flips to paper fill so hover still reads */
body.wall-dark button.gallery-prev::before,
body.wall-dark button.gallery-next::before {
  background: var(--paper);
}

body.wall-dark button.gallery-prev:hover:not(:disabled),
body.wall-dark button.gallery-next:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--paper);
}

body.wall-dark button.gallery-prev:disabled,
body.wall-dark button.gallery-next:disabled {
  opacity: 0.25;
}

body.wall-dark .walltext-kicker { color: var(--quiet); }
body.wall-dark .walltext-rule { background: rgba(246, 245, 241, 0.22); }
body.wall-dark .walltext-statement { color: var(--paper); }

body.wall-dark .exhibit-plate {
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.9),
    inset -1px -1px 0 rgba(54, 50, 44, 0.12),
    0 22px 28px -16px rgba(0, 0, 0, 0.5),
    0 36px 70px -20px rgba(0, 0, 0, 0.3);
}

body.wall-dark .exhibit::before {
  background:
    radial-gradient(
      ellipse 32% 26% at 50% 43%,
      rgba(255, 255, 250, 0.12) 0%,
      rgba(255, 255, 250, 0) 70%
    ),
    radial-gradient(
      ellipse 40% 30% at 50% 44%,
      rgba(255, 255, 250, 0.16) 0%,
      rgba(255, 255, 250, 0.06) 48%,
      rgba(255, 255, 250, 0) 70%
    ),
    radial-gradient(
      ellipse 47% 42% at 50% 48%,
      rgba(255, 255, 250, 0.06) 0%,
      rgba(255, 255, 250, 0) 74%
    );
}

/* Transition body background smoothly back from dark */
body {
  transition: background 600ms ease;
}

/* ---- Walk-settle: direction-aware incoming plate animation ---- */

.exhibit-plate.is-settling {
  animation: plate-settle 750ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes plate-settle {
  from { transform: perspective(1200px) rotateY(var(--settle-from, 2deg)); }
  to   { transform: perspective(1200px) rotateY(0deg); }
}

/* ---- Reduced motion overrides ---- */

@media (prefers-reduced-motion: reduce) {
  .gallery-wall {
    transition: none;
  }

  .gallery-stage.is-walking .exhibit-plate {
    transform: none;
  }

  .gallery-stage.is-walking figcaption.wall-label {
    opacity: 1;
    transition: none;
  }

  body.wall-dark,
  body {
    transition: none;
  }

  button.gallery-prev::before,
  button.gallery-next::before {
    transition: none;
  }

  .exhibit::before { transition: none; }
  .gallery-stage.is-walking .exhibit::before { opacity: 1; }
  .exhibit-plate.is-settling { animation: none; }
}
