/* Tour interface: title screen, frame, artist path, index, work cards.
   Shared by every exhibition in gallery/. Design system: DESIGN.md. */

/* --main-color / --main-color-rgb (the show's accent) are set per show in its
   index.html and again from exhibition.json at runtime. Neutral fallback: */
html {
  --main-color: #d8d2da;
  --main-color-rgb: 216, 210, 218;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #000;

}

#viewer-container {
  width: 100%;
  height: 100%;
  /* Pinch and drag inside the panorama belong to PANOLENS, not page zoom/scroll */
  touch-action: none;
}

a:link,
a:visited {
  color: #bdc3c7;
}

.credit {
  position: absolute;
  text-align: center;
  width: 100%;
  padding: 20px 0;
  color: #fff;
}

.card {
  border-radius: 1rem;
  /* background-color: #c290d2; */
  background-color: var(--main-color)
}

.card-img-bottom {
  border-radius: 1rem;
}

.panolens-infospot.in {
  top: 0;
  transition: all 0.8s;
  visibility: visible;
  opacity: 1;
  /* transition: transform 3s; */
}

.panolens-infospot.out {
  visibility: hidden;
  opacity: 0;
  top: -400;
}

.InfoSpots {
  max-width: 500px;
  max-height: 500px;
  min-width: 200px;
  min-height: 250px;
  background: #fff;
  color: #000;
  border-radius: 3px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.title {
  font-size: 1.5em;
  text-align: center;
  padding: 5px;
}

#progress {
  width: 0;
  height: 3px;
  position: fixed;
  top: 0;
  z-index: 10;
  background: var(--main-color);
  -webkit-transition: opacity 1.5s ease;
  transition: opacity 2s ease;
}

#progress.finish {
  opacity: 0;
  visibility: hidden;
}

/* TITLE SCREEN
   Sits over the first room while it loads; leaves with one ease-out fade. */
.title-card {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: max(1.5rem, env(safe-area-inset-top)) max(1.5rem, env(safe-area-inset-right))
    calc(2.5rem + env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
  background: linear-gradient(to top, rgba(16, 10, 18, 0.94) 0%, rgba(16, 10, 18, 0.62) 48%, rgba(16, 10, 18, 0.18) 100%);
  color: #fff;
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.9s;
}

.title-card.is-leaving {
  opacity: 0;
  visibility: hidden;
}

.title-card__inner {
  width: 100%;
  max-width: 42rem;
  margin-top: auto; /* sit at the bottom, but scroll instead of clipping on very short screens */
  transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.title-card.is-leaving .title-card__inner {
  transform: translateY(1.5rem);
}

.title-card__title {
  margin: 0 0 1.25rem;
  font-family: var(--font-family-text);
  font-size: clamp(2rem, min(11vw, 13vh), 5.75rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.title-card__meta {
  margin: 0 0 0.35rem;
  font-size: clamp(1.05rem, 3.6vw, 1.3rem);
}

.title-card__credit {
  max-width: 36ch;
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.82);
}

.title-card__stats {
  margin: 0 0 2rem;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--main-color);
}

.title-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.75rem;
}

.title-card__enter {
  min-height: 48px;
  padding: 0 1.6rem;
  border: 0;
  border-radius: 999px;
  background: var(--main-color);
  color: #1d1222;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.2s ease;
}

.title-card__enter:hover {
  filter: brightness(1.08);
}

.title-card__enter:disabled {
  opacity: 0.5;
  cursor: default;
}

.title-card__about {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.3em;
  text-decoration-thickness: 1px;
  cursor: pointer;
}

.title-card__enter:focus-visible,
.title-card__about:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.title-card__note {
  margin: 1.1rem 0 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}

.title-card__note.is-error {
  color: #ffc9c9;
}

/* FIRST-VISIT HINT */
.coach {
  position: fixed;
  top: calc(1rem + env(safe-area-inset-top));
  left: 50%;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: calc(100% - 2rem);
  padding: 0.6rem 0.6rem 0.6rem 1rem;
  border-radius: 1rem;
  background: rgba(16, 10, 18, 0.82);
  color: #fff;
  font-size: 0.85rem;
  transform: translateX(-50%);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.coach[hidden] {
  display: none;
}

.coach.is-leaving {
  opacity: 0;
}

.coach__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.coach__list li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.coach__icon {
  width: 22px;
  height: 22px;
  flex: none;
}

.coach__close {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.12);
  background-size: 11px;
  opacity: 1;
}

/* Phones on their side: tighter rhythm so everything fits above the fold */
@media (max-height: 480px) {
  .title-card {
    padding-top: 1rem;
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
  }

  .title-card__title { margin-bottom: 0.6rem; }
  .title-card__credit { max-width: 52ch; margin-bottom: 0.6rem; }
  .title-card__stats { margin-bottom: 1rem; }
  .title-card__note { margin-top: 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .title-card,
  .title-card__inner,
  .coach {
    transition: none;
  }
}

/* STYLE FOR INTRODUCITON - TYPED */

#dialog {
  position: absolute;
  top: 10%;
  width: 100%;
  /* display: flex; */
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
  pointer-events: none;
}

#typed {
  color: #fff;
  text-shadow: 0px 0px 2px #000;
  font-size: clamp(1rem, 3.6vw, 1.35rem);
  transition: opacity 0.5s ease;
  visibility: visible;
}

