:root {
  --rose: #b5375a;
  --rose-dark: #7a1f3d;
  --gold: #d8a657;
  --cream: #fff6ee;
  --deep: #3a0d1c;
  --text: #4a2534;
  font-size: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Cairo', sans-serif;
  background: linear-gradient(180deg, #fff6ee 0%, #ffeef2 40%, #fbe4ea 100%);
  color: var(--text);
  overflow-x: hidden;
  direction: rtl;
}

h1, h2, h3 {
  font-family: 'Aref Ruqaa', serif;
  color: var(--rose-dark);
  margin: 0;
}

#hearts-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.section {
  position: relative;
  z-index: 1;
  padding: 5rem 1.25rem;
  max-width: 900px;
  margin: 0 auto;
}

.section-title {
  text-align: center;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  margin-bottom: 0.4rem;
}

.section-sub {
  text-align: center;
  color: var(--rose);
  margin-top: 0;
  margin-bottom: 2.5rem;
  font-weight: 300;
}

/* ---------- Start overlay ---------- */
#start-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: radial-gradient(circle at 50% 40%, #7a1f3d 0%, #3a0d1c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}
#start-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.start-box {
  text-align: center;
  color: #ffe9ef;
  padding: 2rem;
}
.start-box h2 {
  color: #fff;
  font-size: clamp(2rem, 8vw, 3.2rem);
  margin: 0.6rem 0;
  opacity: 0;
  animation: fadeUp 0.8s ease 4.9s both;
}
.start-box .amp { color: var(--gold); margin: 0 0.3rem; }
.start-box p {
  font-weight: 300;
  opacity: 0;
  margin-bottom: 0.5rem;
  animation: fadeUp 0.8s ease 5.05s both;
}

