/* ========== Save the Date — stile prototipo ========== */
:root {
  --std-gold: #caa24a;
  --std-gold-dark: #a98427;
  --std-green: #2f4f3f;
  --std-secondary: #2f4f3f;
  --std-bg: #fbf8f1;
  --std-text: #2c2a26;
  --std-color-text: #2c2a26;
  --std-on-bg: #2c2a26;
}

html, body {
  scrollbar-width: none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar { display: none; }

/* Breadcrumb — visibile ma discreto, utile a Google e agli screen reader */
.std-breadcrumb {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  z-index: 10;
  padding: 8px 16px;
  background: rgba(0,0,0,0.25);
}
.std-breadcrumb ol {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; align-items: center; gap: 6px;
  font-size: 0.75rem;
}
.std-breadcrumb li { color: rgba(255,255,255,0.7); }
.std-breadcrumb li + li::before { content: '/'; margin-right: 6px; opacity: 0.5; }
.std-breadcrumb a { color: rgba(255,255,255,0.85); text-decoration: none; }
.std-breadcrumb a:hover { color: #fff; text-decoration: underline; }
.std-breadcrumb li[aria-current="page"] { color: rgba(255,255,255,0.5); }

.std-root {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--std-bg);
  color: var(--std-text);
  min-height: 100vh;
  overflow-x: hidden;
}

.std-section {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  text-align: center;
}

.std-reveal-section {
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: 2rem;
  padding-bottom: 2rem;
  justify-content: center;
  gap: 1rem;
}
.std-reveal-section .std-countdown-block {
  max-width: 36rem;
}
.std-reveal-section .std-countdown-title {
  margin-bottom: 0.5rem;
}

/* ---------- 1. Porte/tende iniziali ---------- */
.std-doors {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  cursor: pointer;
  background: var(--std-bg);
}

.std-door {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background-color: var(--std-green);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 1.4s cubic-bezier(0.65, 0, 0.35, 1);
  z-index: 5;
}

.std-door-left  { background-image: url('/assets-std/img/door-wo-sx.png'); background-position: right center; background-size: cover; }
.std-door-right { background-image: url('/assets-std/img/door-wo-dx.png'); background-position: left center;  background-size: cover; }


.std-door-left { left: 0; transform-origin: left center; }
.std-door-right { right: 0; transform-origin: right center; }

.std-doors.is-open .std-door-left { transform: translateX(-100%); pointer-events: none; }
.std-doors.is-open .std-door-right { transform: translateX(100%); pointer-events: none; }

.std-door-label {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  color: var(--std-gold);
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.std-doors-hint {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  animation: std-pulse 2.4s ease-in-out infinite;
  color: #fff;
  text-shadow:
    0 0 4px rgba(0,0,0,0.8),
    0 1px 3px rgba(0,0,0,0.6);
  -webkit-text-stroke: 0.4px rgba(0,0,0,0.5);
}

@keyframes std-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.std-doors.is-open .std-doors-hint { display: none; }

/* Testo + Scorri che appaiono nella stessa schermata, dopo l'apertura delle porte */
.std-doors-reveal {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 1.5rem;
  pointer-events: none;
}
.std-doors.is-open .std-doors-reveal {
  pointer-events: auto;
}

/* Frame: zoom from small — hidden by default, triggered by .is-open */
.std-doors-reveal-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: -1;
  width: min(92vw, 26rem);
  height: auto;
  aspect-ratio: 1080 / 1920;
  max-height: 92vh;
  object-fit: contain;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.8s ease 1.2s;
}
.std-doors.is-open .std-doors-reveal-frame {
  opacity: 1;
}

/* Couple names: zoom from small, delay 1s after door open */
.std-couple-names {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  color: var(--std-gold-dark);
  margin-bottom: 1rem;
  line-height: 1.15;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 1.8s ease 3.3s, transform 2.1s cubic-bezier(0.22, 1, 0.36, 1) 3.3s;
}
.std-doors.is-open .std-couple-names {
  opacity: 1;
  transform: scale(1);
}

.std-couple-name {
  display: block;
  font-size: 3rem;
}

.std-couple-amp {
  display: block;
  font-size: 1.6rem;
  margin: 0.1em 0;
}

@media (min-width: 640px) {
  .std-couple-name { font-size: 4rem; }
  .std-couple-amp { font-size: 2.2rem; }
}

/* Dedication text: slow fade-in, delay 2.2s after door open */
.std-doors-reveal p {
  font-size: clamp(1.2rem, 2.8vw, 1.5rem);
  color: var(--std-color-text);
  max-width: 15rem;
  line-height: 1.6;
  opacity: 0;
  transition: opacity 1.8s ease 5.85s;
}
.std-doors.is-open .std-doors-reveal p {
  opacity: 1;
}

.std-doors-reveal .std-scroll-cta {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--std-on-bg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}
.std-doors-reveal .std-scroll-cta.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.std-scroll-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--std-on-bg);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: 0.8rem;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.std-scroll-cta:hover { opacity: 0.7; }
.std-scroll-cta svg {
  animation: std-bounce-down 1.8s ease-in-out infinite;
}
#stdRsvpScrollBtn {
  margin-top: 0.5rem;
  opacity: 0;
  visibility: hidden;
}
#stdRsvpScrollBtn.is-visible {
  opacity: 1;
  visibility: visible;
}

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

