/* ==========================================================
   STORYBOOK - STYLE PRINCIPALE

   Struttura:
   - Ogni modulo ha uno sfondo esterno che riempie la sezione.
   - Ogni modulo contiene una card con un secondo sfondo.
   - Ottimizzato per smartphone, tablet e desktop.
   ========================================================== */

/* ==========================================================
   VARIABILI
   I valori vengono sovrascritti dal config.js
   ========================================================== */

:root {
  --primary: #7c3a63;
  --secondary: #d8b86d;
  --text: #3c2d2f;

  --card-bg: rgba(255, 255, 255, 0.78);
  --card-border: rgba(255, 255, 255, 0.3);

  --title-font: "Cormorant Garamond", serif;
  --text-font: "Poppins", sans-serif;

  --title-size: 52px;
  --name-size: 38px;

  --storybook-width: 760px;
  --content-width: 640px;

  --safe-top: max(20px, env(safe-area-inset-top));
  --safe-bottom: max(20px, env(safe-area-inset-bottom));
}

/* ==========================================================
   RESET
   ========================================================== */

* {
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
  width: 100%;

  scroll-behavior: smooth;

  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;

  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;

  overflow-x: hidden;

  font-family: var(--text-font);
  color: var(--text);

  background: #171019;
}

body.modal-open {
  overflow: hidden;
}

button,
a {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  touch-action: manipulation;
}

img {
  display: block;
  max-width: 100%;
}

.hidden {
  display: none !important;
}

/* ==========================================================
   STORYBOOK GENERALE
   ========================================================== */

.storybook {
  position: relative;

  width: 100%;
  max-width: var(--storybook-width);

  margin: 0 auto;

  overflow: hidden;

  background: #f5efe9;

  box-shadow:
    0 0 50px rgba(0, 0, 0, 0.34),
    0 0 120px rgba(0, 0, 0, 0.18);

  opacity: 0;

  transition: opacity 0.8s ease;
}

.storybook.storybook-visible {
  opacity: 1;
}

/* ==========================================================
   MODULO GENERICO

   story-module:
   sfondo esterno della sezione.

   module-card:
   sfondo interno del modulo.
   ========================================================== */

.story-module {
  position: relative;
  isolation: isolate;

  width: 100%;

  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;

  display: flex;
  align-items: center;
  justify-content: center;

  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;

  opacity: 0;
  transform: translateY(30px);

  transition:
    opacity 0.9s ease,
    transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.story-module::before {
  content: "";

  position: absolute;
  inset: 0;
  z-index: -1;

  background:
    linear-gradient(
      180deg,
      rgba(15, 10, 16, 0.12) 0%,
      rgba(255, 255, 255, 0.03) 45%,
      rgba(15, 10, 16, 0.16) 100%
    );
}

.module-overlay {
  width: 100%;
  min-height: inherit;

  display: flex;
  align-items: center;
  justify-content: center;

  padding:
    var(--safe-top)
    16px
    var(--safe-bottom);

  background:
    linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.04),
      rgba(0, 0, 0, 0.1)
    );
}

.module-container {
  width: 100%;
  max-width: var(--content-width);

  margin: auto;
}

