/* Valentine's scroll-driven site — baby blue/cyan theme, full-viewport panels */

:root {
  --baby-blue: #b8e0f0;
  --cyan: #7dd3fc;
  --cyan-deep: #22b8d1;
  --sky: #a5d8f3;
  --cream: #f0f9ff;
  --ice: #e0f4fc;
  --shadow: rgba(34, 184, 209, 0.2);
  --font: "Quicksand", sans-serif;
  --timeline-width: 100px;
}

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

html {
  scroll-snap-type: y proximity;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: linear-gradient(160deg, var(--cream) 0%, var(--baby-blue) 45%, var(--cyan) 100%);
  color: #1e4d5c;
  overflow-x: hidden;
  padding-left: var(--timeline-width);
}

/* Floating hearts background */
.hearts-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* Floating hearts (no pseudo-elements; .heart spans only for consistent count) */
.heart {
  position: absolute;
  font-size: clamp(16px, 3vw, 32px);
  opacity: 0.12;
  animation: float 10s ease-in-out infinite;
  color: var(--cyan-deep);
}

.heart--1 { left: 25%; top: 12%; animation-delay: -1s; }
.heart--2 { left: 75%; top: 35%; animation-delay: -4s; font-size: clamp(14px, 2.5vw, 26px); }
.heart--3 { left: 15%; top: 55%; animation-delay: -6s; }
.heart--4 { right: 25%; top: 75%; animation-delay: -2s; color: var(--sky); }
.heart--5 { left: 50%; top: 8%; animation-delay: -5s; color: var(--cyan-deep); font-size: clamp(14px, 2.5vw, 26px); }
.heart--6 { right: 12%; top: 48%; animation-delay: -3s; font-size: clamp(12px, 2vw, 22px); color: var(--sky); }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(15px, -20px) scale(1.1); }
}

/* Snoopy & Moomin decorative characters (inspired by Peanuts & Tove Jansson) */
.characters-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.character {
  position: absolute;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.2;
  animation: characterFloat 12s ease-in-out infinite;
}

.character--snoopy {
  background-image: url("../images/snoopy.png");
}

.character--snoopy-1 {
  width: 140px;
  height: 120px;
  left: 8%;
  bottom: 18%;
  animation-delay: 0s;
}

.character--snoopy-2 {
  width: 90px;
  height: 77px;
  right: 12%;
  top: 45%;
  animation-delay: -2s;
}

.character--snoopy-3 {
  width: 70px;
  height: 60px;
  left: 18%;
  top: 28%;
  animation-delay: -5s;
}

.character--snoopy-4 {
  width: 100px;
  height: 86px;
  right: 22%;
  bottom: 25%;
  animation-delay: -7s;
}

.character--snoopy-5 {
  width: 60px;
  height: 51px;
  left: 50%;
  top: 72%;
  margin-left: -30px;
  animation-delay: -3s;
}

.character--moomin {
  background-image: url("../images/moomin.png");
}

.character--moomin-1 {
  width: 85px;
  height: 85px;
  right: 10%;
  top: 22%;
  animation-delay: -4s;
}

.character--moomin-2 {
  width: 55px;
  height: 55px;
  left: 72%;
  top: 58%;
  animation-delay: -6s;
}

.character--moomin-3 {
  width: 65px;
  height: 65px;
  left: 5%;
  top: 68%;
  animation-delay: -1s;
}

.character--moomin-4 {
  width: 48px;
  height: 48px;
  right: 28%;
  top: 12%;
  animation-delay: -8s;
}

@keyframes characterFloat {
  0%, 100% { transform: translate(0, 0) rotate(-3deg); }
  50% { transform: translate(10px, -12px) rotate(2deg); }
}

/* Hero: Snoopy & Moomin beside the message */
.hero-characters {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
}

.hero-character {
  width: 56px;
  height: 56px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.9;
  animation: heroCharacterBounce 2.5s ease-in-out infinite;
}

.hero-character--snoopy {
  background-image: url("../images/snoopy.png");
  animation-delay: 0s;
}

.hero-character--moomin {
  background-image: url("../images/moomin.png");
  animation-delay: -0.4s;
}

@keyframes heroCharacterBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ----- Left-hand timeline: gentle blue gradient by scroll; red only when gift is opened ----- */
.timeline {
  --timeline-accent: #0f3d4a;
  --timeline-muted: #1e4d5c;
  --timeline-line: #c5dce3;
  --timeline-dot-border: #9bbcc7;
  --timeline-hover: #e8f4f6;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--timeline-width);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 0;
  pointer-events: none;
}

