/* ==============================================================
   DESIGN TOKENS
   Palette: white / near-black / light gray, single red accent (heart only)
   Type: Fraunces (emotional display serif) + Inter (clean, Apple-like body)
   ============================================================== */
:root{
  --white:        #ffffff;
  --black:        #0a0a0a;
  --gray-50:      #fafafa;
  --gray-100:     #f5f5f7;
  --gray-200:     #e8e8ea;
  --gray-400:     #a1a1a6;
  --gray-600:     #6e6e73;
  --red:          #ff3b30;
  --red-deep:     #d70015;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --ease-out:     cubic-bezier(.16,1,.3,1);
  --ease-in-out:  cubic-bezier(.65,0,.35,1);

  --space-xs: 0.5rem;
  --space-s:  1rem;
  --space-m:  2rem;
  --space-l:  4rem;
  --space-xl: 8rem;
}

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

html{ -webkit-text-size-adjust: 100%; }

body{
  margin:0;
  background: var(--white);
  color: var(--black);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img{ max-width:100%; display:block; }
button{ font-family: inherit; cursor:pointer; border:none; background:none; }

::selection{ background: var(--red); color: var(--white); }

/* ================= AMBIENT DEPTH LAYER ================= */
/* Soft glassmorphic glows drifting behind the content — subtle, not decorative noise */
.ambient-glow{
  position: fixed;
  width: 60vmax; height: 60vmax;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  will-change: transform;
}
.ambient-glow--1{
  top: -20vmax; left: -15vmax;
  background: radial-gradient(circle, rgba(255,59,48,0.10), transparent 70%);
  animation: driftA 26s ease-in-out infinite;
}
.ambient-glow--2{
  bottom: -25vmax; right: -20vmax;
  background: radial-gradient(circle, rgba(0,0,0,0.05), transparent 70%);
  animation: driftB 32s ease-in-out infinite;
}
@keyframes driftA{
  0%,100%{ transform: translate(0,0) scale(1); }
  50%{ transform: translate(4vmax, 6vmax) scale(1.1); }
}
@keyframes driftB{
  0%,100%{ transform: translate(0,0) scale(1); }
  50%{ transform: translate(-5vmax, -4vmax) scale(1.08); }
}

.grain-overlay{
  position: fixed; inset:0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.screen, header, footer{ position: relative; z-index: 2; }

@media (prefers-reduced-motion: reduce){
  .ambient-glow{ animation: none !important; }
}

/* ================= PRELOADER ================= */
#preloader{
  position: fixed; inset:0; z-index: 9999;
  background: var(--white);
  display:flex; align-items:center; justify-content:center;
  transition: opacity .9s var(--ease-out), visibility .9s var(--ease-out);
}
#preloader.is-hidden{ opacity:0; visibility:hidden; pointer-events:none; }
.preloader-heart{
  font-size: 2.4rem;
  color: var(--red);
  animation: preloaderPulse 1.1s ease-in-out infinite;
}
@keyframes preloaderPulse{
  0%,100%{ transform: scale(0.85); opacity:.55; }
  50%{ transform: scale(1.05); opacity:1; }
}

/* ================= SOUND TOGGLE ================= */
.sound-toggle{
  position: fixed;
  top: max(20px, env(safe-area-inset-top));
  right: 20px;
  z-index: 500;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(0,0,0,0.06);
  display:flex; align-items:center; justify-content:center;
  font-size: 1.05rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  transition: transform .4s var(--ease-out), background .4s;
}
.sound-toggle:hover{ transform: scale(1.08); }
.sound-toggle:active{ transform: scale(0.94); }
.screen--dark ~ .sound-toggle,
body.on-dark .sound-toggle{
  background: rgba(20,20,20,0.55);
  border-color: rgba(255,255,255,0.12);
}

/* ================= PROGRESS RAIL ================= */
.progress-rail{
  position: fixed; top:0; left:0; right:0; height:2px;
  background: transparent; z-index: 499;
}
.progress-fill{
  height:100%; width:0%;
  background: var(--red);
  transition: width .1s linear;
}

/* ================= LAYOUT / SCREENS ================= */
#smooth-wrapper{ position:relative; }

.screen{
  position: relative;
  min-height: 100svh;
  width: 100%;
  display:flex;
  flex-direction: column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding: var(--space-l) var(--space-m);
  overflow: hidden;
}

.screen--dark{ background: var(--black); color: var(--white); }

/* Generic reveal primitive — animated via GSAP, this is the resting/hidden state */
[data-reveal]{
  opacity: 0;
  transform: translateY(28px);
  filter: blur(6px);
}

/* ================= SCREEN 1 — HERO ================= */
.screen--hero{ background: var(--white); }

.hero-heart{
  position: relative;
  font-size: clamp(3rem, 10vw, 5rem);
  color: var(--red);
  margin-bottom: var(--space-m);
  opacity: 0;
  filter: drop-shadow(0 0 30px rgba(255,59,48,0.35));
}
.hero-heart::after{
  content:"";
  position:absolute; left:50%; top:50%;
  width: 220%; height: 220%;
  transform: translate(-50%,-50%);
  background: radial-gradient(circle, rgba(255,59,48,0.16), transparent 65%);
  z-index:-1;
}

.hero-title{
  font-family: var(--font-display);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(2rem, 6vw, 3.6rem);
  line-height: 1.15;
  margin: 0 0 var(--space-s);
  letter-spacing: -0.01em;
}

.hero-date{
  font-family: var(--font-body);
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--gray-600);
  font-size: 0.95rem;
  margin: 0 0 var(--space-l);
}

