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

html, body {
  overflow: hidden;
  height: 100%;
  background-color: #000000;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
}


/* ── Cursor label ── */

@media (hover: none) {
  #cursor-label { display: none; }
}

#cursor-label {
  position: fixed;
  top: 0;
  left: 0;
  font-family: 'Inter Tight', sans-serif;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(40, 30, 20, 0.78);
  background: rgba(255, 255, 255, 0.82);
  padding: 7px 11px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 10000;
  opacity: 0;
  white-space: nowrap;
}

/* ── Loading screen ── */

#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.8rem;
  pointer-events: none;
}

#loading-wordmark {
  max-width: 480px;
  width: 38vw;
  min-width: 220px;
  filter: invert(1);
  opacity: 0;
}

#loading-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2rem;
}

#loading-phrases {
  position: absolute;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 300;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.38);
  white-space: nowrap;
}

#loading-btns {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  opacity: 0;
  pointer-events: none;
}

#loading-enter {
  opacity: 1;
  pointer-events: auto;
}

.btn-ghost {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.38);
  padding: 10px 16px;
  transition: color 0.3s ease;
}

.btn-ghost:hover {
  color: rgba(255, 255, 255, 0.9);
}

/* ── Intro overlay ── */

#intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: transparent;
  pointer-events: none;
}

#scroll-container {
  height: 100vh;
  overflow: hidden;
}

#wordmark-section,
.text-section,
#end-section {
  height: 100vh;
}

#wordmark-section {
  display: flex;
  align-items: center;
  justify-content: center;
}

#intro-wordmark {
  max-width: 380px;
  filter: invert(1);
  opacity: 0;
}

.text-section {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10vw;
}

.para-wrap {
  font-size: 1.4rem;
  line-height: 2;
  color: rgba(255,255,255,0.82);
  max-width: 640px;
  text-align: center;
}

.fragment-line {
  font-size: 1.4rem;
  font-style: italic;
  color: rgba(255,255,255,0.6);
}

/* ── Tap hint (mobile only) ── */

#tap-hint {
  display: none;
}

@media (hover: none) {
  #tap-hint {
    display: block;
    position: absolute;
    bottom: 1.5rem;
    left: 0;
    right: 0;
    text-align: center;
    font-family: 'Franklin Gothic Medium', 'Libre Franklin', sans-serif;
    font-size: 0.55rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
    opacity: 0;
    padding: 8px 0;
  }
}

#p5 {
  flex-direction: column;
  gap: 2.5rem;
}

.word {
  display: inline-block;
  will-change: opacity, transform;
}

/* ── Site header ── */

#site-header {
  position: fixed;
  top: 2rem;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 210;
  pointer-events: none;
  opacity: 0;
}

#site-header img {
  max-width: 50px;
}

/* ── Fixed title ── */

#title {
  position: fixed;
  top: 2rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: clamp(1.4rem, 3vw, 2.4rem);
  font-weight: 300;
  letter-spacing: 0.12em;
  color: #2a2118;
  pointer-events: none;
  z-index: 10;
}

/* ── Glass buttons ── */

.btn-glass {
  position: relative;
  overflow: hidden;
  background: rgba(120, 115, 110, 0.35);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: none;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.92);
  padding: 10px 16px;
  letter-spacing: 0.08em;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition: background 0.25s ease;
}

.btn-glass::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    circle at var(--sx, 50%) var(--sy, 50%),
    rgba(255, 255, 255, 0.22) 0%,
    transparent 65%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.btn-glass:hover::after {
  opacity: 1;
}

.btn-glass:active {
  transform: scale(0.96);
  transition: transform 0.08s ease;
}

@supports not (backdrop-filter: blur(1px)) {
  .btn-glass {
    background: rgba(80, 76, 72, 0.65);
  }
}


/* ── About button ── */

#about-btn {
  position: fixed;
  bottom: 2rem;
  right: 1.5rem;
  z-index: 215;
  opacity: 0;
  pointer-events: none;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  font-style: normal;
  font-weight: 400;
  font-size: 15px;
  line-height: 1;
}
#about-btn.ready { pointer-events: auto; }

/* ── About overlay ── */

#about-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 5, 0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 110;
  pointer-events: none;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
}
#about-overlay.active { pointer-events: auto; }

#about-content {
  width: 68%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  text-align: center;
}

.about-body {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.58);
  line-height: 1.85;
  margin: 0;
}

.about-contact {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
  text-decoration: none;
  transition: color 0.25s;
}
.about-contact:hover { color: rgba(255, 255, 255, 0.65); }

#back-btn {
  position: relative;
}

/* ── Scene (viewport) ── */

#scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: default;
  user-select: none;
  background: #000;
}

#scene.canvas-ready {
  background: #000;
  cursor: grab;
}

#scene.dragging {
  cursor: grabbing;
}

/* ── Canvas (infinite plane) ── */

#canvas {
  position: absolute;
  width: 5100px;
  height: 3800px;
  will-change: transform;
}

/* ── Flip card ── */

.card {
  position: absolute;
  /* width/height set per-card by JS based on image orientation */
  perspective: 1800px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.card-front,
.card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 2px;
}