.module-card {
  position: relative;
  isolation: isolate;

  width: 100%;

  padding: clamp(28px, 7vw, 52px)
    clamp(20px, 6vw, 46px);

  overflow: hidden;

  text-align: center;

  border: 1px solid var(--card-border);
  border-radius: 30px;

  background-color: var(--card-bg);
  background-position: center;
  background-repeat: no-repeat;

  box-shadow:
    0 22px 55px rgba(0, 0, 0, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.2);

  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.module-card-image {
  background-size: 100% 100%;
}

/* ==========================================================
   TITOLI E TESTI GENERICI
   ========================================================== */

.module-title {
  position: relative;
  z-index: 2;

  margin: 0 0 18px;

  font-family: var(--title-font);
  font-size: clamp(36px, 9vw, var(--title-size));
  font-weight: 600;
  line-height: 1.05;

  color: var(--primary);

  text-wrap: balance;
}

.module-text {
  position: relative;
  z-index: 2;

  max-width: 480px;

  margin: 0 auto 26px;

  font-size: clamp(16px, 4vw, 18px);
  line-height: 1.7;

  white-space: pre-line;
  text-wrap: pretty;
}

/* ==========================================================
   HERO
   ========================================================== */

.story-module-hero {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
}

.hero-card {
  min-height: min(820px, calc(100dvh - 40px));

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 24px;
}

.hero-photo-wrap {
  position: relative;
  z-index: 2;

  width: min(78%, 380px);
  aspect-ratio: 4 / 5;

  overflow: hidden;

  border: 3px solid rgba(255, 255, 255, 0.76);
  border-radius: 48% 48% 24px 24px;

  background: rgba(255, 255, 255, 0.4);

  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.2),
    0 0 0 6px rgba(216, 184, 109, 0.16);
}

.hero-photo {
  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: center;
}

.hero-content {
  position: relative;
  z-index: 3;

  width: 100%;
}

.hero-kicker {
  margin: 0 0 6px;

  font-family: var(--title-font);
  font-size: clamp(25px, 7vw, 38px);
  line-height: 1.1;

  color: var(--secondary);
}

.hero-name {
  margin: 0;

  font-family: var(--title-font);
  font-size: clamp(52px, 15vw, 86px);
  font-weight: 600;
  line-height: 0.98;

  color: var(--primary);

  text-wrap: balance;
}

.hero-phrase {
  max-width: 460px;

  margin: 18px auto 0;

  font-family: var(--title-font);
  font-size: clamp(19px, 5vw, 25px);
  font-style: italic;
  line-height: 1.45;
}

/* ==========================================================
   PRESENTAZIONE / PERGAMENA
   ========================================================== */

.presentation-card {
  min-height: min(720px, calc(100dvh - 48px));

  display: flex;
  align-items: center;
  justify-content: center;

  padding:
    clamp(70px, 18vw, 130px)
    clamp(30px, 9vw, 72px);
}

.presentation-content {
  position: relative;
  z-index: 2;

  width: 100%;
  max-width: 470px;
}

.presentation-phrase {
  margin: 0 0 28px;

  font-family: var(--title-font);
  font-size: clamp(21px, 6vw, 30px);
  font-style: italic;
  line-height: 1.45;

  color: var(--primary);
}

.presentation-label {
  margin: 0 0 5px;

  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;

  color: var(--secondary);
}

.presentation-parents {
  margin: 0 0 28px;

  font-family: var(--title-font);
  font-size: clamp(30px, 8vw, 44px);
  font-weight: 600;
  line-height: 1.15;

  color: var(--primary);
}

.presentation-text {
  margin: 0;

  font-size: clamp(16px, 4.2vw, 19px);
  line-height: 1.75;

  text-wrap: pretty;
}

/* ==========================================================
   COUNTDOWN
   ========================================================== */

.countdown-card {
  padding-top: clamp(42px, 10vw, 72px);
  padding-bottom: clamp(42px, 10vw, 72px);
}

.countdown-grid {
  position: relative;
  z-index: 2;

  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));

  gap: clamp(7px, 2vw, 14px);

  margin-top: 30px;
}

.countdown-item {
  min-width: 0;

  padding: clamp(14px, 4vw, 22px) 6px;

  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 18px;

  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.78),
      rgba(255, 255, 255, 0.38)
    );

  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.countdown-value {
  display: block;

  font-family: var(--title-font);
  font-size: clamp(34px, 9vw, 56px);
  font-weight: 700;
  line-height: 1;

  color: var(--primary);
}

.countdown-label {
  display: block;

  margin-top: 8px;

  overflow: hidden;

  font-size: clamp(10px, 2.8vw, 14px);
  font-weight: 600;
  letter-spacing: 0.03em;

  color: var(--text);

  text-overflow: ellipsis;
  white-space: nowrap;
}