/* ---------- Blooming bouquet ---------- */
.bouquet {
  position: relative;
  width: clamp(210px, 55vw, 280px);
  height: clamp(230px, 60vw, 300px);
  margin: 0.5rem auto 2.2rem;
  transform-origin: bottom center;
  opacity: 0;
  animation: bouquetGrow 4.8s cubic-bezier(.4,0,.2,1) both,
             bouquetSway 5.5s ease-in-out 4.8s infinite;
}
@keyframes bouquetGrow {
  0%   { transform: scale(0) rotate(-6deg); opacity: 0; }
  10%  { opacity: 1; }
  45%  { transform: scale(1.3) rotate(2deg); opacity: 1; }
  88%  { transform: scale(1.3) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes bouquetSway {
  0%, 100% { transform: scale(1) rotate(-1.1deg); }
  50% { transform: scale(1) rotate(1.1deg); }
}
.bouquet-tag {
  position: absolute;
  left: 50%;
  bottom: 32%;
  width: 22%;
  transform: translateX(-50%);
  text-align: center;
  font-family: 'Aref Ruqaa', serif;
  font-size: 0.72rem;
  white-space: nowrap;
  color: #ffe9ef;
  z-index: 3;
  opacity: 0;
  animation: wrapFade 0.6s ease 0.6s both;
}
.bouquet-wrap {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 52%;
  height: 44%;
  background:
    repeating-linear-gradient(75deg, rgba(255,255,255,0.3) 0px, rgba(255,255,255,0.3) 2px, transparent 2px, transparent 11px),
    repeating-linear-gradient(-68deg, rgba(120,70,30,0.1) 0px, rgba(120,70,30,0.1) 1px, transparent 1px, transparent 15px),
    linear-gradient(155deg, #fff6ea, #f0c9a0 55%, #dba668);
  clip-path: polygon(50% 100%, 6% 12%, 28% 24%, 44% 6%, 60% 22%, 80% 4%, 97% 16%);
  transform: translateX(-50%) rotate(-3deg);
  box-shadow: 0 10px 20px rgba(122, 31, 61, 0.3);
  opacity: 0;
  animation: wrapFade 0.6s ease 0.1s both;
}
.bouquet-wrap-2 {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 44%;
  height: 39%;
  background:
    repeating-linear-gradient(70deg, rgba(255,255,255,0.25) 0px, rgba(255,255,255,0.25) 2px, transparent 2px, transparent 12px),
    linear-gradient(150deg, #ffe9d6, #e3a86b 60%, #c98a4e);
  clip-path: polygon(50% 100%, 8% 8%, 32% 20%, 50% 2%, 68% 18%, 92% 6%);
  transform: translateX(-50%) rotate(5deg);
  opacity: 0;
  animation: wrapFade 0.6s ease 0.25s both;
}
.bouquet-ribbon {
  position: absolute;
  left: 50%;
  bottom: 32%;
  width: 22%;
  height: 12%;
  background: var(--rose);
  border: 2px solid var(--gold);
  border-radius: 3px;
  transform: translateX(-50%);
  opacity: 0;
  animation: wrapFade 0.6s ease 0.45s both;
  z-index: 2;
}
@keyframes wrapFade {
  from { opacity: 0; transform: translateX(-50%) translateY(14px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---- CSS-built red flowers with green stem & leaves ---- */
.flower {
  position: absolute;
  left: 50%;
  bottom: 30%;
  transform: translateX(-50%) rotate(var(--rot));
  transform-origin: bottom center;
}
.f1 { --rot: -34deg; --stem-h: 58px; --d: 0.2s; }
.f2 { --rot: -17deg; --stem-h: 76px; --d: 0.75s; }
.f3 { --rot: 0deg;   --stem-h: 90px; --d: 1.3s; }
.f4 { --rot: 17deg;  --stem-h: 76px; --d: 1.85s; }
.f5 { --rot: 34deg;  --stem-h: 58px; --d: 2.4s; }

.stem {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 5px;
  height: var(--stem-h);
  background: linear-gradient(180deg, #7fcf74, #2e7d32);
  border-radius: 3px;
  transform: translateX(-50%) scaleY(0);
  transform-origin: bottom center;
  animation: stemGrow 0.7s ease var(--d) both;
}
@keyframes stemGrow {
  from { transform: translateX(-50%) scaleY(0); }
  to   { transform: translateX(-50%) scaleY(1); }
}

.leaf {
  position: absolute;
  left: 50%;
  width: 17px;
  height: 10px;
  background: linear-gradient(160deg, #8fd782, #388e3c);
  border-radius: 65% 35% 60% 40% / 55% 45% 55% 45%;
}
.leaf-l {
  bottom: calc(var(--stem-h) * 0.32);
  animation: leafPopL 0.5s ease-out calc(var(--d) + 0.28s) both;
}
.leaf-r {
  bottom: calc(var(--stem-h) * 0.52);
  animation: leafPopR 0.5s ease-out calc(var(--d) + 0.36s) both;
}
@keyframes leafPopL {
  from { opacity: 0; transform: translate(-120%, 20%) rotate(-30deg) rotateY(25deg) scale(0); }
  to   { opacity: 1; transform: translate(-120%, 20%) rotate(-30deg) rotateY(25deg) scale(1); }
}
@keyframes leafPopR {
  from { opacity: 0; transform: translate(20%, 20%) rotate(30deg) rotateY(25deg) scale(0); }
  to   { opacity: 1; transform: translate(20%, 20%) rotate(30deg) rotateY(25deg) scale(1); }
}

.head {
  position: absolute;
  left: 50%;
  bottom: var(--stem-h);
  width: 42px;
  height: 42px;
  transform: translateX(-50%);
  filter: drop-shadow(0 3px 8px rgba(168, 22, 44, 0.35)) drop-shadow(0 0 12px rgba(255, 110, 120, 0.3));
}

.petal {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52%;
  height: 48%;
  background: radial-gradient(ellipse at 32% 28%, #ff6b7a 0%, #e2233c 55%, #a8162c 100%);
  border-radius: 62% 38% 55% 45% / 48% 42% 58% 52%;
  transform-origin: 0 0;
  box-shadow: inset 0 0 4px rgba(255, 255, 255, 0.25);
  opacity: 0;
  animation: petalUnfurl 0.65s cubic-bezier(.34,1.4,.6,1) calc(var(--d) + 0.85s + var(--pd)) both;
}
@keyframes petalUnfurl {
  0%   { opacity: 0; transform: rotate(calc(var(--ang) - 30deg)) scale(0.25); }
  70%  { opacity: 1; transform: rotate(calc(var(--ang) + 4deg)) scale(1.08); }
  100% { opacity: 1; transform: rotate(var(--ang)) scale(1); }
}
.petal.p1 { --ang: 0deg;   --pd: 0s; }
.petal.p2 { --ang: 60deg;  --pd: 0.06s; }
.petal.p3 { --ang: 120deg; --pd: 0.12s; }
.petal.p4 { --ang: 180deg; --pd: 0.18s; }
.petal.p5 { --ang: 240deg; --pd: 0.24s; }
.petal.p6 { --ang: 300deg; --pd: 0.3s; }

.center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 11px;
  height: 11px;
  background: radial-gradient(circle at 35% 30%, #ffe29a, #d89b2e 70%, #a8701c 100%);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  box-shadow: 0 0 0 2px rgba(122, 31, 61, 0.18);
  z-index: 2;
  animation: centerPop 0.45s ease calc(var(--d) + 0.75s) both;
}
@keyframes centerPop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

#start-btn {
  font-family: 'Cairo', sans-serif;
  font-size: 1.05rem;
  padding: 0.9rem 2.4rem;
  margin-top: 1rem;
  border-radius: 50px;
  border: 2px solid var(--gold);
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  opacity: 0;
  animation: fadeUp 0.9s ease 5.3s both;
  transition: background 0.3s, color 0.3s, transform 0.2s;
}
#start-btn:hover { background: var(--gold); color: var(--deep); }
#start-btn:active { transform: scale(0.96); }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ---------- Hero ---------- */
#hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 3rem;
}
.hero-inner { max-width: 700px; }
.eyebrow {
  letter-spacing: 0.3em;
  color: var(--rose);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.names {
  font-size: clamp(2.6rem, 11vw, 5.2rem);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.5rem, 2vw, 1.2rem);
  flex-wrap: wrap;
  text-shadow: 0 2px 18px rgba(181, 55, 90, 0.25);
}
.names .name {
  animation: fadeUp 1.2s ease both;
}
.names .name:nth-child(3) { animation-delay: 0.25s; }
.heart-divider {
  color: var(--gold);
  font-size: 0.55em;
  animation: pulse 1.6s ease-in-out infinite;
}
.tagline {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  font-weight: 300;
  color: var(--text);
  margin-top: 1rem;
  animation: fadeUp 1.2s ease 0.5s both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.scroll-hint {
  margin-top: 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--rose);
}
.scroll-hint span {
  width: 1.4rem;
  height: 2.3rem;
  border: 2px solid var(--rose);
  border-radius: 1rem;
  position: relative;
}
.scroll-hint span::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  width: 5px;
  height: 5px;
  background: var(--rose);
  border-radius: 50%;
  transform: translateX(-50%);
  animation: scrollDot 1.6s ease infinite;
}
@keyframes scrollDot {
  0% { top: 6px; opacity: 1; }
  70% { top: 22px; opacity: 0; }
  100% { top: 22px; opacity: 0; }
}
.scroll-hint small { font-size: 0.75rem; opacity: 0.8; }

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  padding-right: 2rem;
  border-right: 3px dashed rgba(181, 55, 90, 0.35);
}
.tl-item {
  position: relative;
  margin-bottom: 2.2rem;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.tl-item.visible { opacity: 1; transform: translateY(0); }
.tl-dot {
  position: absolute;
  right: -2.85rem;
  top: 0;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--cream);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.tl-card {
  background: #ffffffcc;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(181, 55, 90, 0.15);
  border-radius: 14px;
  padding: 1.2rem 1.4rem;
  box-shadow: 0 6px 20px rgba(122, 31, 61, 0.08);
}
.tl-card h3 { font-size: 1.2rem; margin-bottom: 0.4rem; }
.tl-card p { margin: 0; line-height: 1.9; font-weight: 300; }

/* ---------- Envelope / Love letter ---------- */
.envelope {
  position: relative;
  width: min(90vw, 420px);
  height: min(70vw, 300px);
  margin: 0 auto;
  cursor: pointer;
  perspective: 1400px;
}
.envelope-back {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #c9486a, #7a1f3d);
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(122, 31, 61, 0.35);
}
.envelope-front {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.envelope-front::before,
.envelope-front::after {
  content: '';
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  background: #b5375a;
}
.envelope-front::before {
  left: 0;
  clip-path: polygon(0 0, 0 100%, 100% 100%);
}
.envelope-front::after {
  right: 0;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 55%;
  background: linear-gradient(160deg, #93233f, #6a1730);
  clip-path: polygon(0 0, 100% 0, 50% 92%);
  transform-origin: top center;
  transition: transform 0.6s cubic-bezier(.4,0,.2,1), opacity 0.5s ease 0.1s;
  z-index: 3;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}
.envelope-seal {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3rem;
  height: 3rem;
  background: var(--gold);
  color: var(--rose-dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  z-index: 4;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.envelope.open .envelope-flap {
  transform: scaleY(0.06) translateY(-6%);
  opacity: 0;
}
.envelope.open .envelope-seal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5);
}
.envelope.open .envelope-front { z-index: 0; }

/* Full letter panel: tucked just behind/under the envelope, hidden until opened,
   then rises slowly up out of the envelope's opening into its resting spot below it. */
.letter-panel {
  position: relative;
  max-width: 560px;
  margin: -2.75rem auto 0;
  z-index: 1;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(110px) scale(0.8);
  transition: max-height 1.6s cubic-bezier(.16,.8,.2,1),
              transform 1.5s cubic-bezier(.16,.8,.2,1),
              opacity 1.1s ease;
}
.letter-panel.open {
  max-height: 1600px;
  opacity: 1;
  transform: translateY(0) scale(1);
}
.letter-paper {
  background: #fffdf7;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(122, 31, 61, 0.18);
  border: 1px solid rgba(181, 55, 90, 0.12);
}
.letter-content {
  padding: 1.8rem 1.6rem;
  font-family: 'Aref Ruqaa', serif;
  line-height: 2.1;
  font-size: 1.05rem;
  color: var(--deep);
}
.letter-greeting {
  font-size: 1.25rem;
  color: var(--rose-dark);
  margin-top: 0;
}
.letter-sign {
  text-align: left;
  color: var(--rose);
  font-weight: 700;
  margin-bottom: 0.4rem;
}

/* ---------- Countdown ---------- */
.countdown-grid {
  display: flex;
  justify-content: center;
  gap: clamp(0.6rem, 2.5vw, 1.4rem);
  flex-wrap: wrap;
}
.cd-box {
  background: linear-gradient(160deg, var(--rose-dark), #5a1630);
  color: #fff;
  border-radius: 16px;
  padding: 1.1rem 0.6rem;
  min-width: 5.2rem;
  text-align: center;
  box-shadow: 0 10px 25px rgba(122, 31, 61, 0.3);
}
.cd-box span {
  display: block;
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}
.cd-box small {
  font-size: 0.75rem;
  font-weight: 300;
  opacity: 0.85;
}
.countdown-done {
  text-align: center;
  font-size: 1.3rem;
  color: var(--rose-dark);
  font-family: 'Aref Ruqaa', serif;
  margin-top: 2rem;
}
.hidden { display: none !important; }

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding-bottom: 7rem;
}
.footer-hearts { font-size: 1.4rem; margin-bottom: 0.6rem; }
.footer p { margin: 0.2rem 0; }
.footer .small { font-size: 0.8rem; opacity: 0.65; font-weight: 300; }

/* ---------- Music toggle ---------- */
#music-toggle {
  position: fixed;
  bottom: 1.4rem;
  left: 1.4rem;
  z-index: 50;
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 50%;
  border: none;
  background: var(--rose-dark);
  color: var(--gold);
  font-size: 1.4rem;
  box-shadow: 0 8px 20px rgba(122, 31, 61, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#music-toggle.playing .music-icon {
  animation: spin 4s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .section { padding: 3.4rem 1rem; }
  .timeline { padding-right: 1.6rem; }
  .tl-dot { right: -2.25rem; width: 2rem; height: 2rem; font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
