:root {
  --ivory: #EBE4D3;
  --ivory-deep: #DCD2B8;
  --sage: #6E7C5C;
  --sage-deep: #4F5A41;
  --pink: #C98F92;
  --pink-soft: #E3C4C2;
  --gold: #A9793F;
  --gold-soft: #C9A15E;
  --ink: #35392E;
  --ink-soft: #5B6350;
  --paper: #F3EEE1;

  --font-display: 'Cormorant Garamond', serif;
  --font-alt: 'Marcellus', serif;
  --font-arabic: 'Amiri', serif;
  --font-body: 'Jost', sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  overflow-x: hidden;
  position: relative;
}

::selection { background: var(--pink-soft); color: var(--ink); }

/* ============ PETAL CANVAS ============ */
#petal-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 40;
}

#butterfly-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100vh;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}

/* ============ ENVELOPE INTRO ============ */
#envelope-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background-color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: opacity 1.1s ease, visibility 1.1s ease;
}
#envelope-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.envelope-bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
}
.envelope-video-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(ellipse at center, rgba(243,238,225,0.32) 0%, rgba(243,238,225,0.55) 100%);
}
.envelope-frame {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 40px;
  max-width: 480px;
  transition: opacity 0.6s ease;
}
.envelope-frame.fading-out {
  opacity: 0;
}
.envelope-invite-text {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(4.0rem, 10vw, 6.5rem);
  color: #7d5237;
  line-height: 1.15;
  margin-bottom: 2.8rem;
  letter-spacing: 0.02em;
  text-shadow: 0.8px 0 #7d5237, -0.8px 0 #7d5237;
}
.envelope-invite-sep {
  color: var(--pink);
  font-style: italic;
  margin: 0 0.3em;
}
.envelope-wax {
  position: relative;
  width: 190px;
  height: 190px;
  margin: 0 auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: waxPulse 2.6s ease-in-out infinite;
}
@keyframes waxPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
.wax-ring-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 6px 14px rgba(169,121,63,0.3));
}
.wax-ring-text {
  position: relative;
  z-index: 2;
  font-family: var(--font-alt);
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  color: var(--sage-deep);
}
.envelope-tap {
  margin-top: 1.4rem;
  font-size: 1.2rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ============ MUSIC TOGGLE ============ */
#music-toggle {
  position: fixed;
  top: 22px;
  right: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--gold-soft);
  background: rgba(243,238,225,0.85);
  backdrop-filter: blur(4px);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 60;
  transition: transform 0.3s ease, background 0.3s ease;
}
#music-toggle:hover { transform: scale(1.08); }
#music-toggle.muted { color: var(--ink-soft); opacity: 0.6; }
#music-toggle svg { width: 20px; height: 20px; }

/* ============ SECTION BASE ============ */
.section-block {
  position: relative;
  z-index: 10;
  padding: 6rem 1.5rem;
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}
.section-eyebrow {
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.8rem;
}
.section-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.9rem, 4.5vw, 2.8rem);
  color: var(--sage-deep);
  margin: 0 0 2.5rem;
}

/* ============ HERO ============ */
.hero-section {
  position: relative;
  width: 100%;
  max-width: none;
  padding: 0;
  margin: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}
.hero-video-wrap {
  position: relative;
  height: 100%;
  width: 100%;
  max-width: 480px; /* keeps a phone-like frame even on wide desktop viewports */
  margin: 0 auto;
  overflow: hidden;
}
#hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
/* ============ COUNTDOWN ============ */
.countdown-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.4rem, 2vw, 1.2rem);
  flex-wrap: wrap;
}
.countdown-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 78px;
  padding: 1.2rem 0.6rem;
  border: 1px solid var(--gold-soft);
  border-radius: 10px;
  background: rgba(255,255,255,0.25);
}
.countdown-num {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.8rem);
  color: var(--sage-deep);
  font-weight: 500;
}
.countdown-label {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 0.3rem;
}
.countdown-sep {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--gold-soft);
}