/* ---------- 3. Cerchi scratch ---------- */

.std-scratch-grid {
  display: flex;
  gap: clamp(0.5rem, 3vw, 2rem);
  justify-content: center;
  flex-wrap: nowrap;
  margin-top: 1rem;
}

.std-scratch-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.std-scratch-circle {
  position: relative;
  width: clamp(78px, 24vw, 140px);
  height: clamp(78px, 24vw, 140px);
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  background: #fff;
}

.std-scratch-circle .std-scratch-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: clamp(1.1rem, 4.5vw, 1.7rem);
  color: var(--std-secondary);
  text-transform: capitalize;
  padding: 0.4rem;
  text-align: center;
}

#stdScratchValue_day,
#stdScratchValue_year {
  font-size: clamp(2.2rem, 9vw, 3.4rem);
}

.std-scratch-circle canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.std-scratch-label {
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--std-secondary);
  opacity: 0.7;
}

.std-scratch-hint {
  margin-top: 0.75rem;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--std-text);
  opacity: 0.55;
}

/* ---------- 4. Reveal + confetti ---------- */
.std-confetti-piece {
  position: fixed;
  top: -10px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 200;
  animation: std-confetti-fall linear forwards;
}

@keyframes std-confetti-fall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0.2;
  }
}

.std-reveal-text {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-weight: 700;
  font-size: clamp(1.3rem, 5vw, 2.2rem);
  color: var(--std-gold-dark);
  margin-top: 0.5rem;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.std-reveal-text.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- 5. Countdown con barca (annidato nella sezione reveal) ---------- */
.std-countdown-block {
  position: relative;
  width: 95%;
  margin-top: 0.75rem;
  padding: 1.25rem 1.25rem 0.5rem;
  background: var(--std-secondary);
  color: #fff;
  overflow: visible;
  text-align: center;
  border-radius: 1.25rem;
  opacity: 0;
  transform: translateY(24px);
  visibility: hidden;
  transition: opacity 0.9s ease, transform 0.9s ease, visibility 0.9s ease;
}
.std-countdown-block.is-visible {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.std-scratch-rings {
  width: clamp(96px, 32vw, 84px);
  height: auto;
  margin-bottom: 0.5rem;
}

@media (min-width: 640px) {
  .std-scratch-rings {
    width: clamp(48px, 16vw, 84px);
  }
}

.std-scratch-title {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: clamp(1.2rem, 4vw, 1.7rem);
  margin-bottom: 0.25rem;
  color: var(--std-secondary);
}

.std-scratch-subtitle {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--std-color-text);
  opacity: 0.6;
  margin-bottom: 0.25rem;
}

.std-countdown-title {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  color: var(--std-color-text);
}

.std-countdown-wrap {
  position: relative;
  display: inline-block;
}

.std-countdown-grid {
  display: flex;
  gap: clamp(0.35rem, 2vw, 1.75rem);
  padding-bottom: 1.75rem;
  width: 100%;
  justify-content: center;
}

/* Rivelazione iniziale countdown (clip-path wipe da sx a dx, sempre) */
.std-countdown-grid.reveal-wipe {
  clip-path: inset(0 100% 0 0);
}
.std-countdown-grid.reveal-wipe.is-revealed {
  animation: std-reveal-wipe 4.5s ease-in-out forwards;
}
@keyframes std-reveal-wipe {
  to { clip-path: inset(0 0% 0 0); }
}

/* Rivelazione fade */
.std-countdown-grid.reveal-fade {
  opacity: 0;
  transition: none;
}
.std-countdown-grid.reveal-fade.is-revealed {
  animation: std-reveal-fade 3s ease-out forwards;
}
@keyframes std-reveal-fade {
  to { opacity: 1; }
}

/* Rivelazione flip */
.std-countdown-grid.reveal-flip .std-countdown-item {
  opacity: 0;
  transform: rotateY(90deg);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.std-countdown-grid.reveal-flip.is-revealed .std-countdown-item:nth-child(1) { opacity: 1; transform: rotateY(0); transition-delay: 0s; }
.std-countdown-grid.reveal-flip.is-revealed .std-countdown-item:nth-child(2) { opacity: 1; transform: rotateY(0); transition-delay: 0.4s; }
.std-countdown-grid.reveal-flip.is-revealed .std-countdown-item:nth-child(3) { opacity: 1; transform: rotateY(0); transition-delay: 0.8s; }
.std-countdown-grid.reveal-flip.is-revealed .std-countdown-item:nth-child(4) { opacity: 1; transform: rotateY(0); transition-delay: 1.2s; }

.std-countdown-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: clamp(46px, 12vw, 80px);
}

.std-countdown-num {
  display: inline-block;
  font-family: 'Playfair Display', serif;
  font-weight: 200;
  font-size: clamp(1.7rem, 6.5vw, 2.8rem);
  line-height: 1;
  overflow: hidden;
  position: relative;
}

/* Tick animations on number change */
@keyframes std-tick-wipe-out  { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-60%); opacity: 0; } }
@keyframes std-tick-wipe-in   { from { transform: translateY(60%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes std-tick-fade-out  { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(1.35); } }
@keyframes std-tick-fade-in   { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: scale(1); } }
@keyframes std-tick-flip-out  { from { transform: rotateX(0deg); opacity: 1; } to { transform: rotateX(-90deg); opacity: 0; } }
@keyframes std-tick-flip-in   { from { transform: rotateX(90deg); opacity: 0; } to { transform: rotateX(0deg); opacity: 1; } }

.std-countdown-num.tick-out-wipe { animation: std-tick-wipe-out 0.18s ease-in forwards; }
.std-countdown-num.tick-in-wipe  { animation: std-tick-wipe-in  0.18s ease-out forwards; }
.std-countdown-num.tick-out-fade { animation: std-tick-fade-out 0.18s ease-in forwards; }
.std-countdown-num.tick-in-fade  { animation: std-tick-fade-in  0.18s ease-out forwards; }
.std-countdown-num.tick-out-flip { animation: std-tick-flip-out 0.2s ease-in forwards; transform-style: preserve-3d; backface-visibility: hidden; }
.std-countdown-num.tick-in-flip  { animation: std-tick-flip-in  0.2s ease-out forwards; transform-style: preserve-3d; backface-visibility: hidden; }

.std-countdown-label {
  margin-top: 0.4rem;
  font-size: clamp(0.55rem, 1.8vw, 0.7rem);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  white-space: nowrap;
}

.std-boat-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  pointer-events: none;
  overflow: visible;
}