.timeline-line {
  position: absolute;
  left: 50%;
  top: 2rem;
  bottom: 2rem;
  width: 2px;
  margin-left: -1px;
  background: var(--timeline-line);
  border-radius: 1px;
  transition: background 0.5s ease;
}

.timeline-line-fill {
  display: none;
}

.timeline-dots {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 60%;
  max-height: 85vh;
  pointer-events: auto;
}

.timeline-dots li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  padding: 0.25rem 0;
  border-radius: 4px;
  transition: background 0.3s ease;
}

.timeline-dots li:hover {
  background: var(--timeline-hover);
}

.timeline-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid var(--timeline-dot-border);
  transition: background 0.5s ease, border-color 0.5s ease, transform 0.25s ease;
}

.timeline[data-current="1"] .timeline-dot[data-index="1"],
.timeline[data-current="2"] .timeline-dot[data-index="2"],
.timeline[data-current="3"] .timeline-dot[data-index="3"],
.timeline[data-current="4"] .timeline-dot[data-index="4"],
.timeline[data-current="5"] .timeline-dot[data-index="5"],
.timeline[data-current="6"] .timeline-dot[data-index="6"],
.timeline[data-current="7"] .timeline-dot[data-index="7"],
.timeline[data-current="8"] .timeline-dot[data-index="8"],
.timeline[data-current="9"] .timeline-dot[data-index="9"] {
  background: var(--timeline-accent);
  border-color: var(--timeline-accent);
  transform: scale(1.15);
}

.timeline-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--timeline-muted);
  opacity: 0.65;
  white-space: nowrap;
  transition: color 0.5s ease, opacity 0.3s ease;
}

.timeline[data-current="1"] .timeline-dot[data-index="1"] + .timeline-label,
.timeline[data-current="2"] .timeline-dot[data-index="2"] + .timeline-label,
.timeline[data-current="3"] .timeline-dot[data-index="3"] + .timeline-label,
.timeline[data-current="4"] .timeline-dot[data-index="4"] + .timeline-label,
.timeline[data-current="5"] .timeline-dot[data-index="5"] + .timeline-label,
.timeline[data-current="6"] .timeline-dot[data-index="6"] + .timeline-label,
.timeline[data-current="7"] .timeline-dot[data-index="7"] + .timeline-label,
.timeline[data-current="8"] .timeline-dot[data-index="8"] + .timeline-label,
.timeline[data-current="9"] .timeline-dot[data-index="9"] + .timeline-label {
  opacity: 1;
  color: var(--timeline-accent);
}

@media (max-width: 700px) {
  .timeline {
    width: 56px;
    padding: 1.5rem 0;
  }
  .timeline-label { display: none; }
  body { padding-left: 56px; }
}

.panel {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

/* Hero panel */
.hero {
  background: linear-gradient(180deg, rgba(240, 249, 255, 0.95) 0%, rgba(184, 224, 240, 0.4) 100%);
}

.hero-content {
  text-align: center;
  max-width: 90vw;
}

.hero-title {
  font-size: clamp(1.75rem, 6vw, 3rem);
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: #0f3d4a;
  letter-spacing: 0.02em;
  animation: heroPop 1s ease-out;
}

.hero-subtitle {
  font-size: clamp(1.25rem, 4vw, 2rem);
  font-weight: 600;
  margin: 0 0 2rem;
  color: var(--cyan-deep);
  animation: heroPop 1s ease-out 0.2s both;
}

.hero-hint {
  font-size: 0.95rem;
  opacity: 0.8;
  animation: heroPop 1s ease-out 0.4s both;
}

.hero-hint::after {
  content: " ↓";
  display: inline-block;
  animation: bounce 1.5s ease-in-out infinite;
}

@keyframes heroPop {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* Memory panels — scroll-driven “card” feel */
.memory-month {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6) 0%, rgba(224, 244, 252, 0.7) 100%);
}

.memory-month-inner {
  width: 100%;
  max-width: 900px;
  padding: 0 1rem;
  transform: scale(0.96);
  opacity: 0.7;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.5s ease;
}

.memory-month.is-active .memory-month-inner {
  transform: scale(1);
  opacity: 1;
}

.memory-month-title {
  margin: 0 0 1.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f3d4a;
  text-align: center;
  letter-spacing: 0.02em;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  justify-items: center;
}

.memory-month-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 1.5rem;
  font-size: 0.95rem;
  color: #1e4d5c;
  opacity: 0.8;
  text-align: center;
  font-style: italic;
}

@media (min-width: 520px) {
  .memory-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
  }
}

