/* ===== 3D Carousel ===== */
.c3d {
  position: relative;
  height: 280vh;
  background: radial-gradient(ellipse 120% 80% at 50% 50%, #0e0b07 0%, #050403 70%);
}
.c3d-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* --- Background --- */
.c3d-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.c3d-bg-grad {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 50%, rgba(200, 162, 101, 0.06) 0%, transparent 65%),
    radial-gradient(ellipse 100% 80% at 50% 50%, transparent 40%, rgba(5, 4, 3, 0.95) 100%);
}
.c3d-nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  mix-blend-mode: screen;
}
.c3d-nebula.n1 {
  width: 70vw; height: 70vw;
  left: -20vw; top: -15vh;
  background: radial-gradient(circle, rgba(200, 162, 101, 0.55), transparent 60%);
  opacity: 0.55;
  animation: c3dNeb1 24s ease-in-out infinite alternate;
}
.c3d-nebula.n2 {
  width: 65vw; height: 65vw;
  right: -25vw; top: 25vh;
  background: radial-gradient(circle, rgba(140, 90, 220, 0.5), transparent 60%);
  opacity: 0.5;
  animation: c3dNeb2 30s ease-in-out infinite alternate;
}
.c3d-nebula.n3 {
  width: 55vw; height: 55vw;
  left: 25vw; bottom: -15vh;
  background: radial-gradient(circle, rgba(40, 160, 220, 0.45), transparent 60%);
  opacity: 0.45;
  animation: c3dNeb3 26s ease-in-out infinite alternate;
}
@keyframes c3dNeb1 { to { transform: translate(10vw, 8vh) scale(1.15); } }
@keyframes c3dNeb2 { to { transform: translate(-12vw, -10vh) scale(0.9); } }
@keyframes c3dNeb3 { to { transform: translate(8vw, -12vh) scale(1.1); } }

.c3d-stars { position: absolute; inset: 0; }
.c3d-star {
  position: absolute;
  border-radius: 50%;
  background: rgba(232, 224, 208, 0.8);
  box-shadow: 0 0 6px 1px rgba(200, 162, 101, 0.5);
  animation: c3dTwinkle ease-in-out infinite alternate;
  opacity: 0;
}
@keyframes c3dTwinkle {
  0% { opacity: 0.1; transform: scale(0.6); }
  50% { opacity: 0.9; }
  100% { opacity: 0.15; transform: scale(1.2); }
}

/* --- Heading --- */
.c3d-head {
  position: absolute;
  top: clamp(28px, 5vh, 70px);
  left: 40px;
  z-index: 30;
  max-width: 500px;
  pointer-events: none;
}
.c3d-head .section-title {
  font-family: var(--serif);
  font-weight: var(--headline-weight);
  font-size: clamp(32px, 4.5vw, 56px);
  letter-spacing: var(--headline-tracking);
  line-height: 1.05;
  color: #E8E0D0;
  margin: 12px 0 0;
}
.c3d-head .section-title .italic { font-style: italic; color: var(--ochre); }
.c3d-head .label.dim { margin-top: 14px; color: rgba(232, 224, 208, 0.35); }
.c3d-head .label.ochre { color: var(--ochre); }

