/* =========================================================
   Dla Oli – interaktywny album urodzinowy
   ========================================================= */

:root {
  --color-primary: #d63384;
  --color-primary-light: #ff8fab;
  --color-gold: #d4af37;
  --color-cream: #fff8f2;
  --color-cream-dark: #fdeef2;
  --color-text: #4a3439;
  --font-heading: 'Playfair Display', serif;
  --font-body: 'Quicksand', sans-serif;
  --font-hand: 'Caveat', cursive;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: linear-gradient(180deg, var(--color-cream) 0%, var(--color-cream-dark) 100%);
  overflow-x: hidden;
}

body.locked {
  overflow: hidden;
  height: 100vh;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  margin: 0;
}

#effects-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.section {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  padding: 6rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ===================== INTRO / KOPERTA ===================== */

#intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #fff0f5 0%, #ffd6e8 45%, #ff9ebb 100%);
  transition: opacity 1s ease, visibility 1s ease;
}

#intro-overlay.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-content {
  text-align: center;
  animation: intro-fade-in 1.2s ease both;
}

@keyframes intro-fade-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.intro-eyebrow {
  font-family: var(--font-hand);
  font-size: 1.6rem;
  color: var(--color-primary);
  margin-bottom: -0.5rem;
}

.intro-title {
  font-size: clamp(3rem, 10vw, 6rem);
  color: var(--color-primary);
  text-shadow: 0 4px 20px rgba(214, 51, 132, 0.25);
  margin-bottom: 2rem;
}

.envelope {
  position: relative;
  width: 240px;
  height: 160px;
  margin: 0 auto 1.5rem;
  cursor: pointer;
  perspective: 800px;
}

.envelope-body {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #ffffff, #ffe6ee);
  border-radius: 10px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.envelope-flap {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #ffb3c6, #ff8fab);
  clip-path: polygon(0 0, 50% 58%, 100% 0);
  transform-origin: top center;
  transition: transform 0.9s cubic-bezier(.4, .2, .2, 1);
  border-radius: 10px 10px 0 0;
  z-index: 2;
}

.envelope-heart {
  position: absolute;
  top: 58%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.2rem;
  color: var(--color-primary);
  z-index: 1;
  animation: heart-pulse 1.6s ease-in-out infinite;
}

@keyframes heart-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.15); }
}

.envelope:hover .envelope-flap {
  transform: rotateX(-15deg);
}

.envelope.open .envelope-flap {
  transform: rotateX(180deg);
}

.envelope.open {
  animation: envelope-pop 0.7s ease 0.5s both;
}

@keyframes envelope-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.1) translateY(-10px); }
  100% { transform: scale(0.9) translateY(-40px); opacity: 0; }
}

.intro-sub {
  font-size: 1rem;
  opacity: 0.75;
  letter-spacing: 0.05em;
}

/* ===================== NAWIGACJA BOCZNA ===================== */

.side-nav {
  position: fixed;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.nav-dot {
  position: relative;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(214, 51, 132, 0.3);
  transition: background 0.3s ease, transform 0.3s ease;
}

.nav-dot::after {
  content: attr(data-label);
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.9);
  color: var(--color-text);
  padding: 2px 10px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.nav-dot:hover::after {
  opacity: 1;
}

.nav-dot.active {
  background: var(--color-primary);
  transform: scale(1.4);
}

@media (max-width: 700px) {
  .side-nav { display: none; }
}

/* ===================== ŻYCZENIA ===================== */

.wishes-section {
  background: transparent;
}

.confetti-static {
  font-size: 2.2rem;
  letter-spacing: 0.6rem;
  margin-bottom: 1rem;
  animation: sway 3s ease-in-out infinite;
}

@keyframes sway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

.wishes-title {
  font-size: clamp(2rem, 6vw, 3.5rem);
  color: var(--color-text);
  max-width: 800px;
}

.highlight {
  color: var(--color-primary);
}

.typewriter {
  font-family: var(--font-hand);
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--color-primary);
  min-height: 2.5em;
  max-width: 700px;
  margin: 1.5rem 0 0.5rem;
  border-right: 2px solid var(--color-primary);
  white-space: pre-wrap;
  display: inline-block;
}

.wishes-extra {
  max-width: 640px;
  line-height: 1.8;
  font-size: 1.05rem;
  margin-top: 1.5rem;
  opacity: 0.85;
}

.scroll-down {
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  opacity: 0.7;
  font-size: 0.85rem;
}

.scroll-down span {
  width: 22px;
  height: 36px;
  border: 2px solid var(--color-primary);
  border-radius: 12px;
  position: relative;
}

.scroll-down span::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  width: 4px;
  height: 8px;
  background: var(--color-primary);
  border-radius: 2px;
  transform: translateX(-50%);
  animation: scroll-dot 1.6s ease infinite;
}

@keyframes scroll-dot {
  0% { top: 6px; opacity: 1; }
  70% { opacity: 0; }
  100% { top: 18px; opacity: 0; }
}

