:root {
  --bg1: #1e1b4b;
  --bg2: #4c1d95;
  --accent: #a78bfa;
  --accent2: #f472b6;
  --surface: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.14);
  --text: #f3f0ff;
  --muted: #b9b3d9;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg1), var(--bg2) 55%, #0f172a) fixed;
}

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 16px 64px;
}

.head { text-align: center; margin-bottom: 36px; }

.eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 6vw, 42px);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1.loading { color: var(--muted); font-size: 20px; font-weight: 400; }

h2 {
  margin: 0 0 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 20px;
  margin-bottom: 24px;
  backdrop-filter: blur(12px);
}

audio { width: 100%; margin-bottom: 8px; }

.narration-text {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.75;
  max-width: 65ch;
}

.narration-text p { margin: 16px 0 0; white-space: pre-line; }
.narration-text p:first-child { margin-top: 0; }

/* Slideshow */
.slider {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: #0b0a18;
  user-select: none;
}

@media (min-width: 700px) {
  .slider { aspect-ratio: 16 / 10; }
}

.slider-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.slider-stage:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.slide.active { opacity: 1; }

/* Blurred copy fills the frame so portrait and landscape photos both look good */
.slide-backdrop {
  position: absolute;
  inset: -20px;
  width: calc(100% + 40px);
  height: calc(100% + 40px);
  object-fit: cover;
  filter: blur(22px) brightness(0.55);
}

.slide-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.slide.active .slide-photo { animation: slowZoom 3s ease-out forwards; }

@keyframes slowZoom {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}

.slider-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}

.slider-arrow:hover { background: rgba(0,0,0,0.55); opacity: 1; }
.slider-prev { left: 10px; }
.slider-next { right: 10px; }

.slider-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 36px 16px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  pointer-events: none;
  text-align: center;
}

.slider-caption {
  margin: 0 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  line-height: 1.4;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  min-height: 0;
}

.slider-caption:empty { display: none; }

.slider-dots {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: auto;
}

.slider-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.45);
  cursor: pointer;
  transition: width 0.3s ease, background 0.3s ease;
}

.slider-dot.active { width: 22px; background: var(--accent2); }

.slider.single .slider-arrow,
.slider.single .slider-dots { display: none; }

/* Expand / collapse the full grid */
.expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.expand-btn:hover { border-color: var(--accent); }

.expand-chevron {
  display: inline-block;
  line-height: 0.6;
  font-size: 18px;
  transition: transform 0.3s ease;
}

.expand-btn[aria-expanded="true"] .expand-chevron { transform: rotate(180deg); }

.gallery-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.5s ease;
}

.gallery-wrap > .gallery { overflow: hidden; min-height: 0; }
.gallery-wrap.open { grid-template-rows: 1fr; }
.gallery-wrap.open > .gallery { margin-top: 14px; }

@media (prefers-reduced-motion: reduce) {
  .slide { transition: none; }
  .slide.active .slide-photo { animation: none; }
  .gallery-wrap { transition: none; }
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.thumb {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1;
  background: rgba(0,0,0,0.3);
  cursor: zoom-in;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.thumb:hover img, .thumb:focus-visible img { transform: scale(1.05); }
.thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.empty { text-align: center; color: var(--muted); }

/* What do you feel? */
.feel-form textarea,
.feel-form input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  font-size: 16px;
  outline: none;
}

.feel-form textarea {
  resize: vertical;
  min-height: 110px;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.6;
}

.feel-form input { font-family: inherit; }

.feel-form textarea:focus,
.feel-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(167,139,250,0.25);
}

.feel-row { display: flex; justify-content: flex-end; margin-top: 10px; }

.feel-btn {
  flex-shrink: 0;
  padding: 12px 20px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #1e1030;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(167,139,250,0.3);
}

.feel-btn:disabled { opacity: 0.6; cursor: default; }

.feel-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; min-height: 18px; font-size: 13px; }
.feel-error { color: #fca5a5; }
.feel-count { color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }

.feel-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 12px; }

.feel-item {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  border-left: 3px solid var(--accent2);
  animation: feelIn 0.4s ease;
}

