/* ============================================
   Eleonora & Luca — Lista di Nozze
   Mobile-first stylesheet
   ============================================ */

/* ---------- Custom Properties ---------- */
:root {
  --gold: #C9A96E;
  --gold-dark: #9E7C45;
  --gold-light: #E8D5A8;
  --gold-glow: rgba(201, 169, 110, 0.35);
  --ivory: #FAF8F5;
  --cream: #FFF9F0;
  --rose: #DCAE96;
  --burgundy: #722F37;
  --charcoal: #2C2C2C;
  --text-muted: #888;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Lato', 'Helvetica Neue', Arial, sans-serif;
  --font-script: 'Great Vibes', cursive;
  --transition: 0.3s ease;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--ivory);
  color: var(--charcoal);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; height: auto; display: block; }

/* ---------- Hero / Header ---------- */
.hero {
  position: relative;
  width: 100%;
  min-height: 55vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: #1a1a2e;
}

.hero-image {
  position: absolute;
  inset: 0;
}

.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-script);
  font-size: 5rem;
  color: rgba(255, 255, 255, 0.15);
  background: linear-gradient(160deg, #2c5364, #203a43, #0f2027);
}

.hero-image:not(.no-image) .hero-placeholder { display: none; }
.hero-image.no-image img { display: none; }

.hero-overlay {
  position: relative;
  z-index: 1;
  width: 100%;
  text-align: center;
  padding: 3rem 1rem 2rem;
  background: linear-gradient(transparent 0%, rgba(0, 0, 0, 0.55) 40%);
}

.hero-names {
  font-family: var(--font-serif);
  color: var(--gold-light);
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.6);
  line-height: 1.2;
}

.hero-names .amp {
  font-family: var(--font-script);
  font-size: 1.8rem;
  display: inline-block;
  margin: 0 0.15em;
  vertical-align: baseline;
}

.hero-subtitle {
  font-family: var(--font-script);
  color: var(--gold-light);
  font-size: 2rem;
  margin-top: 0.15rem;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.6);
}

.hero-date {
  font-family: var(--font-sans);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.8rem;
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 0.6rem;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* ---------- Screens ---------- */
.screen {
  display: none;
  padding: 2.5rem 1rem 3rem;
  max-width: 500px;
  margin: 0 auto;
}

.screen.active {
  display: block;
  animation: fadeInUp 0.6s ease-out both;
}

/* ---------- Section Intros ---------- */
.section-intro {
  text-align: center;
  margin-bottom: 2rem;
}

.section-intro h2 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--charcoal);
  margin-bottom: 0.3rem;
  font-weight: 700;
}

.section-intro p {
  font-family: var(--font-script);
  color: var(--gold-dark);
  font-size: 1.3rem;
}

/* ---------- Mirror Frame ---------- */
.mirror-frame {
  position: relative;
  margin: 0 auto;
  padding: 14px;
  background: linear-gradient(
    160deg,
    #d4a855 0%, #c9a96e 20%, #b8943f 40%,
    #d4a855 55%, #e8d5a8 70%, #c9a96e 85%, #b8943f 100%
  );
  border-radius: 50% 50% 12px 12px / 22% 22% 12px 12px;
  box-shadow:
    0 4px 24px var(--gold-glow),
    0 12px 48px rgba(201, 169, 110, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

.mirror-frame::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 49% 49% 10px 10px / 21% 21% 10px 10px;
  pointer-events: none;
}

.mirror-crown {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.6rem;
  color: var(--gold-dark);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
  z-index: 5;
  line-height: 1;
}

/* ---------- Carousel ---------- */
.carousel-viewport {
  background: var(--cream);
  border-radius: 48% 48% 8px 8px / 20% 20% 8px 8px;
  overflow: hidden;
  position: relative;
}

.carousel-track {
  display: flex;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.carousel-slide {
  min-width: 100%;
  padding: 2.5rem 1.2rem 1.5rem;
  text-align: center;
  flex-shrink: 0;
}

.slide-image {
  width: 160px;
  height: 160px;
  margin: 0 auto 1rem;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(145deg, #f5f0eb, #ebe3d9);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.slide-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
}

.slide-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide-label {
  font-family: var(--font-script);
  color: var(--gold-dark);
  font-size: 1.5rem;
  margin-bottom: 0.15rem;
}

.slide-name {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--charcoal);
  font-weight: 700;
}

/* Carousel Arrows */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--gold);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  transition: all var(--transition);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  line-height: 1;
  padding-bottom: 2px;
}

