@import url('https://fonts.googleapis.com/css2?family=Libre+Caslon+Display&display=swap');

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

:root {
  --blur: 80px;
  --ease: cubic-bezier(0.7, 0, 0.3, 1);
  /* Card: 572×1016 in the 1920×1415 design → aspect ratio 572/1016 */
  --card-w: min(calc(80vh * 0.563), 88vw);
  --arr-s: clamp(32px, 3.8vh, 55px);
}

html, body {
  width: 100%;
  height: 100%;
  background: #262628;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  font-family: 'Big Caslon', 'Libre Caslon Display', 'Playfair Display', serif;
}

/* ── Background: snow-into-dusk gradient ── */
.bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 6%, #8f8b9e 54%, #262628 97%);
}

.blob {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
  pointer-events: none;
  filter: blur(var(--blur));
}

#b1 {
  width: 85vw; height: 60vh;
  top: -20vh; left: -15vw;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.95) 0%, transparent 70%);
  opacity: 0.55;
  animation: drift1 26s ease-in-out infinite alternate;
}

#b2 {
  width: 75vw; height: 65vh;
  top: 30vh; right: -20vw;
  background: radial-gradient(ellipse at center, #a9a2bf 0%, transparent 70%);
  opacity: 0.45;
  animation: drift2 22s ease-in-out infinite alternate;
}

#b3 {
  width: 80vw; height: 55vh;
  bottom: -18vh; left: -10vw;
  background: radial-gradient(ellipse at center, #3c3947 0%, transparent 68%);
  opacity: 0.6;
  animation: drift3 29s ease-in-out infinite alternate;
}

@keyframes drift1 {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(7vw,8vh) scale(1.08); }
}
@keyframes drift2 {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(-9vw,-7vh) scale(0.94); }
}
@keyframes drift3 {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(8vw,-8vh) scale(1.1); }
}

/* ── Stage ── */
.stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding-top: 3vh;
  touch-action: pan-y;
}

/* Soft haze behind/below the card */
.glow {
  position: absolute;
  top: 42%;
  left: 50%;
  width: calc(var(--card-w) * 1.03);
  height: calc(var(--card-w) * 2.06);
  transform: translate(-50%, -30%);
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.35) 0%, transparent 65%);
  filter: blur(60px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.6s var(--ease) 0.9s;
}

.card {
  position: relative;
  width: var(--card-w);
  aspect-ratio: 572 / 1016;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 14px 54px rgba(49, 48, 51, 0.85);
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 1.1s var(--ease) 0.9s, transform 1.1s var(--ease) 0.9s;
}

.card .ph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  display: block;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none; /* iOS: block long-press save/share sheet */
  will-change: transform;
}
#phB { transform: translateX(104%); }

/* ── Arrows ── */
.arr {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: var(--arr-s);
  height: var(--arr-s);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 5;
}
.arr svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: rgba(255,255,255,0.95);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.arr circle { stroke: rgba(255,255,255,0.55); }
.arr:hover { opacity: 1 !important; }
.arr-prev { left: calc(50% - var(--card-w) / 2 + 4px); }
.arr-next { right: calc(50% - var(--card-w) / 2 + 4px); }

body.down .arr { opacity: 1; transition: opacity 0.8s ease 1.7s; }

/* ── Position bar (you-are-here dots) ── */
.dots {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(var(--card-w) * 1.23, 55.2vw);
  height: 20px;
  margin: 25px auto 20px;
  z-index: 2;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1s var(--ease) 1.9s, transform 1s var(--ease) 1.9s;
}
body.down .dots { opacity: 1; transform: translateY(0); }

.dots::before {
  content: '';
  position: absolute;
  left: calc(50% / var(--dot-n, 21)); right: calc(50% / var(--dot-n, 21)); top: 50%;
  height: 1px;
  background: rgba(255,255,255,0.4);
  transform: translateY(-50%);
}

.dot {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 20px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}
.dot::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 4.3px; height: 4.3px;
  border-radius: 50%;
  background: rgba(255,255,255,0.55);
  transform: translate(-50%, -50%) scale(1);
  transition: transform 0.4s var(--ease), background 0.4s var(--ease);
}
.dot:hover::after { background: rgba(255,255,255,0.85); }
.dot.active::after {
  background: #ffffff;
  transform: translate(-50%, -50%) scale(1.65);
}

/* ── Wordmark ── */
.mark {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(20px, 3.5vw, 60px);
  padding: 0 clamp(20px, 7.3vw, 140px) 3.5vh;
  z-index: 2;
  /* Intro: JS sets --mark-rise so the mark starts at viewport center */
  transform: translateY(var(--mark-rise, 0px));
  transition: transform 1.1s var(--ease);
}
body.down .mark { transform: translateY(0); }

.line {
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.85);
  transform: scaleX(0);
  transition: transform 1s var(--ease) 0.2s;
}
.line-l { transform-origin: right center; }
.line-r { transform-origin: left center; }

.wordmark {
  font-weight: 500;
  font-size: clamp(19px, 2.8vw, 54px);
  letter-spacing: 0.9em;
  text-indent: 0.6em;
  color: #ffffff;
  white-space: nowrap;
  text-align: center;
  opacity: 0;
  transition: letter-spacing 1.5s var(--ease) 0.5s, opacity 1.5s var(--ease) 0.5s;
}

/* ── Intro ──
   Act 1 (body.in):   lines draw + wordmark settles, at viewport center
   Act 2 (body.down): mark glides to its place, card + glow + arrows follow */
body.in .line       { transform: scaleX(1); }
body.in .wordmark   { letter-spacing: 0.6em; opacity: 1; }
body.down .card     { opacity: 1; transform: translateY(0); }
body.down .glow     { opacity: 1; }
