/* Template 6: Wedding Invitation - Book with page flip effect */

:root {
  --accent: #9a8b7a;
  --accent-dark: #7a6d5e;
  --cover-gradient: linear-gradient(160deg, #f5f0e8 0%, #ebe4d9 50%, #e0d8cc 100%);
  --page-bg: #fdfcf9;
  --text: #3d3832;
  --text-light: #6b6560;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-script: 'Great Vibes', cursive;
  --font-body: 'Inter', system-ui, sans-serif;
  --ease-out: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-in-out: cubic-bezier(0.83, 0, 0.17, 1);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text);
  background: linear-gradient(180deg, #e8e2d9 0%, #ddd6cc 100%);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Book scene ---------- */
.book-scene {
  perspective: 1500px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
}

/* ---------- Book cover ---------- */
.book-cover {
  position: relative;
  width: 320px;
  height: 440px;
  cursor: pointer;
  transition: transform 0.5s var(--ease-out);
  box-shadow: 
    0 8px 32px rgba(0,0,0,0.08),
    0 2px 8px rgba(0,0,0,0.04);
}

.book-cover:hover {
  transform: scale(1.02);
}

.cover-inner {
  width: 100%;
  height: 100%;
  background: var(--cover-gradient);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  border: 1px solid rgba(154, 139, 122, 0.25);
  border-radius: 2px;
}

.cover-title {
  font-family: var(--font-script);
  font-size: 2.4rem;
  font-weight: 400;
  color: var(--text);
  text-align: center;
  line-height: 1.3;
}

.cover-subtitle {
  font-family: var(--font-serif);
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-top: 2rem;
}

/* ---------- Book pages (after cover opened) ---------- */
.book-cover.hidden {
  display: none !important;
}

.page-indicator {
  display: none;
}

.page-indicator:not(.hidden) {
  display: block;
}

.book-pages {
  display: none;
  position: relative;
  width: 360px;
  min-height: 480px;
  transform-style: preserve-3d;
}

.book-pages.visible {
  display: block;
}

.book-pages .book-3d {
  position: relative;
  width: 100%;
  height: 440px;
}


.book-spine {
  position: absolute;
  left: 50%;
  top: 0;
  height: 440px;
  width: 10px;
  margin-left: -5px;
  background: linear-gradient(90deg, #d4ccc0 0%, #e0d8cc 50%, #d4ccc0 100%);
  z-index: 0;
}

.pages-container {
  position: relative;
  width: 100%;
  height: 440px;
  transform-style: preserve-3d;
  perspective: 1000px;
  perspective-origin: center center;
}

/* ---------- Individual pages - paper style like example ---------- */
.page {
  position: absolute;
  left: 50%;
  top: 0;
  width: 320px;
  height: 440px;
  margin-left: -160px;
  background: linear-gradient(to right, #e1ddd8 0%, #fffbf6 100%);
  transform-origin: left center;
  transform-style: preserve-3d;
  overflow: hidden;
  z-index: 1;
  transition: transform 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: inset 0 -1px 2px rgba(50, 50, 50, 0.1), inset -1px 0 1px rgba(150, 150, 150, 0.2);
  border-radius: 0 5px 5px 0;
}

.page:hover {
  box-shadow: inset 1px 0 2px rgba(50, 50, 50, 0.1), inset -3px 1px 1px rgba(150, 150, 150, 0.2);
}

/* Back of page (paper) */
.page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, #e8e4df 0%, #f8f6f2 100%);
  transform: rotateY(180deg);
  backface-visibility: hidden;
  z-index: -1;
}

.page-content {
  backface-visibility: hidden;
}

.page.active {
  z-index: 10;
  transform: rotateY(0deg);
}

/* Flip animation - slower and smoother */
.page.flipping-next {
  animation: flipPageNext 1.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  z-index: 15;
}

.page.flipping-prev {
  animation: flipPagePrev 1.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  z-index: 20;
}

@keyframes flipPageNext {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(-140deg); }
}

@keyframes flipPagePrev {
  from { transform: rotateY(-140deg); }
  to { transform: rotateY(0deg); }
}

.page.prev {
  transform: rotateY(-140deg);
  z-index: 1;
  pointer-events: none;
}

.page.next {
  transform: rotateY(0deg);
  z-index: 5;
}

.page-content {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 2rem 1.75rem;
  overflow-y: auto;
}

/* ---------- Page 1: Hero ---------- */
.page-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.page-flip-hint {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--text-light);
  letter-spacing: 0.05em;
}

.page-hero-top {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.page-hero-title {
  font-family: var(--font-script);
  font-size: 2.8rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 1rem;
}

.page-hero-date {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.page-hero-year {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--text-light);
}

/* ---------- Page 2: Invitation ---------- */
.page-invitation {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.page-invitation .invitation-frame {
  background: url('assets/love_border.png') no-repeat center;
  background-size: contain;
  padding: 3rem 2rem;
  max-width: 85%;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-invitation .invitation-quote {
  margin: 0;
  padding: 0;
  border: none;
  max-width: 100%;
}

.page-invitation .invitation-quote p {
  font-family: 'Caveat', cursive;
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.8;
  color: var(--text);
  text-align: center;
}

/* ---------- Page 3: Date + Location ---------- */
.page-date-location {
  display: flex;
  flex-direction: column;
  text-align: center;
  padding: 1.5rem 1.75rem;
}

.page-date-location .date-location-header {
  flex-shrink: 0;
}

.page-date-location .ribbon-wrapper {
  margin-bottom: 0.75rem;
}

.page-date-location .ribbon-svg {
  width: 160px;
  height: auto;
  margin: 0 auto;
  color: var(--accent);
}

.page-date-location .ribbon-svg path {
  stroke-width: 3;
}

.page-date-location .date-title {
  font-family: var(--font-script);
  font-size: 2.6rem;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.page-date-location .location-name {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.page-date-location .location-city {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--text-light);
  margin-bottom: 0;
}

.page-date-location .map-wrapper {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: center;
  margin: 1.5rem auto;
  max-width: 300px;
  width: 100%;
  min-height: 220px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 4px 24px rgba(154, 139, 122, 0.12),
    0 1px 3px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(154, 139, 122, 0.25);
  background: #faf8f5;
}

.page-date-location .map-embed {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 220px;
  border: none;
  filter: saturate(0.85) contrast(0.98);
}

.page-date-location .btn-map {
  flex-shrink: 0;
  margin-top: auto;
  margin-bottom: 2.5rem;
}

/* ---------- Page 4: Programi ---------- */
.page-programi .section-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--accent);
}

.page-programi .timeline {
  max-width: 280px;
  margin: 0 auto;
}

.page-programi .timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.75rem 0;
}

.page-programi .timeline-icon {
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  color: var(--accent);
}

.page-programi .timeline-icon-svg {
  width: 100%;
  height: 100%;
}

.page-programi .timeline-label {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--text);
}

.page-programi .timeline-time {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--accent);
}