.std-boat {
  position: absolute;
  bottom: var(--std-boat-y, 55%);
  transform: translateY(50%);
  left: -10%;
}

.std-boat img {
  display: block;
  width: clamp(3.2rem, 10vw, 4.8rem);
  height: auto;
}

.flip-h {
  transform: scaleX(-1);
}
.std-boat.is-sailing {
  animation: std-sail-across 4.5s ease-in-out forwards, std-boat-bob 2.6s ease-in-out infinite;
}

@keyframes std-sail-across {
  0%   { left: -10%; }
  100% { left: 105%; }
}

@keyframes std-boat-bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -6px; }
}

/* ---------- 3. Foto della coppia ---------- */
.std-photo-section {
  gap: 1.2rem;
}

.std-carousel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.std-photo-frame {
  margin: 0;
  padding: 0.6rem;
  background: #fff;
  border: 1px solid rgba(202, 162, 74, 0.55);
  border-radius: 1.25rem;
  box-shadow: 0 1.5rem 3.5rem rgba(47, 79, 63, 0.18);
  max-width: min(85vw, 28rem);
  max-height: 80%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.std-photo-img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: calc(80dvh - 1.2rem);
  object-fit: cover;
  border-radius: 0.85rem;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.std-photo-img.is-fading {
  opacity: 0;
}

.std-photo-img.is-sliding-out {
  opacity: 0;
  transform: translateX(-8%);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.std-photo-img.is-sliding-in {
  animation: std-slide-in 0.45s ease forwards;
}

@keyframes std-slide-in {
  from { opacity: 0; transform: translateX(8%); }
  to   { opacity: 1; transform: translateX(0); }
}

.std-photo-img.kenburns-a {
  animation: std-kenburns-a 3.5s ease-in-out forwards;
}

.std-photo-img.kenburns-b {
  animation: std-kenburns-b 3.5s ease-in-out forwards;
}

@keyframes std-kenburns-a {
  from { transform: scale(1)    translateX(0); }
  to   { transform: scale(1.08) translateX(-2%); }
}

@keyframes std-kenburns-b {
  from { transform: scale(1)    translateX(0); }
  to   { transform: scale(1.08) translateX(2%); }
}

.std-photo-img.is-flipping-out {
  opacity: 0;
  transform: perspective(600px) rotateY(90deg);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.std-photo-img.is-flipping-in {
  animation: std-flip-in 0.35s ease forwards;
}
@keyframes std-flip-in {
  from { opacity: 0; transform: perspective(600px) rotateY(-90deg); }
  to   { opacity: 1; transform: perspective(600px) rotateY(0deg); }
}

.std-photo-img.is-zooming-out {
  opacity: 0;
  transform: scale(1.12);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.std-photo-img.is-zooming-in {
  animation: std-zoom-in 0.45s ease forwards;
}
@keyframes std-zoom-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.std-carousel-dots {
  display: flex;
  gap: 0.5rem;
}

.std-carousel-dots.is-hidden {
  display: none;
}

.std-carousel-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--std-gold);
  opacity: 0.35;
  transition: opacity 0.3s ease;
}

.std-carousel-dot.is-active {
  opacity: 1;
}

/* ---------- Pensiero per gli sposi (placeholder form) ---------- */
.std-rsvp h2 {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  color: var(--std-secondary);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  margin-top: -5rem;
  margin-bottom: 1rem;
}

.std-rsvp-intro {
  opacity: 0.7;
  max-width: 28rem;
  margin: 0.2rem auto 1rem;
  line-height: 1.6;
  color: var(--std-color-text);
}

.std-rsvp-name {
  width: 100%;
  max-width: 26rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--std-text);
  padding: 0.85rem 1.1rem;
  border: 1px solid rgba(202, 162, 74, 0.4);
  border-radius: 0.85rem;
  background: #fff;
  margin-bottom: 1.25rem;
}
.std-rsvp-name:focus {
  outline: none;
  border-color: var(--std-gold-dark);
}

.std-rsvp-presets {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  max-width: 26rem;
  margin-bottom: 1rem;
}

.std-rsvp-preset {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  text-align: left;
  padding: 0.85rem 1.1rem;
  border: 1px solid rgba(202, 162, 74, 0.4);
  border-radius: 0.85rem;
  background: #fff;
  color: var(--std-color-text);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.std-rsvp-preset:hover {
  border-color: var(--std-gold);
  background: rgba(202, 162, 74, 0.08);
}
.std-rsvp-preset.is-selected {
  border-color: var(--std-gold-dark);
  background: rgba(202, 162, 74, 0.16);
  transform: translateY(-1px);
}

.std-rsvp-label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--std-on-bg);
  opacity: 0.6;
  margin-bottom: 0.6rem;
}