.countdown-completed {
  position: relative;
  z-index: 2;

  margin: 26px 0 0;

  font-family: var(--title-font);
  font-size: clamp(28px, 8vw, 44px);

  color: var(--primary);
}

/* ==========================================================
   GALLERIA
   ========================================================== */

.gallery-card {
  padding-bottom: clamp(36px, 8vw, 54px);
}

.gallery-grid {
  position: relative;
  z-index: 2;

  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: clamp(10px, 3vw, 18px);

  margin-top: 30px;
}

.gallery-item {
  position: relative;

  width: 100%;
  aspect-ratio: 4 / 5;

  padding: 0;
  overflow: hidden;

  cursor: pointer;

  border: 3px solid rgba(255, 255, 255, 0.76);
  border-radius: 20px;

  background: rgba(255, 255, 255, 0.35);

  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.16);

  transition:
    transform 0.28s ease,
    box-shadow 0.28s ease;
}

.gallery-item:nth-child(2),
.gallery-item:nth-child(3) {
  transform: translateY(18px);
}

.gallery-item:hover {
  transform: translateY(-5px) scale(1.015);

  box-shadow: 0 20px 38px rgba(0, 0, 0, 0.22);
}

.gallery-item:nth-child(2):hover,
.gallery-item:nth-child(3):hover {
  transform: translateY(10px) scale(1.015);
}

.gallery-image {
  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: center;

  transition: transform 0.45s ease;
}

.gallery-item:hover .gallery-image {
  transform: scale(1.05);
}

/* DIMENSIONE FISSA FOTO GALLERIA SLIDER */

.gallery-display {
  width: 100%;
  height: 520px;

  padding: 0;
  overflow: hidden;

  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
}

.gallery-display-image {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: contain;
  object-position: center;

  background: rgba(255, 255, 255, 0.35);
}

@media (max-width: 430px) {
  .gallery-display {
    height: 440px;
  }
}

/* ==========================================================
   DATA, ORA E LUOGO
   ========================================================== */

.event-details {
  position: relative;
  z-index: 2;

  display: flex;
  flex-direction: column;

  gap: 14px;

  margin: 28px auto;
}

.event-info-item {
  display: flex;
  align-items: center;

  gap: 15px;

  width: 100%;

  padding: 16px 18px;

  text-align: left;

  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 18px;

  background: rgba(255, 255, 255, 0.52);

  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.event-info-icon {
  flex: 0 0 auto;

  width: 50px;
  height: 50px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  font-size: 24px;

  background:
    radial-gradient(
      circle at 30% 25%,
      rgba(255, 255, 255, 0.96),
      rgba(216, 184, 109, 0.62)
    );

  box-shadow: 0 7px 16px rgba(0, 0, 0, 0.12);
}

.event-info-content {
  min-width: 0;

  display: flex;
  flex-direction: column;

  gap: 3px;
}

.event-info-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;

  color: var(--secondary);
}

.event-info-value {
  font-size: clamp(15px, 4vw, 18px);
  font-weight: 500;
  line-height: 1.45;

  white-space: pre-line;
}

/* ==========================================================
   PULSANTI
   ========================================================== */

.story-button {
  position: relative;
  z-index: 3;

  width: fit-content;
  min-width: 210px;
  max-width: 100%;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  margin: 12px auto 0;
  padding: 14px 28px;

  cursor: pointer;

  text-align: center;
  text-decoration: none;

  border: 2px solid var(--secondary);
  border-radius: 999px;

  color: var(--text);

  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.96),
      rgba(247, 232, 195, 0.95)
    );

  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.14),
    inset 0 2px 7px rgba(255, 255, 255, 0.75);

  font-size: 16px;
  font-weight: 700;

  transition:
    transform 0.25s ease,
    filter 0.25s ease,
    box-shadow 0.25s ease;
}