.scroll-hint{
  position:absolute; bottom: 36px; left:50%; transform: translateX(-50%);
  width: 1px; height: 46px; background: var(--gray-200);
  overflow:hidden;
}
.scroll-hint span{
  display:block; width:100%; height: 40%;
  background: var(--black);
  animation: scrollHint 2s var(--ease-in-out) infinite;
}
@keyframes scrollHint{
  0%{ transform: translateY(-100%); }
  100%{ transform: translateY(250%); }
}

/* ================= BUTTONS ================= */
.btn{
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 1rem 2.4rem;
  border-radius: 100px;
  transition: transform .5s var(--ease-out), box-shadow .5s var(--ease-out), background .3s;
}
.btn--primary{
  background: var(--black);
  color: var(--white);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.btn--primary:hover{ transform: translateY(-2px) scale(1.02); box-shadow: 0 12px 32px rgba(0,0,0,0.16); }
.btn--primary:active{ transform: translateY(0) scale(0.98); }

.screen--final .btn--primary{
  background: var(--red);
  box-shadow: 0 8px 28px rgba(255,59,48,0.28);
}
.screen--final .btn--primary:hover{ box-shadow: 0 14px 36px rgba(255,59,48,0.36); }

/* ================= SCREEN 2 — STORY ================= */
.screen--story{ background: var(--gray-100); }
.story-stack{ max-width: 640px; display:flex; flex-direction:column; gap: var(--space-m); }
.story-line{
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 2.1rem);
  font-weight: 400;
  line-height: 1.4;
  color: var(--black);
  margin:0;
}
.story-line--accent{ font-style: italic; color: var(--red-deep); }

/* ================= SCREEN 3 — GALLERY ================= */
.screen--gallery{ padding-top: var(--space-xl); padding-bottom: var(--space-xl); justify-content:flex-start; }
.eyebrow{
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 600;
  margin-bottom: var(--space-s);
}
.section-title{
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.6rem, 4.5vw, 2.6rem);
  line-height: 1.25;
  margin: 0 0 var(--space-l);
  max-width: 700px;
}

.gallery-grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-s);
  width: 100%;
  max-width: 1100px;
}
.gallery-card{
  position:relative;
  aspect-ratio: 4/5;
  border-radius: 20px;
  overflow:hidden;
  background: linear-gradient(160deg, var(--gray-100), var(--gray-200));
  box-shadow: 0 20px 44px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.04);
  transition: box-shadow .5s var(--ease-out), transform .5s var(--ease-out);
  will-change: transform;
}
.gallery-card:hover{ box-shadow: 0 28px 60px rgba(0,0,0,0.14), 0 4px 12px rgba(0,0,0,0.06); }
.gallery-card:nth-child(3n+2){ grid-row: span 1; transform: translateY(24px); }
.gallery-card img{ width:100%; height:100%; object-fit:cover; }
.gallery-card .gallery-placeholder{
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  color: var(--gray-400);
  font-size: 1.6rem;
}
.gallery-caption{
  position:absolute; left:0; right:0; bottom:0;
  padding: 1rem 1.1rem;
  background: linear-gradient(to top, rgba(0,0,0,0.55), transparent);
  color: var(--white);
  font-size: 0.82rem;
  font-weight: 500;
  opacity:0;
  transform: translateY(6px);
  transition: opacity .4s var(--ease-out), transform .4s var(--ease-out);
}
.gallery-card:hover .gallery-caption{ opacity:1; transform: translateY(0); }
.gallery-card:hover{ transform: scale(1.015); }