.std-rsvp-textarea {
  width: 100%;
  max-width: 26rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--std-text);
  padding: 0.85rem 1.1rem;
  border: 1px solid rgba(202, 162, 74, 0.4);
  border-radius: 0.85rem;
  background: #fff;
  resize: vertical;
  margin-bottom: 1rem;
}
.std-rsvp-textarea:focus {
  outline: none;
  border-color: var(--std-gold-dark);
}

/* ---------- Loading + error screen ---------- */
.std-loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--std-bg, #fbf8f1);
  z-index: 9999;
}
.std-loading-spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid rgba(202,162,74,0.25);
  border-top-color: var(--std-gold, #caa24a);
  border-radius: 50%;
  animation: std-spin 0.8s linear infinite;
}
@keyframes std-spin { to { transform: rotate(360deg); } }

.std-error-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Sans', sans-serif;
  color: var(--std-text, #2c2a26);
  font-size: 1rem;
  text-align: center;
  padding: 2rem;
}

.std-rsvp-submit {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #fff;
  background: var(--std-secondary);
  border: none;
  border-radius: 999px;
  padding: 0.9rem 2.5rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.std-rsvp-submit:hover {
  background: #1c332a;
  transform: translateY(-1px);
}
.std-rsvp-error {
  font-size: 0.8rem;
  color: #c0392b;
  text-align: center;
  margin-top: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
  .std-door, .std-doors-hint, .std-confetti-piece, .std-reveal-text,
  .std-countdown-grid, .std-boat { animation: none !important; transition: none !important; }
}