@media (min-width: 760px) {
  .memory-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

.memory-card {
  width: 100%;
  max-width: 220px;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 24px var(--shadow), 0 0 0 1px rgba(34, 184, 209, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: default;
}

.memory-card:hover {
  transform: scale(1.06);
  box-shadow: 0 16px 40px var(--shadow), 0 0 0 2px rgba(34, 184, 209, 0.25);
}

.memory-card-image-wrap {
  position: relative;
  aspect-ratio: 3 / 4;
  background: linear-gradient(135deg, var(--cyan) 0%, var(--cream) 100%);
  overflow: hidden;
}

.memory-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.memory-card:hover .memory-card-image {
  transform: scale(1.08);
}

.memory-card-caption {
  margin: 0;
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e4d5c;
  text-align: center;
  background: #fff;
  opacity: 0.85;
  transition: opacity 0.25s ease;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}

.memory-card:hover .memory-card-caption {
  opacity: 1;
}

/* Legacy .memory selector kept for any refs; month panels use .memory-month above */
/* Small heart above month title */
.memory-month::before {
  content: "♥";
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.25rem;
  color: var(--cyan-deep);
  opacity: 0.4;
}

/* ----- Gift panel: "Your gift" timeline step — click to open card ----- */
.panel-gift {
  position: relative;
  flex-direction: column;
  background: linear-gradient(
    180deg,
    rgba(240, 249, 255, 0.98) 0%,
    rgba(224, 244, 252, 0.95) 100%
  );
  overflow: hidden;
}

.panel-gift::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    160deg,
    #ffebee 0%,
    #ffcdd2 18%,
    #f8bbd0 38%,
    #f48fb1 55%,
    #ec407a 75%,
    #d81b60 90%,
    #c2185b 100%
  );
  opacity: 0;
  pointer-events: none;
}

.panel-gift:has(.gift-wrap.gift-opened)::before {
  animation: giftBackgroundFadeIn 2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes giftBackgroundFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Floating Valentine hearts when gift is opened (optimised: 5 hearts, transform-only float) */
.gift-valentine-hearts {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  contain: layout style paint;
}

.gift-valentine-heart {
  position: absolute;
  font-size: clamp(26px, 4.5vw, 42px);
  color: rgba(194, 24, 91, 0.4);
  opacity: 0;
  will-change: transform, opacity;
}

.panel-gift:has(.gift-wrap.gift-opened) .gift-valentine-heart {
  animation: giftHeartAppear 0.7s ease-out forwards, giftHeartFloat 5s ease-in-out 0.7s infinite;
}

.gift-valentine-heart--1 { left: 10%; top: 15%;  animation-delay: 0.1s, 0.8s; }
.gift-valentine-heart--2 { right: 12%; top: 25%; animation-delay: 0.2s, 1s; }
.gift-valentine-heart--3 { left: 15%; top: 55%; animation-delay: 0.3s, 1.2s; }
.gift-valentine-heart--4 { right: 10%; bottom: 25%; animation-delay: 0.15s, 0.9s; }
.gift-valentine-heart--5 { left: 50%; bottom: 15%; animation-delay: 0.25s, 1.1s; }

@keyframes giftHeartAppear {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes giftHeartFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(6px, -10px); }
}

.panel-gift .gift-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 320px;
  cursor: pointer;
  outline: none;
}

.panel-gift .gift-wrap.gift-opened {
  max-width: min(520px, 92vw);
  cursor: default;
}

.panel-gift .gift-wrap:focus-visible {
  outline: 2px solid var(--cyan-deep);
  outline-offset: 6px;
  border-radius: 20px;
}

.panel-gift:has(.gift-wrap.gift-opened) .gift-wrap:focus-visible {
  outline-color: #c2185b;
}