#typed.out {
  opacity: 0;
  /* visibility: hidden; */
}

#log {
  color: var(--main-color);
  text-shadow: 0px 0px 2px #000;
  font-size: clamp(1.1rem, 4vw, 1.6rem);
  visibility: visible;
  opacity: 1;
  transition: all 0.5s ease;
}

#log.finish {
  opacity: 0;
  visibility: hidden;
}

#log.fadein {
  visibility: visible;
  opacity: 1;
}

/* FRAME
   Everything around the room lives in two corners and one panel: bottom left
   the room name, sound and the artist index; bottom right fullscreen and VR;
   during an artist path a panel docks at the bottom. Same plum black, Space Mono
   and accent as the title screen. --panel-h lifts the corners above the panel. */
:root {
  --frame-panel: rgba(16, 10, 18, 0.9);
  --frame-veil: rgba(16, 10, 18, 0.6);
  --frame-line: rgba(255, 255, 255, 0.45);
  --frame-rule: rgba(255, 255, 255, 0.2);
  --frame-ink: #1d1222;
  --frame-muted: rgba(255, 255, 255, 0.72);
  --edge-l: max(16px, env(safe-area-inset-left));
  --edge-r: max(16px, env(safe-area-inset-right));
  --edge-b: calc(16px + env(safe-area-inset-bottom));
  --panel-h: 0px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

.frame-stack,
.frame-tools {
  position: fixed;
  bottom: calc(var(--edge-b) + var(--panel-h));
  z-index: 12;
  display: flex;
  gap: 0.6rem;
  transition: bottom 0.5s var(--ease-out), opacity 0.6s ease;
}

.frame-stack {
  left: var(--edge-l);
  flex-direction: column;
  align-items: flex-start;
  /* keep clear of the fullscreen/VR buttons in the other corner */
  max-width: calc(100% - var(--edge-l) - var(--edge-r) - 7.5rem);
}

.frame-tools {
  right: var(--edge-r);
}

/* On wide screens the panel only covers the left corner */
@media (min-width: 720px) {
  .frame-tools {
    bottom: var(--edge-b);
  }
}

body:not(.has-entered) .frame-stack,
body:not(.has-entered) .frame-tools,
body.card-open .frame-stack,
body.card-open .frame-tools,
body.card-open .path {
  opacity: 0;
  visibility: hidden;
}

.frame-pill,
.frame-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  border: 1px solid var(--frame-line);
  background: var(--frame-veil);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.frame-pill {
  padding: 0 1.1rem;
  border-radius: 999px;
}

.frame-icon {
  width: 44px;
  padding: 0;
  border-radius: 50%;
}

.frame-icon svg,
.frame-pill svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.frame-pill[hidden],
.frame-icon[hidden] {
  display: none;
}

.frame-pill:hover,
.frame-icon:hover {
  background: var(--frame-panel);
  border-color: #fff;
}

.frame-pill--accent,
.frame-pill[aria-pressed="true"],
.frame-icon[aria-pressed="true"],
.frame-pill--accent:hover {
  background: var(--main-color);
  border-color: var(--main-color);
  color: var(--frame-ink);
}

.frame-pill--accent {
  font-weight: 700;
}

.frame-pill:focus-visible,
.frame-icon:focus-visible,
.index__item:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

#room-label {
  margin: 0;
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.3;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  transition: opacity 0.6s ease;
}

