:root {
  --chrome-hi: #ffffff;
  --chrome-light: #e6e9ec;
  --chrome-mid: #aab1b8;
  --chrome-dark: #6f767d;
  --chrome-shadow: #4b5054;
  --paper: #fdfbf6;
  --ink: #3a3530;
  --ink-soft: #7a6f60;
  --accent: #8a929a;
  --bg-top: #fbfbfd;
  --bg-bot: #d9dde2;

  --frame-w: 240px;
  --frame-h: 340px;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Nunito Sans", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(130% 120% at 50% 0%, var(--bg-top) 0%, #eceef1 55%, var(--bg-bot) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 16px 48px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- Header ---------- */
.home-link {
  position: absolute;
  top: 20px;
  left: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 30px;
  border: 1px solid rgba(0,0,0,0.08);
  background: linear-gradient(180deg, #fff, #dfe3e7);
  box-shadow: 0 4px 10px rgba(60,66,72,0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.home-link:hover { transform: translateY(-2px); box-shadow: 0 7px 14px rgba(60,66,72,0.28); }

.site-header { text-align: center; margin-bottom: 8px; }
.site-header h1 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3.2rem);
  margin: 0;
  letter-spacing: 0.5px;
}
.subtitle {
  font-style: italic;
  color: var(--ink-soft);
  margin: 6px 0 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.15rem;
}

/* ---------- 3D scene ---------- */
.scene {
  position: relative;
  width: 100%;
  max-width: 760px;
  height: 500px;
  perspective: 2600px;
  perspective-origin: 50% 44%;
  margin-top: 8px;
  touch-action: pan-y;
  cursor: grab;
}
.scene.grabbing { cursor: grabbing; }

/* ---------- Central chrome stand ---------- */
.stand {
  position: absolute;
  left: 50%;
  top: 28px;
  transform: translateX(-50%);
  height: 400px;
  width: 80px;
  z-index: 1;        /* sits behind the front frame, in front of the back ones */
  pointer-events: none;
}
.stand-post {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  width: 14px;
  height: 330px;
  border-radius: 7px;
  background: linear-gradient(90deg,
    var(--chrome-shadow) 0%, var(--chrome-mid) 25%,
    var(--chrome-hi) 48%, var(--chrome-light) 56%,
    var(--chrome-dark) 80%, var(--chrome-shadow) 100%);
  box-shadow: 0 6px 14px rgba(60,66,72,0.3);
}
.stand-top {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, var(--chrome-light) 35%, var(--chrome-mid) 70%, var(--chrome-dark) 100%);
  box-shadow: 0 3px 6px rgba(60,66,72,0.35);
}
.stand-foot {
  position: absolute;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--chrome-mid) 70%, var(--chrome-dark));
  box-shadow: 0 4px 8px rgba(60,66,72,0.3);
}
/* Elliptical wire base */
.stand-base {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  width: 230px;
  height: 60px;
  border-radius: 50%;
  border: 6px solid transparent;
  background:
    linear-gradient(var(--bg-bot), var(--bg-bot)) padding-box,
    linear-gradient(180deg, var(--chrome-hi), var(--chrome-mid) 50%, var(--chrome-dark)) border-box;
  box-shadow: 0 16px 22px -8px rgba(60,66,72,0.35);
  opacity: 0.95;
}

/* ---------- Rotating carousel ---------- */
.carousel {
  position: absolute;
  left: 50%;
  top: 56px;
  width: var(--frame-w);
  height: var(--frame-h);
  margin-left: calc(var(--frame-w) / -2);
  transform-style: preserve-3d;
  transform: rotateY(0deg);
  z-index: 2;
}
/* Smoothing transition is toggled on/off from JS for drag vs snap. */
.carousel.smooth {
  transition: transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- A single chrome frame ---------- */
.frame {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}
.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 6px;
  padding: 10px;
  background: linear-gradient(135deg,
    var(--chrome-light) 0%, var(--chrome-mid) 22%,
    var(--chrome-hi) 42%, var(--chrome-light) 50%,
    var(--chrome-dark) 72%, var(--chrome-mid) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.5),
    0 10px 24px rgba(60,66,72,0.28);
}
.face.front { z-index: 2; }
.face.back {
  transform: rotateY(180deg);
  background: linear-gradient(135deg,
    var(--chrome-dark), var(--chrome-mid) 45%, var(--chrome-light) 60%, var(--chrome-dark));
}

/* White mat + photo inside the front face */
.mat {
  width: 100%;
  height: 100%;
  background: var(--paper);
  border-radius: 2px;
  padding: 6px;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.18);
}
.photo {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 1px;
  background: #e3e5e8;
}
.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
}

/* The metallic back gets a subtle brushed sheen + a little easel detail */
.face.back::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 4px;
  background: repeating-linear-gradient(115deg,
    rgba(255,255,255,0.18) 0px, rgba(255,255,255,0.18) 1px,
    rgba(0,0,0,0.04) 2px, rgba(0,0,0,0.04) 4px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
}

/* ---------- Caption panel ---------- */
.caption-panel {
  text-align: center;
  max-width: 440px;
  margin-top: 4px;
  min-height: 96px;
}
.caption-panel .date {
  font-size: 0.78rem;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 2px;
}
.caption-panel .place {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.7rem;
  font-weight: 600;
  margin: 0 0 6px;
}
.caption-panel .desc {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- Controls ---------- */
.controls {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
}
.nav-btn {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.08);
  background: linear-gradient(180deg, #fff, #dfe3e7);
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(60,66,72,0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.nav-btn:hover { transform: translateY(-2px); box-shadow: 0 7px 14px rgba(60,66,72,0.28); }
.nav-btn:active { transform: translateY(0); }

.counter {
  font-weight: 700;
  color: var(--ink-soft);
  min-width: 56px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.hint {
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-style: italic;
}

@media (max-width: 560px) {
  :root { --frame-w: 168px; --frame-h: 236px; }
  .scene { height: 360px; }
  .stand { height: 320px; }
  .stand-post { height: 250px; }
  .stand-base { width: 170px; }
}