.gift-card-closed {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 2rem;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 16px 48px rgba(30, 77, 92, 0.1), 0 0 0 1px rgba(30, 77, 92, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gift-wrap:hover .gift-card-closed {
  transform: scale(1.02);
  box-shadow: 0 20px 56px rgba(30, 77, 92, 0.14), 0 0 0 1px rgba(30, 77, 92, 0.1);
}

.gift-wrap.gift-opened .gift-card-closed {
  display: none;
}

.gift-card-closed-icon {
  font-size: 4rem;
  margin-bottom: 0.75rem;
  line-height: 1;
}

.gift-card-closed-text {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #0f3d4a;
  letter-spacing: 0.02em;
}

.gift-card-open {
  display: none;
  padding: 2.25rem 2rem;
  background: linear-gradient(180deg, #fff 0%, #fff8fa 100%);
  border-radius: 24px;
  text-align: center;
  transform-origin: center center;
  border: 2px solid rgba(194, 24, 91, 0.2);
  animation: giftCardReveal 1.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.gift-wrap.gift-opened .gift-card-open {
  display: block;
}

.gift-card-open .gift-title {
  animation: giftContentReveal 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.7s both;
}

.gift-card-open .gift-pdf {
  display: block;
  width: 100%;
  height: min(70vh, 520px);
  min-height: 360px;
  margin-top: 1rem;
  border: none;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 20px rgba(194, 24, 91, 0.1);
  animation: giftContentReveal 0.7s cubic-bezier(0.22, 1, 0.36, 1) 1s both;
}

@keyframes giftCardReveal {
  from {
    opacity: 0;
    transform: scale(0.18) rotate(-18deg);
    filter: blur(18px);
    box-shadow: 0 4px 20px rgba(194, 24, 91, 0.15), 0 0 0 1px rgba(194, 24, 91, 0.1);
  }
  45% {
    opacity: 1;
    filter: blur(0);
  }
  78% {
    transform: scale(1.12) rotate(3deg);
    box-shadow:
      0 28px 64px rgba(194, 24, 91, 0.28),
      0 0 0 2px rgba(194, 24, 91, 0.15),
      0 0 80px rgba(236, 64, 122, 0.2);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    filter: blur(0);
    box-shadow:
      0 24px 56px rgba(194, 24, 91, 0.25),
      0 0 0 2px rgba(194, 24, 91, 0.12),
      0 0 60px rgba(236, 64, 122, 0.15);
  }
}

@keyframes giftContentReveal {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-gift:has(.gift-wrap.gift-opened) .gift-title {
  color: #880e4f;
  font-size: 1.35rem;
  margin-bottom: 0;
}

.panel-gift:has(.gift-wrap.gift-opened) .gift-line {
  color: #ad1457;
  font-size: 1rem;
}

.gift-icon {
  display: block;
  font-size: 2rem;
  margin-bottom: 0.75rem;
  opacity: 0.9;
}

.gift-title {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: #0f3d4a;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.gift-line {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e4d5c;
  opacity: 0.9;
  line-height: 1.4;
}

/* Gate overlay (two questions before entering) */
.gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--cream) 0%, var(--baby-blue) 45%, var(--cyan) 100%);
  padding: 1.5rem;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.gate-overlay--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gate-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  padding: 2rem;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 20px 60px var(--shadow), 0 0 0 1px rgba(34, 184, 209, 0.15);
}

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

@keyframes gateShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.gate-question {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f3d4a;
  margin: 0 0 1.25rem;
  text-align: center;
}

.gate-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.gate-btn {
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 600;
  padding: 0.6rem 1.5rem;
  border-radius: 12px;
  border: 2px solid var(--cyan-deep);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}

.gate-btn--yes {
  background: var(--cyan-deep);
  color: #fff;
  border-color: var(--cyan-deep);
}

.gate-btn--yes:hover {
  background: #1a9bb5;
  transform: scale(1.02);
}

.gate-btn--no {
  background: transparent;
  color: var(--cyan-deep);
}

.gate-btn--no:hover {
  background: rgba(34, 184, 209, 0.15);
}

.gate-btn--submit {
  background: var(--cyan-deep);
  color: #fff;
  border-color: var(--cyan-deep);
}

.gate-btn--submit:hover {
  background: #1a9bb5;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gate-input {
  font-family: var(--font);
  font-size: 1rem;
  padding: 0.6rem 1rem;
  border: 2px solid rgba(34, 184, 209, 0.5);
  border-radius: 12px;
  color: #1e4d5c;
}

.gate-input:focus {
  outline: none;
  border-color: var(--cyan-deep);
}

.gate-message {
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cyan-deep);
  text-align: center;
  min-height: 1.4em;
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
  html { scroll-snap-type: none; }
  .hero-title,
  .hero-subtitle,
  .hero-hint { animation: none; }
  .hero-hint::after { animation: none; }
  .memory-month-inner,
  .memory-card,
  .memory-card-image,
  .memory-card-caption { transition: none; }
  .character { animation: none; }
  .gate-card.gate-card--shake { animation: none; }
  .hero-character { animation: none; }
  .gate-overlay { transition: none; }
  .gift-card-closed,
  .gift-card-open { transition: none; }
  .gift-card-open { animation: none; }
  .gift-card-open .gift-title,
  .gift-card-open .gift-pdf { animation: none; }
  .panel-gift:has(.gift-wrap.gift-opened)::before {
    animation: none;
    opacity: 1;
  }
  .gift-valentine-heart { animation: none; }
  .panel-gift:has(.gift-wrap.gift-opened) .gift-valentine-heart { opacity: 0.6; }
  .heart { animation: none; }
  .timeline-line,
  .timeline-dot,
  .timeline-label,
  .timeline-dots li { transition: none; }
}