.feel-item p {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.feel-by { margin-top: 8px; font-size: 12px; color: var(--muted); }
.feel-by strong { color: var(--accent2); font-weight: 600; }

@keyframes feelIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 480px) {
  .feel-btn { width: 100%; }
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Key screen */
.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.gate-card {
  width: 100%;
  max-width: 400px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 28px;
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  animation: gateIn 0.5s ease;
}

@keyframes gateIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.gate-title {
  font-size: 28px;
  margin-bottom: 10px;
}

.gate-text {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.gate-hint {
  margin: -8px 0 20px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed rgba(244,114,182,0.45);
  background: rgba(244,114,182,0.08);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
}

.gate-hint-label {
  display: block;
  margin-bottom: 4px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent2);
}

.gate-card input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  font-size: 16px;
  text-align: center;
  outline: none;
}

.gate-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(167,139,250,0.25);
}

.gate-btn {
  width: 100%;
  margin-top: 14px;
  padding: 13px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #1e1030;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(167,139,250,0.35);
}

.gate-btn:disabled { opacity: 0.6; cursor: default; }

.gate-error { margin: 14px 0 0; min-height: 18px; color: #fca5a5; font-size: 14px; }

.gate-card.shake { animation: shake 0.4s ease; }

@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.foot { text-align: center; margin-top: 8px; }

.lock-btn {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

.lock-btn:hover { color: var(--text); }

/* Falling rose petals */
.petals {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

.petal {
  position: absolute;
  top: -40px;
  left: var(--x);
  width: var(--size);
  height: calc(var(--size) * 0.8);
  opacity: 0;
  animation: petalFall var(--dur) linear var(--delay) infinite;
}

/* The petal shape: a rounded teardrop with a soft rose gradient */
.petal::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 150% 0 150% 0;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: inset -2px -2px 4px rgba(120, 0, 30, 0.25);
  animation: petalSway var(--sway) ease-in-out infinite alternate;
}

@keyframes petalFall {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
  8% { opacity: var(--alpha); }
  90% { opacity: var(--alpha); }
  100% { transform: translate3d(var(--drift), 108vh, 0) rotate(var(--spin)); opacity: 0; }
}

@keyframes petalSway {
  from { transform: translateX(-12px) rotate(-18deg) scaleX(1); }
  to { transform: translateX(12px) rotate(22deg) scaleX(0.7); }
}

/* Tiny hearts that fade in and out along the sides */
.side-heart {
  position: absolute;
  left: var(--x);
  top: var(--y);
  font-size: var(--size);
  line-height: 1;
  color: var(--c);
  text-shadow: 0 0 8px var(--glow);
  opacity: 0;
  animation: heartTwinkle var(--dur) ease-in-out var(--delay) infinite;
}

@keyframes heartTwinkle {
  0% { opacity: 0; transform: translateY(6px) scale(0.5); }
  30% { opacity: var(--alpha); transform: translateY(0) scale(1); }
  60% { opacity: var(--alpha); transform: translateY(-6px) scale(1.05); }
  100% { opacity: 0; transform: translateY(-14px) scale(0.7); }
}

@media (prefers-reduced-motion: reduce) {
  .petals { display: none; }
}

/* Background music toggle */
.music-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 10px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(30,27,75,0.85);
  backdrop-filter: blur(12px);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.music-btn:hover { border-color: var(--accent); }

.music-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #1e1030;
  font-size: 15px;
}

.music-btn.playing .music-icon { animation: musicPulse 1.6s ease-in-out infinite; }

@keyframes musicPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@media (prefers-reduced-motion: reduce) {
  .music-btn.playing .music-icon { animation: none; }
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8,6,18,0.94);
  padding: 16px;
}

.lightbox[hidden] { display: none; }

.lb-figure {
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lb-figure img {
  max-width: 100%;
  max-height: calc(100vh - 140px);
  border-radius: 10px;
  object-fit: contain;
  user-select: none;
}

.lb-figure figcaption {
  margin-top: 14px;
  max-width: 60ch;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.5;
}

.lb-count { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

.lb-btn {
  position: absolute;
  border: 0;
  background: rgba(255,255,255,0.1);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.lb-btn:hover { background: rgba(255,255,255,0.2); }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }

@media (max-width: 600px) {
  .page { padding-top: 32px; }
  .lb-prev, .lb-next { top: auto; bottom: 16px; transform: none; }
  .lb-figure img { max-height: calc(100vh - 180px); }
}