.story-button:hover {
  transform: translateY(-3px);

  filter: brightness(1.04);

  box-shadow:
    0 17px 34px rgba(0, 0, 0, 0.18),
    inset 0 2px 7px rgba(255, 255, 255, 0.75);
}

.story-button:active {
  transform: translateY(0) scale(0.98);
}

.whatsapp-button::before {
  content: "✓";

  margin-right: 9px;

  font-size: 18px;
}

.map-button::before {
  content: "📍";

  margin-right: 8px;
}

/* ==========================================================
   ITINERARIO
   ========================================================== */

.timeline {
  position: relative;
  z-index: 2;

  max-width: 480px;

  margin: 32px auto 0;

  text-align: left;
}

.timeline::before {
  content: "";

  position: absolute;
  top: 20px;
  bottom: 20px;
  left: 27px;

  width: 2px;

  background:
    linear-gradient(
      180deg,
      transparent,
      var(--secondary) 8%,
      var(--secondary) 92%,
      transparent
    );
}

.timeline-item {
  position: relative;

  display: grid;
  grid-template-columns: 56px 1fr;

  gap: 16px;

  padding-bottom: 24px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-marker {
  position: relative;
  z-index: 2;

  width: 56px;
  height: 56px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 3px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;

  font-size: 23px;

  background:
    radial-gradient(
      circle at 30% 25%,
      #fffef9,
      var(--secondary)
    );

  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.14),
    0 0 0 3px rgba(216, 184, 109, 0.16);
}

.timeline-content {
  min-width: 0;

  padding: 13px 16px 15px;

  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 17px;

  background: rgba(255, 255, 255, 0.5);

  box-shadow: 0 9px 22px rgba(0, 0, 0, 0.08);
}

.timeline-time {
  display: block;

  margin-bottom: 2px;

  font-size: 13px;
  font-weight: 700;

  color: var(--secondary);
}

.timeline-title {
  margin: 0;

  font-family: var(--title-font);
  font-size: clamp(23px, 6vw, 30px);
  line-height: 1.1;

  color: var(--primary);
}

.timeline-description {
  margin: 7px 0 0;

  font-size: 14px;
  line-height: 1.55;
}

/* ==========================================================
   REGALO E BAMBINI
   ========================================================== */

.information-card {
  min-height: min(540px, calc(100dvh - 48px));

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.information-icon {
  position: relative;
  z-index: 2;

  width: 100px;
  height: 100px;

  display: flex;
  align-items: center;
  justify-content: center;

  margin: 0 auto 24px;

  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;

  font-size: 48px;

  background:
    radial-gradient(
      circle at 30% 25%,
      rgba(255, 255, 255, 0.98),
      rgba(216, 184, 109, 0.65)
    );

  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.16),
    0 0 0 7px rgba(255, 255, 255, 0.12);
}

/* ==========================================================
   DRESS CODE
   ========================================================== */

.dresscode-preview {
  position: relative;
  z-index: 2;

  width: min(100%, 390px);
  max-height: 480px;

  margin: 26px auto 18px;

  object-fit: contain;

  border: 3px solid rgba(255, 255, 255, 0.78);
  border-radius: 20px;

  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.18);
}

/* ==========================================================
   RSVP
   ========================================================== */