/* ============ SCHEDULE ============ */
.schedule-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 460px;
  margin: 0 auto;
  position: relative;
}
.schedule-timeline::before {
  content: '';
  position: absolute;
  left: 100px;
  top: 10px;
  bottom: 10px;
  width: 1px;
  background: var(--gold-soft);
}
.schedule-item {
  display: grid;
  grid-template-columns: 90px 20px 1fr;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 0;
  text-align: left;
}
.schedule-time {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--gold);
  text-align: right;
}
.schedule-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--pink);
  justify-self: center;
  position: relative;
  z-index: 2;
  box-shadow: 0 0 0 4px var(--paper);
}
.schedule-name {
  font-family: var(--font-alt);
  font-size: 1.05rem;
  color: var(--sage-deep);
}

/* ============ CERTIFICATE ============ */
.cert-card {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.4), rgba(255,255,255,0.1));
  border: 1px solid var(--gold-soft);
  border-radius: 16px;
  padding: 3.2rem 2.2rem;
  overflow: visible;
}
.cert-ornament { position: absolute; width: 150px; height: 150px; pointer-events: none; }
.cert-ornament img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cert-ornament-tl { top: -18px; left: -18px; }
.cert-ornament-br { bottom: -18px; right: -18px; }
@media (max-width: 640px) {
  .cert-ornament { width: 100px; height: 100px; }
  .cert-ornament-tl { top: -10px; left: -10px; }
  .cert-ornament-br { bottom: -10px; right: -10px; }
}
.cert-bismillah { font-family: var(--font-arabic); color: var(--gold); font-size: 1.2rem; margin-bottom: 0.6rem; }
.cert-heading {
  font-size: 0.78rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 1.2rem;
}
.cert-names {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  color: var(--sage-deep);
}
.cert-amp { font-style: italic; color: var(--pink); font-size: 0.7em; margin: 0 0.3em; }
.cert-divider-img {
  display: block;
  width: 150px;
  height: auto;
  margin: 1.6rem auto;
  opacity: 0.9;
}
.cert-families {
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}
.cert-family-label {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.3rem;
}
.cert-family-names {
  font-family: var(--font-alt);
  font-size: 1.05rem;
  color: var(--ink);
}
.cert-verse {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--ink-soft);
  max-width: 480px;
  margin: 0 auto;
}
.cert-verse-ref {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-top: 0.6rem;
}

/* ============ VENUE ============ */
.venue-address { color: var(--ink-soft); margin-bottom: 1.8rem; }

.venue-qr {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
}
.qr-code-img {
  width: 210px;
  height: 210px;
  padding: 8px;
}
.qr-caption {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ============ MOBILE RESPONSIVENESS ============ */
@media (max-width: 640px) {
  .section-block { padding: 3.5rem 1.1rem; }
  .section-title { margin-bottom: 1.6rem; }

  .countdown-grid { gap: 0.4rem; }
  .countdown-cell { min-width: 66px; padding: 0.9rem 0.4rem; }
  .countdown-sep { font-size: 1.4rem; }

  .schedule-timeline::before { left: 78px; }
  .schedule-item { grid-template-columns: 70px 16px 1fr; gap: 0.5rem; }
  .schedule-time { font-size: 0.92rem; }
  .schedule-name { font-size: 0.95rem; }

  .cert-card { padding: 2.4rem 1.3rem; }
  .cert-families { gap: 1.6rem; }

  .qr-code-img { width: 170px; height: 170px; }

  .envelope-invite-text { font-size: 1.6rem; }
  .envelope-wax { width: 150px; height: 150px; }
  .wax-ring-text { font-size: 1.2rem; }
}

@media (max-width: 380px) {
  .countdown-cell { min-width: 58px; }
}

/* ============ CLOSING ============ */
.closing-ornament {
  color: var(--sage);
  width: 25px;
  height: 25px;
  margin: 0.8rem auto 0.2rem;
}
.closing-ornament-emoji {
  font-size: 1.5rem;
  line-height: 1;
  width: auto;
  height: auto;
}
.closing-text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.5rem;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}
.closing-names {
  font-family: var(--font-alt);
  font-size: 1.6rem;
  color: var(--sage-deep);
  letter-spacing: 0.05em;
}


/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ============ FOCUS VISIBLE ============ */
a:focus-visible, button:focus-visible, input:focus-visible, [role="button"]:focus-visible {
  outline: 2px solid var(--sage-deep);
  outline-offset: 2px;
}