/* --- Carousel ring stage --- */
.c3d-ring-stage {
  position: relative;
  width: 100%;
  height: 620px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* --- Cards --- */
.c3d-card {
  position: absolute;
  width: 400px;
  height: 560px;
  cursor: pointer;
  will-change: transform, opacity;
  /* NO transition on transform/opacity: the rAF loop in carousel.jsx eases
     these every frame itself. A CSS transition retargeted on every scroll
     event fights that loop and smears the motion. */
}

.c3d-card-img {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background-size: cover;
  background-position: center;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.c3d-card:hover .c3d-card-img {
  transform: scale(1.04);
}

/* Translucent frosted glass overlay */
.c3d-card-glass {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: rgba(10, 8, 6, 0.25);
  backdrop-filter: blur(1px) saturate(1.2);
  -webkit-backdrop-filter: blur(1px) saturate(1.2);
  transition: background 0.4s ease, backdrop-filter 0.4s ease;
  pointer-events: none;
}
/* Front card: almost fully clear */
.c3d-card.front .c3d-card-glass {
  background: rgba(10, 8, 6, 0.08);
  backdrop-filter: blur(0px) saturate(1.3);
  -webkit-backdrop-filter: blur(0px) saturate(1.3);
}

.c3d-card-border {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.45),
    0 4px 14px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}
.c3d-card.front .c3d-card-border {
  border-color: rgba(200, 162, 101, 0.35);
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.55),
    0 0 50px rgba(200, 162, 101, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.c3d-card:hover .c3d-card-border {
  border-color: rgba(200, 162, 101, 0.4);
}

/* Card meta */
.c3d-card-meta {
  position: absolute;
  inset: 0;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #F3ECDE;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.c3d-card.front .c3d-card-meta { opacity: 1; }

.c3d-meta-top {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.c3d-meta-top .label.dim { color: rgba(243, 236, 222, 0.5); }
.c3d-meta-bot { display: flex; flex-direction: column; gap: 3px; }
.c3d-card-city {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}
.c3d-meta-bot .label.dim {
  font-size: 9px;
  letter-spacing: 0.14em;
  color: rgba(243, 236, 222, 0.6);
}

/* --- Caption --- */
.c3d-caption {
  position: absolute;
  bottom: clamp(50px, 8vh, 90px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  text-align: center;
  height: 28px;
  overflow: hidden;
}
.c3d-caption-inner {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: #E8E0D0;
  animation: c3dCapIn 0.45s var(--ease-soft);
  white-space: nowrap;
}
.c3d-caption-inner .label { font-size: 10px; letter-spacing: 0.2em; }
.c3d-caption-inner .label.ochre { color: var(--ochre); }
.c3d-caption-inner .label.dim { color: rgba(232, 224, 208, 0.5); }
.c3d-caption-inner .serif {
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: -0.01em;
}
.c3d-caption-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(200, 162, 101, 0.45);
}
@keyframes c3dCapIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Progress bar --- */
.c3d-progress-bar {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 100px;
  border-radius: 2px;
  background: rgba(232, 224, 208, 0.08);
  z-index: 20;
  overflow: hidden;
}
.c3d-progress-fill {
  position: absolute;
  bottom: 0; left: 0;
  width: 100%;
  height: 100%;
  background: var(--ochre);
  border-radius: 2px;
  transform-origin: bottom;
}

/* --- Expanded overlay --- */
.c3d-expand-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(5, 4, 3, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.5s ease, backdrop-filter 0.5s ease;
}
.c3d-expand-overlay.open {
  background: rgba(5, 4, 3, 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.c3d-expand-card {
  position: relative;
  width: min(88vw, 960px);
  height: min(78vh, 660px);
  border-radius: 18px;
  overflow: hidden;
  cursor: default;
  transform: scale(0.3) translateY(80px);
  opacity: 0;
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.5s ease;
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.7),
    0 0 60px rgba(200, 162, 101, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.c3d-expand-overlay.open .c3d-expand-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.c3d-expand-img {
  position: absolute;
  inset: 0;
  background-color: #050403;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
.c3d-expand-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(5, 4, 3, 0.85) 0%, rgba(5, 4, 3, 0.4) 18%, transparent 35%);
  pointer-events: none;
}

.c3d-expand-info {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 36px 40px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.c3d-expand-title {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 300;
  color: #E8E0D0;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
}
.c3d-expand-info .label.ochre { color: var(--ochre); font-size: 10px; letter-spacing: 0.2em; }

.c3d-expand-close {
  position: absolute;
  top: 20px; right: 20px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(20, 18, 16, 0.6);
  backdrop-filter: blur(8px);
  color: #E8E0D0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease;
  z-index: 10;
}
.c3d-expand-close:hover {
  background: rgba(200, 162, 101, 0.2);
  border-color: rgba(200, 162, 101, 0.5);
}
.c3d-expand-close svg { width: 18px; height: 18px; }

@media (prefers-reduced-motion: reduce) {
  .c3d-nebula, .c3d-star { animation: none !important; }
}
@media (max-width: 768px) {
  .c3d-card { width: 280px; height: 390px; }
  .c3d-ring-stage { height: 480px; }
  .c3d-head { left: 24px; }
  /* Expanded view: let the full photo breathe on small screens */
  .c3d-expand-card {
    width: 96vw;
    height: 88vh;
    max-height: 88vh;
    border-radius: 12px;
  }
  .c3d-expand-info {
    padding: 18px 22px;
  }
  .c3d-expand-title { font-size: 22px; }
  .c3d-expand-close { top: 12px; right: 12px; width: 38px; height: 38px; }
}