.rsvp-card {
  min-height: min(590px, calc(100dvh - 48px));

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ==========================================================
   FOTO FINALE
   ========================================================== */

.story-module-ending {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
}

.ending-card {
  min-height: min(820px, calc(100dvh - 40px));

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 26px;
}

.ending-photo {
  position: relative;
  z-index: 2;

  width: min(80%, 390px);
  aspect-ratio: 4 / 5;

  object-fit: cover;
  object-position: center;

  border: 3px solid rgba(255, 255, 255, 0.78);
  border-radius: 28px;

  box-shadow:
    0 19px 44px rgba(0, 0, 0, 0.22),
    0 0 0 6px rgba(216, 184, 109, 0.14);
}

.ending-content {
  position: relative;
  z-index: 3;

  width: 100%;
}

.ending-title {
  margin: 0;

  font-family: var(--title-font);
  font-size: clamp(50px, 14vw, 80px);
  font-weight: 600;
  line-height: 1;

  color: var(--primary);
}

.ending-phrase {
  max-width: 460px;

  margin: 18px auto 0;

  font-family: var(--title-font);
  font-size: clamp(21px, 6vw, 29px);
  font-style: italic;
  line-height: 1.45;
}

/* ==========================================================
   VIDEO INTRO
   ========================================================== */

#introVideo,
.intro-video {
  position: fixed;
  inset: 0;
  z-index: 100000;

  width: 100%;
  height: 100%;
  height: 100dvh;

  object-fit: cover;
  object-position: center;

  background: #000;

  opacity: 1;

  transition:
    opacity 0.85s ease,
    transform 0.85s ease;
}

#introVideo.video-hide,
.intro-video.video-hide {
  opacity: 0;
  transform: scale(1.025);

  pointer-events: none;
}

@media (min-width: 769px) {
  #introVideo,
  .intro-video {
    object-fit: contain;
    object-position: center;
    background: #17120f;
  }
}

/* ==========================================================
   ICONA AUDIO
   ========================================================== */

.tap-audio-hint {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));

  z-index: 90000;

  width: 54px;
  height: 54px;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  user-select: none;

  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;

  font-size: 23px;

  background: rgba(35, 25, 35, 0.54);
  color: #fff;

  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  animation: audioPulse 1.8s ease-in-out infinite;
}

/* ==========================================================
   MODALE
   ========================================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200000;

  display: flex;
  align-items: center;
  justify-content: center;

  padding:
    max(20px, env(safe-area-inset-top))
    18px
    max(20px, env(safe-area-inset-bottom));
}

.modal-backdrop {
  position: absolute;
  inset: 0;

  background: rgba(10, 7, 11, 0.78);

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  z-index: 2;

  width: 100%;
  max-width: 540px;
  max-height: calc(100dvh - 40px);

  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  padding: 32px 22px 24px;

  text-align: center;

  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 25px;

  color: var(--text);

  background: rgba(255, 255, 255, 0.96);

  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.36);

  animation: modalOpen 0.28s ease;
}

.modal-content h2 {
  margin: 0 40px 14px;

  font-family: var(--title-font);
  font-size: clamp(32px, 9vw, 45px);
  line-height: 1.1;

  color: var(--primary);
}

.modal-content p {
  margin: 0 auto 20px;

  font-size: 16px;
  line-height: 1.65;

  white-space: pre-line;
}

.modal-image {
  width: 100%;
  height: auto;
  max-height: 68dvh;

  margin: 10px auto 0;

  object-fit: contain;

  border-radius: 16px;

  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.18);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;

  z-index: 3;

  width: 39px;
  height: 39px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;

  cursor: pointer;

  border: 0;
  border-radius: 50%;

  background: var(--secondary);
  color: #fff;

  font-family: Arial, sans-serif;
  font-size: 27px;
  line-height: 1;

  box-shadow: 0 7px 16px rgba(0, 0, 0, 0.18);
}

/* ==========================================================
   FLASH DI TRANSIZIONE
   ========================================================== */

.flash-overlay {
  position: fixed;
  inset: 0;
  z-index: 150000;

  pointer-events: none;

  opacity: 0;

  background:
    radial-gradient(
      circle,
      rgba(255, 255, 255, 1) 0%,
      rgba(255, 249, 218, 0.96) 32%,
      rgba(255, 255, 255, 0.3) 72%,
      transparent 100%
    );
}

.flash-overlay.active {
  animation: flashTransition 0.9s ease-out;
}

/* ==========================================================
   EFFETTI
   ========================================================== */

.effects-root {
  position: fixed;
  inset: 0;
  z-index: 80000;

  overflow: hidden;

  pointer-events: none;
}