@media (max-width: 720px){
  .gallery-grid{ grid-template-columns: repeat(2, 1fr); }
  .gallery-card:nth-child(3n+2){ transform:none; }
}

/* ================= SCREEN 4 — BUT... ================= */
.screen--but{ gap: var(--space-m); }
.but-line{
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-style: italic;
  font-weight: 400;
  margin:0;
}
.but-line--1{ color: var(--gray-400); }
.but-line--3{
  text-shadow: 0 0 24px rgba(255,255,255,0.25);
  animation: butGlow 3.2s ease-in-out infinite;
}
@keyframes butGlow{
  0%,100%{ text-shadow: 0 0 18px rgba(255,255,255,0.15); }
  50%{ text-shadow: 0 0 32px rgba(255,255,255,0.32); }
}

/* ================= SCREEN 5 — JOURNEY ================= */
.screen--journey{ gap: var(--space-l); }
.journey-icons{
  display:flex;
  align-items:center;
  gap: var(--space-l);
}
.journey-icon{ width: 56px; height:56px; opacity:0; }
.journey-icon svg{ width:100%; height:100%; overflow: visible; }
.journey-icon .draw-path{ fill: none !important; }

.spell-out{
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2.6rem, 9vw, 5.5rem);
  letter-spacing: 0.01em;
  min-height: 1.3em;
  text-shadow: 0 0 40px rgba(255,255,255,0.18);
}
.spell-out .letter{
  display:inline-block;
  opacity: 0;
  transform: translateY(0.25em) scale(0.5);
}
.italy-flag{
  font-size: 2.2rem;
  opacity:0;
  transform: scale(0.6);
}

/* ================= SCREEN 6 — BOARDING PASS ================= */
.screen--ticket{ background: var(--gray-100); perspective: 1400px; }

.boarding-pass{
  display:flex;
  max-width: 720px;
  width:100%;
  border-radius: 24px;
  overflow:hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.14), 0 4px 16px rgba(0,0,0,0.06);
  background: var(--white);
  transform-style: preserve-3d;
  opacity: 0;
  transform: rotateX(18deg) translateY(50px) scale(0.94);
}
.bp-main{
  flex: 1 1 auto;
  padding: 2.4rem 2.2rem;
  text-align:left;
  position:relative;
  overflow:hidden;
}