#room-label.is-empty {
  opacity: 0;
}

/* PANOLENS hover labels speak the frame's type too */
#viewer-container > .panolens-infospot {
  font-family: var(--font-family-text) !important;
  font-size: 0.85rem;
}

/* ARTIST PATH PANEL */
.path {
  position: fixed;
  left: var(--edge-l);
  right: var(--edge-r);
  bottom: var(--edge-b);
  z-index: 13;
  padding: 0.75rem 1rem 0.9rem;
  border-radius: 18px;
  background: var(--frame-panel);
  color: #fff;
  animation: frame-rise 0.5s var(--ease-out);
  transition: opacity 0.3s ease;
}

.path[hidden] {
  display: none;
}

@keyframes frame-rise {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
}

/* Head row: progress on the left; the way back to all artists and
   ending the path on the right. The artist's name appears once, below. */
.path__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: -0.25rem -0.4rem 0.15rem 0;
}

.path__head .path__dots {
  flex: 1;
  margin: 0;
}

.path__head .frame-pill {
  min-height: 44px;
  padding: 0 0.9rem;
  font-size: 0.85rem;
  background: transparent;
}

.path__head .frame-icon {
  border-color: transparent;
  background: transparent;
}

body.path-active .frame-stack #index-button {
  display: none;
}

.path__dots {
  display: flex;
  gap: 6px;
  padding: 0;
  list-style: none;
}

.path__dots li {
  width: 18px;
  height: 3px;
  background: var(--frame-rule);
}

.path__dots li.is-reached {
  background: var(--main-color);
}

.path__body {
  transition: opacity 0.25s ease, transform 0.4s var(--ease-out);
}

.path__body.is-swapping {
  opacity: 0;
  transform: translateY(0.5rem);
  transition-duration: 0.18s;
}

.path__artist {
  margin: 0 0 0.25rem;
  font-family: var(--font-family-text);
  font-size: clamp(1.3rem, 5.5vw, 2.1rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.path__title {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  line-height: 1.35;
}

.path__facts {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--frame-muted);
}

/* Back and "Werk öffnen" share a row; going on gets the full width,
   because "Weiter: <name>" can be long. */
.path__actions {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--frame-rule);
}

.path__actions .frame-icon {
  height: 44px;
}

#path-prev[hidden] + #path-open {
  grid-column: 1 / -1;
}

.path__next {
  grid-column: 1 / -1;
  padding-inline: 1rem;
  /* "Weiter: Alejandra Baltazares" stays on one line down to 360px */
  font-size: clamp(0.8rem, 3.7vw, 0.95rem);
}

/* A plain text line with the arrow inline: flex inside <button> shrinks
   the label box below its text in Chrome. */
.path__next {
  display: block;
  white-space: nowrap;
  text-align: center;
}

.path__next svg {
  display: inline-block;
  margin-left: 0.5rem;
  vertical-align: -0.3em;
}

.path__actions .frame-pill,
.path__actions .frame-icon {
  background: transparent;
}

.path__open-icon,
.path__next-short {
  display: none;
}

/* Phones: one row. "Weiter" stays short; on a path's last work "Werk öffnen"
   shrinks to its icon so "Weiter: <next artist>" gets the room. */
@media (max-width: 719px) {
  .path__actions {
    display: flex;
    align-items: stretch;
  }

  .path__actions > * {
    flex: none;
  }

  #path-open,
  .path__next {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 0.6rem;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .path__next-long,
  .path.is-last .path__open-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .path__next-short {
    display: inline;
  }

  /* text line, not flex: flex inside <button> clips the label in Chrome */
  #path-open {
    display: block;
    text-align: center;
  }

  .path.is-last #path-open {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    padding: 0;
    border-radius: 50%;
  }

  .path.is-last .path__open-icon {
    display: inline-block;
  }

  .path.is-last .path__next {
    flex: 1 1 auto;
    padding-block: 0.35rem;
    line-height: 1.2;
    white-space: normal;
  }

  .path.is-last .path__next-long {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .path.is-last .path__next-short {
    display: none;
  }
}

.path__actions .frame-pill--accent {
  background: var(--main-color);
}

.path__resume {
  display: none;
  align-items: center;
  gap: 0.6rem;
}

.path.is-paused {
  padding: 0.6rem;
}

.path.is-paused .path__head,
.path.is-paused .path__dots,
.path.is-paused .path__body,
.path.is-paused .path__actions {
  display: none;
}