/* ===================== SEKCJE OGÓLNE ===================== */

.section-title {
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.section-subtitle {
  font-family: var(--font-hand);
  font-size: 1.4rem;
  opacity: 0.75;
  margin-bottom: 3rem;
}

/* ===================== TIMELINE ===================== */

.timeline {
  position: relative;
  width: 100%;
  max-width: 1000px;
  margin-top: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--color-primary-light), var(--color-gold));
  transform: translateX(-50%);
}

.timeline-item {
  position: relative;
  width: 50%;
  padding: 2rem 3rem;
}

.timeline-item.left { left: 0; text-align: right; }
.timeline-item.right { left: 50%; text-align: left; }

.timeline-item::before {
  content: '';
  position: absolute;
  top: 2.7rem;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 0 5px var(--color-cream-dark), 0 0 0 7px var(--color-primary-light);
}

.timeline-item.left::before { right: -8px; }
.timeline-item.right::before { left: -8px; }

.timeline-date {
  display: inline-block;
  font-family: var(--font-hand);
  font-size: 1.3rem;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.timeline-content {
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.timeline-item.left .timeline-content { transform: translateX(-60px); }
.timeline-item.right .timeline-content { transform: translateX(60px); }

.timeline-content.visible {
  opacity: 1;
  transform: translateX(0);
}

.polaroid {
  display: inline-block;
  background: #fff;
  padding: 14px 14px 30px;
  border-radius: 4px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  max-width: 280px;
}

.timeline-item:nth-child(odd) .polaroid { transform: rotate(-3deg); }
.timeline-item:nth-child(even) .polaroid { transform: rotate(3deg); }

.polaroid:hover, .polaroid:focus {
  transform: rotate(0deg) scale(1.05);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.22);
  outline: none;
}

.polaroid img {
  width: 100%;
  display: block;
  border-radius: 2px;
}

.polaroid .caption {
  font-family: var(--font-hand);
  font-size: 1.2rem;
  color: var(--color-text);
  margin: 10px 4px 0;
  line-height: 1.2;
}

/* ===================== GALERIA ===================== */

.gallery-section {
  background: transparent;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  max-width: 1100px;
  width: 100%;
}

.gallery-item {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.gallery-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: 4 / 5;
  transition: transform 0.5s ease;
}

.gallery-item:hover img {
  transform: scale(1.08);
}

.gallery-item figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 1.2rem 1rem 0.8rem;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.55), transparent);
  color: #fff;
  font-family: var(--font-hand);
  font-size: 1.1rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.gallery-item:hover figcaption {
  opacity: 1;
  transform: translateY(0);
}

/* ===================== ZAKOŃCZENIE ===================== */

.closing-section {
  background: transparent;
}

.closing-title {
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  color: var(--color-primary);
  margin-bottom: 1.5rem;
}

.closing-letter {
  max-width: 640px;
  line-height: 1.9;
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.surprise-btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  border: none;
  padding: 1rem 2.4rem;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(214, 51, 132, 0.35);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.surprise-btn:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 15px 30px rgba(214, 51, 132, 0.45);
}

.surprise-btn:active {
  transform: translateY(0) scale(0.98);
}

.closing-message {
  font-family: var(--font-hand);
  font-size: 1.8rem;
  color: var(--color-primary);
  max-width: 600px;
  margin-top: 2rem;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.closing-message.show {
  opacity: 1;
  transform: scale(1);
  animation: heartbeat 1.4s ease-in-out 0.6s 2;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.signature {
  font-family: var(--font-hand);
  font-size: 1.4rem;
  margin-top: 3rem;
  opacity: 0.8;
}

/* ===================== LIGHTBOX ===================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(20, 10, 15, 0.92);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: min(80vw, 500px);
  max-height: 65vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox p {
  color: #fff;
  font-family: var(--font-hand);
  font-size: 1.6rem;
  max-width: 600px;
  text-align: center;
  margin-top: 1.2rem;
  padding: 0 1rem;
}

.lightbox-close, .lightbox-prev, .lightbox-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox-close { top: 1.5rem; right: 1.5rem; }
.lightbox-prev { left: 1.5rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 1.5rem; top: 50%; transform: translateY(-50%); }

@media (max-width: 700px) {
  .lightbox-prev { left: 0.5rem; }
  .lightbox-next { right: 0.5rem; }
}

/* ===================== RESPONSYWNOŚĆ ===================== */

@media (max-width: 760px) {
  .timeline::before { left: 24px; }
  .timeline-item, .timeline-item.left, .timeline-item.right {
    width: 100%;
    left: 0;
    text-align: left;
    padding-left: 3.5rem;
    padding-right: 1rem;
  }
  .timeline-item.left::before, .timeline-item.right::before { left: 16px; }
  .timeline-item.left .timeline-content, .timeline-item.right .timeline-content {
    transform: translateX(0) translateY(40px);
  }
  .timeline-content.visible { transform: translateY(0); }
}