/* Ink stamp — appears after the ticket details settle */
.bp-stamp{
  position:absolute;
  top: 1.6rem; right: 1.8rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  color: var(--red-deep);
  border: 2.5px solid var(--red-deep);
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  transform: rotate(-14deg) scale(2.6);
  opacity: 0;
  mix-blend-mode: multiply;
}
.bp-row--route{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom: 1.6rem;
}
.bp-city{ display:flex; flex-direction:column; }
.bp-city--right{ align-items:flex-end; text-align:right; }
.bp-code{
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.bp-city-name{ font-size: 0.8rem; color: var(--gray-600); margin-top: 2px; }
.bp-plane-track{ flex:1; color: var(--gray-400); padding: 0 1.2rem; }
.bp-plane-track svg{ width:100%; height:20px; }

.bp-divider{
  border-top: 1.5px dashed var(--gray-200);
  margin-bottom: 1.6rem;
}
.bp-row--details{
  display:flex; justify-content:space-between; gap: 1rem;
  margin-bottom: 1.2rem;
}
.bp-field{ display:flex; flex-direction:column; gap: 4px; }
.bp-label{ font-size: 0.66rem; text-transform:uppercase; letter-spacing: 0.08em; color: var(--gray-400); }
.bp-value{ font-size: 0.92rem; font-weight: 600; }

.bp-stub{
  flex: 0 0 130px;
  background: var(--black);
  color: var(--white);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap: 0.9rem;
  position:relative;
  padding: 1.5rem 0.8rem;
}
.bp-stub::before{
  content:"";
  position:absolute; left:-11px; top:0; bottom:0; width:22px;
  background:
    radial-gradient(circle 11px at 11px 0, transparent 11px, var(--gray-100) 11.5px) top left / 22px 22px repeat-y;
}
.bp-stub-heart{ color: var(--red); font-size: 1.5rem; }
.bp-barcode{
  width: 70%; height: 46px;
  background: repeating-linear-gradient(90deg, var(--white) 0 2px, transparent 2px 5px);
  opacity: 0.85;
}
.bp-stub-label{ font-size: 0.62rem; letter-spacing: 0.14em; opacity: 0.6; }

@media (max-width: 640px){
  .boarding-pass{ flex-direction:column; border-radius:20px; }
  .bp-stub{
    flex-direction:row;
    justify-content: space-between;
    flex-basis:auto;
    padding: 1rem 1.4rem;
  }
  .bp-stub::before{
    left:0; right:0; top:-11px; bottom:auto; width:auto; height:22px;
    background:
      radial-gradient(circle 11px at 0 11px, transparent 11px, var(--gray-100) 11.5px) top left / 22px 22px repeat-x;
  }
  .bp-barcode{ width: 40%; height: 34px; }
}

/* ================= SCREEN 7 — REVEAL ================= */
.screen--reveal{ background: var(--white); }
.reveal-big{
  font-family: var(--font-display);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(2.4rem, 9vw, 5rem);
  line-height: 1.1;
  margin: 0 0 var(--space-m);
  color: var(--red-deep);
}
.reveal-sub{
  font-size: clamp(1rem, 2.6vw, 1.3rem);
  color: var(--gray-600);
  margin: 0.4rem 0;
}
.reveal-sub--accent{ color: var(--black); font-weight: 500; }

/* ================= FINAL SCREEN ================= */
.screen--final{ background: var(--black); color: var(--white); gap: 0; }
.final-heart{
  position: relative;
  font-size: clamp(2.6rem, 8vw, 3.6rem);
  color: var(--red);
  margin-bottom: var(--space-m);
  filter: drop-shadow(0 0 36px rgba(255,59,48,0.45));
}
.final-heart::after{
  content:"";
  position:absolute; left:50%; top:50%;
  width: 260%; height: 260%;
  transform: translate(-50%,-50%);
  background: radial-gradient(circle, rgba(255,59,48,0.22), transparent 65%);
  z-index:-1;
}
.final-line{
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3.6vw, 1.9rem);
  font-weight: 400;
  max-width: 620px;
  margin: 0.3rem 0;
  color: var(--gray-400);
}
.final-line--accent{ color: var(--white); font-style: italic; }
.btn--final{ margin-top: var(--space-l); margin-bottom: var(--space-l); }

.countdown-wrap{
  opacity:0;
  transform: translateY(16px);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out);
  margin-top: var(--space-m);
}
.countdown-wrap.is-visible{ opacity:1; transform:none; }
.countdown-dates{
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--red);
  margin: 0 0 0.3rem;
}
.countdown-label{ font-size: 0.85rem; color: var(--gray-400); margin: 0 0 1.2rem; }
.countdown{ display:flex; gap: 1.4rem; }
.cd-unit{ display:flex; flex-direction:column; align-items:center; min-width: 56px; }
.cd-num{
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.cd-label{ font-size: 0.68rem; letter-spacing: 0.08em; text-transform:uppercase; color: var(--gray-600); }

/* ================= FX CANVAS (confetti + hearts) ================= */
#fxCanvas{
  position: fixed; inset:0;
  width:100%; height:100%;
  pointer-events:none;
  z-index: 600;
}

/* ================= REDUCED MOTION ================= */
@media (prefers-reduced-motion: reduce){
  [data-reveal]{ opacity:1 !important; transform:none !important; filter:none !important; }
  .preloader-heart, .scroll-hint span{ animation:none !important; }
  *{ transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ================= FOCUS ================= */
button:focus-visible{
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

/* ================= RESPONSIVE TWEAKS ================= */
@media (max-width: 480px){
  .screen{ padding: var(--space-m) var(--space-s); }
  .journey-icons{ gap: var(--space-m); }
  .journey-icon{ width: 42px; height:42px; }
  .countdown{ gap: 0.8rem; }
  .cd-unit{ min-width: 46px; }
}