/* ---------- Page 5: Calendar ---------- */
.page-calendar .calendar-title {
  font-family: var(--font-script);
  font-size: 1.5rem;
}

.page-calendar .countdown-timer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}

.page-calendar .countdown-item strong {
  color: var(--accent);
}

.page-calendar .calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
  max-width: 240px;
  margin: 0 auto;
}

.page-calendar .calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  background: #f0ebe6;
  border-radius: 6px;
  color: var(--text-light);
}

.page-calendar .calendar-day.weekend { font-weight: 600; }

.page-calendar .highlight-day {
  background: var(--accent);
  color: #fff;
}

/* ---------- Page 6: RSVP ---------- */
.page-rsvp {
  text-align: center;
}

.page-rsvp .rsvp-intro {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.page-rsvp .rsvp-prompt {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.page-rsvp .rsvp-signature {
  font-family: var(--font-script);
  font-size: 1rem;
  margin-bottom: 1.25rem;
}

.page-rsvp .rsvp-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  font-family: var(--font-serif);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 999px;
  transition: opacity 0.3s, transform 0.3s;
}

.btn-map {
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--accent);
}

.btn-map:hover { opacity: 0.9; }

.btn-whatsapp {
  background: #25d366;
  color: #fff;
  text-align: center;
}

.btn-phone {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  text-align: center;
}

.btn-phone:hover { background: rgba(139, 115, 85, 0.1); }

/* Flip zones - click left for prev, right for next */
.flip-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 45%;
  cursor: pointer;
  z-index: 200;
}

.flip-prev { left: 0; }
.flip-next { right: 0; }

/* ---------- Page indicator ---------- */
.page-indicator {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-serif);
  font-size: 0.8rem;
  color: var(--text-light);
  z-index: 200;
}

.page-indicator.hidden { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .book-scene {
    padding: 0;
    align-items: stretch;
  }

  .book-cover {
    width: 100vw;
    height: 100vh;
    min-height: 100dvh;
  }

  .book-pages {
    width: 100vw;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .book-pages .book-3d {
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
  }

  .book-spine {
    height: 100vh;
    height: 100dvh;
  }

  .pages-container {
    height: 100vh;
    height: 100dvh;
  }

  .page {
    width: 100%;
    height: 100%;
    left: 0;
    margin-left: 0;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .page-date-location .map-wrapper {
    max-width: 90%;
    min-height: 260px;
  }

  .page-date-location .map-embed {
    min-height: 260px;
  }

  .page-date-location .btn-map {
    margin-bottom: 3rem;
  }
}

@media (max-width: 400px) {
  .cover-title { font-size: 2rem; }
  .page-hero-title { font-size: 2.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .book-cover { transition: none; }
  .page.flipping-next,
  .page.flipping-prev { transition-duration: 0.3s; }
}