.carousel-arrow:active { transform: translateY(-50%) scale(0.92); }
.carousel-arrow-left  { left: -6px; }
.carousel-arrow-right { right: -6px; }
.carousel-arrow.hidden { opacity: 0; pointer-events: none; }

/* Carousel Indicators */
.carousel-indicators {
  text-align: center;
  margin-top: 1.2rem;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold-light);
  transition: all var(--transition);
  border: none;
}

.carousel-dot.active {
  background: var(--gold);
  transform: scale(1.35);
  box-shadow: 0 0 8px var(--gold-glow);
}

.carousel-counter {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  letter-spacing: 0.05em;
}

.carousel-cta {
  text-align: center;
  margin-top: 1.8rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.85rem 2.2rem;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  box-shadow: 0 4px 18px var(--gold-glow);
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 2px 10px var(--gold-glow);
}

.btn-skip {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.6rem 1rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition);
}

.btn-skip:active { color: var(--gold-dark); }

.btn-restart {
  color: var(--gold-dark);
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  letter-spacing: 0.02em;
  transition: color var(--transition);
}

.btn-restart:active { color: var(--gold); }

/* ---------- Piano ---------- */
.piano-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.piano-sequence {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 1.8rem;
  padding: 0 0.5rem;
}

.note-bubble {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--gold-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #bbb;
  transition: all 0.25s ease;
  text-transform: capitalize;
}

.note-bubble.completed {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
  transform: scale(1.05);
}

.note-bubble.current {
  border-color: var(--gold);
  color: var(--gold-dark);
  animation: pulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 12px var(--gold-glow);
}

.note-bubble.wrong {
  border-color: #e74c3c;
  color: #e74c3c;
  animation: shake 0.4s ease-in-out;
}