.sparkles-layer,
.confetti-layer,
.balloons-layer,
.disco-layer {
  position: fixed;
  inset: 0;

  overflow: hidden;

  pointer-events: none;
}

.sparkles-layer {
  z-index: 4;
}

.sparkle {
  --sparkle-size: 9px;

  position: absolute;

  width: var(--sparkle-size);
  height: var(--sparkle-size);

  opacity: 0;

  animation: sparkleFloat 3s ease-in-out infinite;
}

.sparkle::before,
.sparkle::after {
  content: "";

  position: absolute;
  left: 50%;
  top: 50%;

  border-radius: 999px;

  background: rgba(255, 247, 184, 0.98);

  box-shadow: 0 0 9px rgba(255, 234, 141, 0.9);
}

.sparkle::before {
  width: 100%;
  height: 2px;

  transform: translate(-50%, -50%);
}

.sparkle::after {
  width: 2px;
  height: 100%;

  transform: translate(-50%, -50%);
}

.confetti-layer {
  z-index: 3;

  opacity: 0.75;
}

.confetti-layer::before,
.confetti-layer::after {
  content: "";

  position: absolute;
  inset: -25%;

  background-image:
    radial-gradient(
      circle,
      rgba(255, 221, 124, 0.88) 0 2px,
      transparent 3px
    ),
    radial-gradient(
      circle,
      rgba(255, 255, 255, 0.85) 0 1.6px,
      transparent 2.7px
    ),
    radial-gradient(
      circle,
      rgba(176, 112, 155, 0.82) 0 2px,
      transparent 3px
    );

  background-size:
    115px 115px,
    150px 150px,
    195px 195px;

  animation: confettiFall 12s linear infinite;
}

.confetti-layer::after {
  opacity: 0.55;

  animation-duration: 18s;
  animation-direction: reverse;
}

.balloons-layer {
  z-index: 2;
}

.balloon {
  position: absolute;
  bottom: -120px;

  width: 44px;
  height: 58px;

  border-radius: 50% 50% 46% 46%;

  background:
    radial-gradient(
      circle at 30% 25%,
      hsla(var(--balloon-hue), 100%, 88%, 0.96),
      hsla(var(--balloon-hue), 70%, 56%, 0.9)
    );

  box-shadow:
    inset -8px -8px 14px rgba(0, 0, 0, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.1);

  animation: balloonRise linear infinite;
}

.balloon::before {
  content: "";

  position: absolute;
  left: 50%;
  bottom: -6px;

  width: 10px;
  height: 9px;

  background: inherit;

  clip-path: polygon(50% 0, 100% 100%, 0 100%);

  transform: translateX(-50%);
}

.balloon::after {
  content: "";

  position: absolute;
  left: 50%;
  top: 100%;

  width: 1px;
  height: 50px;

  background: rgba(70, 70, 70, 0.52);

  transform: translateX(-50%);
}

.disco-layer {
  z-index: 1;

  mix-blend-mode: screen;
}

.disco-beam {
  position: absolute;
  top: -15%;

  width: 120px;
  height: 140%;

  opacity: 0.17;

  filter: blur(22px);

  background:
    linear-gradient(
      180deg,
      rgba(255, 214, 135, 0.65),
      rgba(163, 105, 145, 0.32),
      transparent
    );

  animation: discoMove 5.5s ease-in-out infinite alternate;
}

/* ==========================================================
   ANIMAZIONI ALLO SCROLL
   ========================================================== */

.story-module[data-animation="fade"] {
  transform: translateY(24px);
}

.story-module[data-animation="zoom"] {
  transform: scale(0.95);
}

.story-module[data-animation="slide"] {
  transform: translateX(38px);
}

.story-module.module-visible {
  opacity: 1;
  transform: none;
}

/* ==========================================================
   KEYFRAMES
   ========================================================== */

@keyframes audioPulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
  }
}