.path.is-paused .path__resume {
  display: flex;
}

.path__resume .frame-pill--accent {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ARTIST INDEX: a sheet from the bottom on phones, a side panel on wide screens */
.index-backdrop {
  position: fixed;
  inset: 0;
  z-index: 24;
  background: rgba(0, 0, 0, 0.35);
}

.index {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  max-height: 78vh;
  max-height: 78dvh;
  overflow-y: auto;
  padding: 1rem var(--edge-r) calc(1rem + env(safe-area-inset-bottom)) var(--edge-l);
  border-radius: 22px 22px 0 0;
  background: #100a12;
  color: #fff;
  animation: frame-rise 0.45s var(--ease-out);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.index[hidden],
.index-backdrop[hidden] {
  display: none;
}

.index__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.index__head h2 {
  margin: 0;
  font-family: var(--font-family-text);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.index__close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.12);
  background-size: 11px;
  opacity: 1;
}

.index__intro {
  margin: 0 0 0.9rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--frame-muted);
}

.index__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.index__list li {
  border-top: 1px solid var(--frame-rule);
}

.index__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  min-height: 52px;
  padding: 0.7rem 0;
  border: 0;
  background: none;
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.index__name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.index__count {
  flex: none;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--main-color);
}

.index__item:hover .index__name {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

@media (min-width: 720px) {
  .path {
    right: auto;
    width: 26rem;
  }

  .index {
    left: var(--edge-l);
    right: auto;
    bottom: var(--edge-b);
    width: 24rem;
    max-height: calc(100dvh - 2rem);
    border-radius: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .path,
  .index {
    animation: none;
  }

  .frame-stack,
  .frame-tools,
  .path__body,
  .path__body.is-swapping {
    transform: none;
    transition: none;
  }
}

/* WORK CARDS
   A card always fits inside the viewport: the photo is capped in height,
   title and facts stay compact, and only the description scrolls. */
.panolens-infospot.card {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  max-height: calc(100dvh - 2rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin-top: calc(1rem + env(safe-area-inset-top));
  overflow: hidden;
}

.panolens-infospot.card .card-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0.75rem 0.75rem 1rem;
}

.work-media {
  flex: none;
  margin-bottom: 0.75rem;
}

.work-image {
  display: block;
  width: auto;
  max-width: 100%;
  /* Leave ~16rem for caption, a few lines of text and the card's margins. */
  max-height: min(52vh, calc(100vh - 16rem));
  max-height: min(52dvh, calc(100dvh - 16rem));
  margin: 0 auto;
  object-fit: contain;
  border-radius: 0.75rem;
}

.work-caption {
  flex: none;
  padding: 0 0.25rem;
}

.work-caption .card-title {
  font-size: clamp(1.15rem, 3vh, 1.6rem);
  line-height: 1.2;
  margin: 0 0 0.25rem;
}

.work-caption .author-text {
  font-size: 1rem;
  margin: 0 0 0.25rem;
}

.work-facts {
  font-size: 0.8rem;
  margin: 0;
}

.work-text {
  flex: 1 1 auto;
  min-height: 3rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 0.75rem;
  padding: 0 0.25rem;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-line;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.35) transparent;
}

.work-text:empty {
  display: none;
}

/* Short landscape screens (phones on their side): photo left, words right. */
@media (orientation: landscape) and (max-height: 520px) {
  .panolens-infospot.card .card-body {
    display: grid;
    grid-template-columns: minmax(0, 45%) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 1rem;
  }

  /* Works without a photo keep the single-column layout. */
  .panolens-infospot.card .card-body:not(:has(.work-media)) {
    display: flex;
  }

  .work-media {
    grid-row: 1 / span 2;
    margin: 0;
    align-self: start;
  }

  .work-image {
    max-height: calc(100vh - 4rem);
    max-height: calc(100dvh - 4rem);
  }

  .work-caption {
    padding-right: 2.75rem; /* keep clear of the close button */
  }

  .work-text {
    min-height: 0;
    margin-top: 0.5rem;
  }
}

.card-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 3;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.85);
  background-size: 14px;
  opacity: 1;
}

.card-close:hover,
.card-close:focus-visible {
  background-color: #fff;
}

.modal-content {
  background-color: unset;
  padding: 1rem;
}

#LightboxCanvas {
  max-width: 100%;
  max-height: 100%;
}