/* ── Front: photo ── */

.card-front {
  background: #c8c2b8;
  overflow: hidden;
  transform: translateZ(0.5px);
}

.card-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 2px;
  transform: scale(1.10);
  image-orientation: from-image;
  pointer-events: none;
}

/* ── Back: verso image or annotation text ── */

.card-back {
  background: #F0EBE0;
  transform: rotateY(180deg) translateZ(0.5px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(42, 33, 24, 0.08);
  overflow: hidden;
}

.card-back img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 2px;
  pointer-events: none;
}

/* ── Card edges (3D thickness) ── */

.card-edge {
  position: absolute;
  background: #d4c9b8;
  pointer-events: none;
}

.card-edge-top {
  top: 0; left: 0;
  width: 100%; height: 1px;
  transform-origin: 50% 0%;
  transform: translateZ(0.5px) rotateX(-90deg);
}

.card-edge-bottom {
  bottom: 0; left: 0;
  width: 100%; height: 1px;
  transform-origin: 50% 100%;
  transform: translateZ(0.5px) rotateX(90deg);
}

.card-edge-left {
  top: 0; left: 0;
  width: 1px; height: 100%;
  transform-origin: 0% 50%;
  transform: translateZ(0.5px) rotateY(90deg);
}

.card-edge-right {
  top: 0; right: 0;
  width: 1px; height: 100%;
  transform-origin: 100% 50%;
  transform: translateZ(0.5px) rotateY(-90deg);
}

/* ── Card info note ── */

#card-info {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 110;
  overflow: hidden;
  border-radius: 2px;
  font-family: 'Cormorant Garamond', serif;
  pointer-events: none;
  visibility: hidden;
}

#card-info.is-open {
  visibility: visible;
  pointer-events: auto;
}

#card-info-close {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 5;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#note-btn {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 120;
  opacity: 0;
  pointer-events: none;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
}

#about-close-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
}

#about-close-icon svg {
  display: block;
}

#about-close-btn {
  position: fixed;
  bottom: 2rem;
  right: 1.5rem;
  z-index: 215;
  opacity: 0;
  pointer-events: none;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#about-close-btn:hover {
  /* liquid glass hover handled by .btn-glass */
}

#card-info-content {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 5, 0.78);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
}

.info-text-group {
  width: 68%;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

#card-info-content > div:empty {
  display: none;
}

.info-lieu {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
}

.info-date {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.32);
  margin-top: -0.35rem;
}

.info-annotation-fr {
  font-size: 1.2rem;
  font-style: italic;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.65;
}

.info-annotation-en {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.48);
  line-height: 1.6;
}

.info-context {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.35);
  line-height: 1.7;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 0.8rem;
}

.info-description {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.25);
  line-height: 1.6;
  font-style: italic;
}


/* Ghost cards — visual only, not interactive */
.card[data-ghost] {
  pointer-events: none;
}


/* ── Card overlay ── */

#card-overlay {
  position: fixed;
  inset: 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(0, 0, 0, 0.65);
  z-index: 99;
  cursor: pointer;
}

.annotation {
  font-size: 1rem;
  font-weight: 300;
  color: #5a4a38;
  font-style: italic;
  text-align: center;
  line-height: 1.7;
  padding: 2rem;
}

/* ── Navigation hint ── */



/* ── Minimap ── */



/* ── Slide progress circle ── */

#slide-progress {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 210;
  opacity: 0;
  pointer-events: none;
}

.progress-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 1.5;
}

.progress-fill {
  fill: none;
  stroke: rgba(255, 255, 255, 0.75);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 56.549;
  stroke-dashoffset: 56.549;
  transform: rotate(-90deg);
  transform-origin: 12px 12px;
}

/* ── Music button ── */

#music-btn {
  position: fixed;
  bottom: 2rem;
  left: 1.5rem;
  z-index: 210;
  opacity: 0;
  pointer-events: none;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes eq-bar-1 {
  from { transform: scaleY(0.15); }
  to   { transform: scaleY(1.0);  }
}
@keyframes eq-bar-2 {
  from { transform: scaleY(0.42); }
  to   { transform: scaleY(0.82); }
}
@keyframes eq-bar-3 {
  from { transform: scaleY(0.2);  }
  to   { transform: scaleY(0.95); }
}

.music-bar {
  transform-box: fill-box;
  transform-origin: bottom center;
  transition: transform 0.35s ease-out;
}

.music-bar:nth-child(1) { animation: eq-bar-1 0.47s ease-in infinite alternate; }
.music-bar:nth-child(2) { animation: eq-bar-2 0.71s ease-in infinite alternate 0.15s; }
.music-bar:nth-child(3) { animation: eq-bar-3 0.53s ease-in infinite alternate 0.32s; }

#music-btn.muted .music-bar {
  animation: none;
  transform: scaleY(0.2);
}



.info-description { display: none; }

/* ── Skip intro button ── */

#skip-intro {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  top: auto;
  right: auto;
  z-index: 250;
  opacity: 0;
  pointer-events: none;
}