@keyframes modalOpen {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes flashTransition {
  0% {
    opacity: 0;
  }

  36% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes sparkleFloat {
  0%,
  100% {
    opacity: 0.12;
    transform: translateY(5px) rotate(0deg) scale(0.65);
  }

  50% {
    opacity: 1;
    transform: translateY(-8px) rotate(45deg) scale(1.2);
  }
}

@keyframes confettiFall {
  from {
    transform: translate3d(0, -10%, 0);
  }

  to {
    transform: translate3d(0, 28%, 0);
  }
}

@keyframes balloonRise {
  from {
    transform: translateY(0) rotate(-3deg);
  }

  50% {
    transform: translateY(-65vh) rotate(5deg);
  }

  to {
    transform: translateY(-135vh) rotate(-2deg);
  }
}

@keyframes discoMove {
  from {
    transform: translateX(-55px) rotate(16deg);
  }

  to {
    transform: translateX(75px) rotate(-18deg);
  }
}

/* ==========================================================
   TABLET
   ========================================================== */

@media (max-width: 768px) {
  .storybook {
    max-width: none;

    box-shadow: none;
  }

  .module-overlay {
    padding-left: 14px;
    padding-right: 14px;
  }

  .module-card {
    border-radius: 26px;
  }

  .hero-card,
  .ending-card {
    min-height: calc(100dvh - 28px);
  }
}

/* ==========================================================
   SMARTPHONE PICCOLI
   ========================================================== */

@media (max-width: 430px) {
  .module-overlay {
    padding:
      max(14px, env(safe-area-inset-top))
      10px
      max(14px, env(safe-area-inset-bottom));
  }

  .module-card {
    padding: 30px 18px;

    border-radius: 23px;
  }

  .module-card-image {
    background-size: 100% 100%;
  }

  .hero-card,
  .ending-card {
    padding-top: 28px;
    padding-bottom: 28px;
  }

  .hero-photo-wrap,
  .ending-photo {
    width: min(84%, 340px);
  }

  .presentation-card {
    padding:
      clamp(66px, 20vw, 100px)
      clamp(24px, 8vw, 42px);
  }

  .countdown-grid {
    gap: 6px;
  }

  .countdown-item {
    padding: 14px 3px;

    border-radius: 14px;
  }

  .event-info-item {
    padding: 14px;
  }

  .event-info-icon {
    width: 46px;
    height: 46px;

    font-size: 21px;
  }

  .story-button {
    width: 100%;
    min-width: 0;

    padding-left: 18px;
    padding-right: 18px;
  }

  .timeline {
    margin-top: 25px;
  }

  .timeline-item {
    grid-template-columns: 50px 1fr;

    gap: 11px;
  }

  .timeline::before {
    left: 24px;
  }

  .timeline-marker {
    width: 50px;
    height: 50px;

    font-size: 20px;
  }

  .timeline-content {
    padding: 11px 13px;
  }

  .information-icon {
    width: 88px;
    height: 88px;

    font-size: 42px;
  }

  .tap-audio-hint {
    width: 50px;
    height: 50px;

    font-size: 21px;
  }
}

/* ==========================================================
   SCHERMI MOLTO PICCOLI
   ========================================================== */

@media (max-width: 360px) {
  .module-card {
    padding-left: 15px;
    padding-right: 15px;
  }

  .hero-photo-wrap,
  .ending-photo {
    width: 88%;
  }

  .countdown-value {
    font-size: 31px;
  }

  .countdown-label {
    font-size: 9px;
  }

  .gallery-grid {
    gap: 8px;
  }

  .gallery-item {
    border-radius: 15px;
  }

  .event-info-item {
    gap: 10px;
  }

  .event-info-icon {
    width: 42px;
    height: 42px;
  }

  .timeline-item {
    grid-template-columns: 45px 1fr;
  }

  .timeline::before {
    left: 21px;
  }

  .timeline-marker {
    width: 44px;
    height: 44px;

    font-size: 18px;
  }
}

/* ==========================================================
   DESKTOP GRANDI
   ========================================================== */

@media (min-width: 1000px) {
  body {
    padding: 28px 0;
  }

  .storybook {
    border-radius: 30px;
  }

  .story-module:first-child {
    border-radius: 30px 30px 0 0;
  }

  .story-module:last-child {
    border-radius: 0 0 30px 30px;
  }
}

/* ==========================================================
   RIDUZIONE ANIMAZIONI
   Per dispositivi o utenti che richiedono meno movimento.
   ========================================================== */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .story-module {
    opacity: 1;
    transform: none;
  }
}

/* ==========================================================
   COLORI PERSONALIZZATI PER OGNI MODULO
   I valori arrivano dal blocco "stile" del config.js
   ========================================================== */

.story-module {
  --module-title-color: var(--primary);
  --module-name-color: var(--primary);
  --module-text-color: var(--text);
  --module-accent-color: var(--secondary);

  --module-title-shadow: none;
  --module-name-shadow: none;
  --module-text-shadow: none;

  --module-phrase-bg: transparent;
  --module-title-bg: transparent;
  --module-text-bg: transparent;
}

/* TITOLI GENERICI */

.story-module .module-title {
  width: fit-content;
  max-width: 100%;

  margin-left: auto;
  margin-right: auto;

  padding: 6px 18px;

  color: var(--module-title-color);
  text-shadow: var(--module-title-shadow);

  background: var(--module-title-bg);
  border-radius: 16px;

  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.story-module .module-text {
  width: fit-content;
  max-width: 480px;

  padding: 7px 16px;

  color: var(--module-text-color);
  text-shadow: var(--module-text-shadow);

  background: var(--module-text-bg);
  border-radius: 14px;

  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
/* HERO */

.story-module .hero-kicker {
  color: var(--module-title-color);
  text-shadow: var(--module-title-shadow);
}

.story-module .hero-name {
  color: var(--module-name-color);
  text-shadow: var(--module-name-shadow);
}

.story-module .hero-phrase {
  width: fit-content;
  max-width: 460px;

  padding: 8px 18px;

  color: var(--module-text-color);
  text-shadow: var(--module-text-shadow);

  background: var(--module-phrase-bg);
  border-radius: 18px;

  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* PRESENTAZIONE */

.story-module .presentation-phrase {
  color: var(--module-title-color);
  text-shadow: var(--module-title-shadow);
}

.story-module .presentation-label {
  color: var(--module-accent-color);
}

.story-module .presentation-parents {
  color: var(--module-name-color);
  text-shadow: var(--module-name-shadow);
}

.story-module .presentation-text {
  color: var(--module-text-color);
  text-shadow: var(--module-text-shadow);
}

/* COUNTDOWN */

.story-module .countdown-value,
.story-module .countdown-completed {
  color: var(--module-title-color);
  text-shadow: var(--module-title-shadow);
}

.story-module .countdown-label {
  color: var(--module-text-color);
  text-shadow: var(--module-text-shadow);
}

/* DATA, ORA E LUOGO */

.story-module .event-info-label {
  color: var(--module-accent-color);
}

.story-module .event-info-value {
  color: var(--module-text-color);
  text-shadow: var(--module-text-shadow);
}

/* ITINERARIO */

.story-module .timeline-time {
  color: var(--module-accent-color);
}

.story-module .timeline-title {
  color: var(--module-title-color);
  text-shadow: var(--module-title-shadow);
}

.story-module .timeline-description {
  color: var(--module-text-color);
  text-shadow: var(--module-text-shadow);
}

/* FOTO FINALE */

.story-module .ending-title {
  color: var(--module-name-color);
  text-shadow: var(--module-name-shadow);
}

.story-module .ending-phrase {
  width: fit-content;
  max-width: 460px;

  padding: 8px 18px;

  color: var(--module-text-color);
  text-shadow: var(--module-text-shadow);

  background: var(--module-phrase-bg);
  border-radius: 18px;

  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}