.piano-body {
  background: linear-gradient(180deg, #333 0%, #1a1a1a 100%);
  border-radius: 14px;
  padding: 16px 8px 12px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.piano-keys {
  display: flex;
  gap: 3px;
  justify-content: center;
}

.piano-key {
  flex: 1;
  max-width: 58px;
  min-height: 110px;
  background: linear-gradient(180deg, #fff 0%, #f8f8f8 85%, #e0e0e0 100%);
  border-radius: 0 0 8px 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #555;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 10px;
  transition: all 0.08s ease;
  box-shadow:
    0 3px 0 #bbb,
    0 4px 6px rgba(0, 0, 0, 0.2);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.piano-key:active,
.piano-key.pressed {
  background: linear-gradient(180deg, #f0f0f0 0%, #e8e8e8 85%, #d8d8d8 100%);
  transform: translateY(2px);
  box-shadow:
    0 1px 0 #bbb,
    0 2px 3px rgba(0, 0, 0, 0.15);
}

.piano-key.correct {
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 100%);
  color: #fff;
  box-shadow:
    0 3px 0 var(--gold-dark),
    0 4px 6px rgba(0, 0, 0, 0.2),
    0 0 20px var(--gold-glow);
}

/* Fa♯ semitone key — styled darker to hint at black key */
.piano-key[data-note="Fa♯"] {
  background: linear-gradient(180deg, #555 0%, #333 85%, #222 100%);
  color: #e8d5a8;
  box-shadow:
    0 3px 0 #111,
    0 4px 6px rgba(0, 0, 0, 0.35);
  font-size: 0.68rem;
}

.piano-key[data-note="Fa♯"]:active,
.piano-key[data-note="Fa♯"].pressed {
  background: linear-gradient(180deg, #444 0%, #2a2a2a 85%, #1a1a1a 100%);
}

.piano-key[data-note="Fa♯"].correct {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: #fff;
}

.piano-actions {
  text-align: center;
  margin-top: 2rem;
}

/* Shake for piano on wrong note */
.piano-keys.shake {
  animation: shake 0.45s ease-in-out;
}

/* ---------- IBAN Reveal ---------- */
.iban-content {
  position: relative;
}

.iban-heading {
  font-family: var(--font-script) !important;
  font-size: 2.2rem !important;
  color: var(--gold-dark) !important;
}

.iban-card {
  background: #fff;
  border-radius: 16px;
  padding: 1.2rem 1.4rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
  margin-bottom: 1.8rem;
  border: 1px solid var(--gold-light);
}

.iban-row {
  padding: 0.7rem 0;
  border-bottom: 1px solid #f2f0ed;
}

.iban-row:last-child { border-bottom: none; }

.iban-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.iban-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--charcoal);
}

.iban-code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  word-break: break-all;
}

.iban-row-code {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
}

.iban-row-code .iban-label {
  width: 100%;
}

.iban-row-code .iban-value {
  flex: 1 1 100%;
}

.btn-copy {
  flex: 0 0 auto;
  margin-top: 6px;
  color: var(--gold);
  padding: 4px 6px;
  transition: color var(--transition);
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-copy:active { color: var(--gold-dark); }

.copy-feedback {
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s;
  color: #4CAF50;
  white-space: nowrap;
}

.btn-copy.copied .copy-feedback { opacity: 1; }
.btn-copy.copied svg { stroke: #4CAF50; }

.iban-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
  line-height: 1.7;
  margin-bottom: 2rem;
  padding: 0 0.5rem;
}

.iban-footer {
  text-align: center;
  padding-top: 0.5rem;
}

.grazie {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--charcoal);
  margin-bottom: 0;
}

.grazie-names {
  font-family: var(--font-script);
  font-size: 1.6rem;
  color: var(--gold-dark);
  margin-bottom: 1.5rem;
}

/* ---------- Confetti ---------- */
#confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 12px;
  opacity: 0;
  animation: confettiFall var(--duration, 3s) var(--delay, 0s) ease-out forwards;
}

/* ---------- Animations ---------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 8px var(--gold-glow); }
  50%      { transform: scale(1.12); box-shadow: 0 0 18px var(--gold-glow); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-6px); }
  80%      { transform: translateX(6px); }
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg) translateX(0);
    opacity: 1;
  }
  15% { opacity: 1; }
  100% {
    transform: translateY(100vh) rotate(var(--spin, 540deg)) translateX(var(--drift, 40px));
    opacity: 0;
  }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 4px 24px var(--gold-glow); }
  50%      { box-shadow: 0 4px 32px rgba(201, 169, 110, 0.55); }
}

/* Mirror subtle glow */
.mirror-frame { animation: glowPulse 3s ease-in-out infinite; }

/* ---------- Desktop (>=768px) ---------- */
@media (min-width: 768px) {
  .hero { min-height: 50vh; }

  .hero-names { font-size: 3.5rem; }
  .hero-subtitle { font-size: 2.5rem; }
  .hero-date { font-size: 0.9rem; }

  .screen {
    padding: 3rem 2rem 4rem;
    max-width: 650px;
  }

  .section-intro h2 { font-size: 1.6rem; }

  .mirror-frame {
    max-width: 420px;
    padding: 18px;
  }

  .slide-image {
    width: 200px;
    height: 200px;
  }

  .piano-key {
    min-height: 140px;
    max-width: 64px;
    font-size: 0.9rem;
  }

  .note-bubble {
    width: 44px;
    height: 44px;
    font-size: 0.72rem;
  }

  .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px var(--gold-glow);
  }

  .carousel-arrow:hover {
    background: var(--gold-dark);
    transform: translateY(-50%) scale(1.08);
  }

  .btn-skip:hover { color: var(--gold-dark); }
  .btn-restart:hover { color: var(--gold); }
  .btn-copy:hover { color: var(--gold-dark); }
}
