/* ============================================================
   WEDDING COUNTDOWN — Brahim & Ons
   Theme: Midnight & Gold | Mobile-first
   ============================================================ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Heart SVG mask — shared by cursor & trail, avoids emoji rendering */
  --heart-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E") center / contain no-repeat;

  --bg-deep:      #080812;
  --bg-card:      #0e0e20;
  --bg-card-2:    #16163a;
  --gold:         #D4AF37;
  --gold-light:   #F0D060;
  --gold-pale:    #fff3b0;
  --gold-dark:    #8B6914;
  --gold-deep:    #4A380A;
  --text-primary: #F5F0E8;
  --text-muted:   #B8A98A;
  --highlight:    #2A2A4A;

  --block-shadow-rest:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 0 0 1px rgba(0,0,0,0.35),
    0 8px 40px rgba(0,0,0,0.5),
    0 0 0px rgba(212,175,55,0);

  --block-shadow-glow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 0 0 1px rgba(212,175,55,0.15),
    0 8px 50px rgba(0,0,0,0.4),
    0 0 35px rgba(212,175,55,0.3),
    0 0 70px rgba(212,175,55,0.1);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

/* Custom cursor: only suppress system cursor on non-touch / mouse devices */
@media (hover: hover) and (pointer: fine) {
  *, *::before, *::after { cursor: none; }
}

body {
  min-height: 100dvh;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'Raleway', sans-serif;
  overflow-x: hidden;
  position: relative;
}

/* Scrollbar */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 2px; }

/* ── Canvases & Background ──────────────────────────────────── */
#starfield,
#particles {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#starfield { z-index: 0; }
#particles { z-index: 1; }

.center-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 70% 60% at 50% 45%,
    rgba(30, 25, 70, 0.55) 0%,
    transparent 70%
  );
}

/* ── Custom Cursor ──────────────────────────────────────────── */
/* Hidden on touch/mobile — only shown for fine-pointer (mouse) devices */
#cursor-main,
#cursor-trail { display: none; }

@media (hover: hover) and (pointer: fine) {
  #cursor-main {
    display: block;
    position: fixed;
    z-index: 9999;
    width: 20px;
    height: 20px;
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: transform 0.12s ease;
    will-change: left, top;
  }

  /* Heart rendered as a CSS mask — never an emoji */
  #cursor-main::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background: var(--gold-light);
    -webkit-mask: var(--heart-mask);
    mask: var(--heart-mask);
    filter: drop-shadow(0 0 7px rgba(212,175,55,0.9))
            drop-shadow(0 0 14px rgba(212,175,55,0.4));
    transition: background 0.12s ease, filter 0.12s ease;
  }

  /* Swell on interactive elements */
  #cursor-main.cursor-hover {
    transform: translate(-50%, -50%) scale(1.55);
  }
  #cursor-main.cursor-hover::before {
    background: var(--gold-pale);
    filter: drop-shadow(0 0 10px rgba(255,243,176,0.95))
            drop-shadow(0 0 22px rgba(212,175,55,0.5));
  }

  #cursor-trail { display: block; }

  .cursor-trail-dot {
    position: fixed;
    z-index: 9998;
    pointer-events: none;
    transform: translate(-50%, -50%);
    will-change: left, top;
  }

  .cursor-trail-dot::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background: var(--gold);
    -webkit-mask: var(--heart-mask);
    mask: var(--heart-mask);
    filter: drop-shadow(0 0 3px rgba(212,175,55,0.5));
  }
}

/* ── Main Layout ────────────────────────────────────────────── */
main {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(1.5rem, 4vh, 3rem) clamp(1rem, 4vw, 2rem);
  gap: clamp(1rem, 2vh, 2rem);
  transition: opacity 0.75s ease;
}

main.wish-eclipse {
  opacity: 0;
  pointer-events: none;
}

/* ── HERO ───────────────────────────────────────────────────── */
.hero {
  text-align: center;
  flex-shrink: 0;
  animation: fade-up 1.8s cubic-bezier(.22,1,.36,1) both;
}

.names {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(3.2rem, 12vw, 7.5rem);
  font-weight: 400;
  line-height: 1.05;
  color: var(--gold-light);
  text-shadow:
    0 0 30px rgba(212,175,55,0.55),
    0 0 80px rgba(212,175,55,0.2),
    0 2px 6px rgba(0,0,0,0.6);
  letter-spacing: 0.015em;
  animation: names-glow 4s ease infinite alternate;
}

@keyframes names-glow {
  0%   { text-shadow: 0 0 30px rgba(212,175,55,0.55), 0 0 80px rgba(212,175,55,0.2),  0 2px 6px rgba(0,0,0,0.6); }
  100% { text-shadow: 0 0 50px rgba(212,175,55,0.75), 0 0 120px rgba(212,175,55,0.35), 0 2px 6px rgba(0,0,0,0.6); }
}

.amp {
  font-size: 0.85em;
  opacity: 0.8;
  color: var(--gold);
}

.tagline {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(0.85rem, 2.2vw, 1.25rem);
  color: var(--text-muted);
  letter-spacing: 0.18em;
  margin-top: 0.4rem;
  animation: fade-up 1.8s cubic-bezier(.22,1,.36,1) 0.3s both;
}

.divider-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: 0.9rem auto;
  width: clamp(160px, 40vw, 280px);
  animation: fade-up 1.8s cubic-bezier(.22,1,.36,1) 0.5s both;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,175,55,0.5), transparent);
}

.divider-gem {
  font-size: 0.45rem;
  color: var(--gold);
  opacity: 0.7;
}

.date-badge {
  font-family: 'Raleway', sans-serif;
  font-weight: 300;
  font-size: clamp(0.6rem, 1.4vw, 0.75rem);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--text-muted);
  animation: fade-up 1.8s cubic-bezier(.22,1,.36,1) 0.7s both;
}

/* ── COUNTDOWN ──────────────────────────────────────────────── */
.countdown-section {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
  animation: fade-up 1.8s cubic-bezier(.22,1,.36,1) 0.9s both;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(0.8rem, 2.5vw, 1.8rem);
  width: 100%;
  max-width: 860px;
}

.block {
  background: linear-gradient(160deg,
    rgba(255,255,255,0.028) 0%,
    rgba(10,10,24,0.7)      100%
  );
  border: 1px solid rgba(212,175,55,0.18);
  border-radius: 18px;
  padding: clamp(1.4rem, 4vh, 2.6rem) clamp(1.2rem, 3vw, 2.2rem);
  text-align: center;
  position: relative;
  box-shadow: var(--block-shadow-rest);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  will-change: box-shadow;
  overflow: hidden;
}

/* Top sheen — thin highlight across the glass surface */
.block::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 5%,
    rgba(212,175,55,0.25) 35%,
    rgba(255,255,255,0.18) 50%,
    rgba(212,175,55,0.25) 65%,
    transparent 95%
  );
}

/* Radial top glow */
.block::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: radial-gradient(
    ellipse 100% 55% at 50% -5%,
    rgba(212,175,55,0.07) 0%,
    transparent 65%
  );
  pointer-events: none;
}

.block-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* Slot-machine clip container */
.block-number-wrap {
  overflow: hidden;
  /* height driven by block-number font-size via line-height:1 on child */
  font-size: clamp(2.8rem, 8.5vw, 5.5rem);
  height: 1.05em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.block-number {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 1em; /* inherits from .block-number-wrap */
  line-height: 1;
  display: block;
  /* Gradient gold text */
  background: linear-gradient(175deg, #fff8d6 0%, #F0D060 38%, #C9A030 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 10px rgba(212,175,55,0.3));
  will-change: transform, opacity;
}

/* thin separator between number and label */
.block-sep {
  width: 30%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,175,55,0.35), transparent);
  margin: 0.55rem auto 0.45rem;
}

.block-label {
  font-family: 'Raleway', sans-serif;
  font-weight: 300;
  font-size: clamp(0.5rem, 1.1vw, 0.62rem);
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: rgba(184,169,138,0.65);
  display: block;
}

/* Heartbeat — soft glow pulse, no physical jump */
@keyframes heartbeat {
  0%,100% { box-shadow: var(--block-shadow-rest); border-color: rgba(212,175,55,0.18); }
  12%     { box-shadow: var(--block-shadow-glow);  border-color: rgba(212,175,55,0.45); }
  26%     { box-shadow: var(--block-shadow-rest);  border-color: rgba(212,175,55,0.18); }
  38%     {
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.05),
      0 0 0 1px rgba(0,0,0,0.3),
      0 8px 40px rgba(0,0,0,0.45),
      0 0 18px rgba(212,175,55,0.15);
    border-color: rgba(212,175,55,0.28);
  }
  55%,100% { box-shadow: var(--block-shadow-rest); border-color: rgba(212,175,55,0.18); }
}

.block.pulse {
  animation: heartbeat 0.7s ease forwards;
}

/* ── MESSAGE ────────────────────────────────────────────────── */
.message-section {
  text-align: center;
  width: 100%;
  max-width: 680px;
  padding: 0 1.2rem;
  flex-shrink: 0;
  animation: fade-up 1.8s cubic-bezier(.22,1,.36,1) 1.1s both;
}

.monogram-heart {
  width: 16px;
  height: 16px;
  vertical-align: -3px; /* fine-tune baseline against Great Vibes caps */
  color: var(--gold-dark);
  opacity: 0.7;
  display: inline-block;
}

.love-message {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(1.75rem, 5.5vw, 2.1rem);
  color: var(--gold);
  line-height: 1.5;
  text-shadow: 0 0 25px rgba(212,175,55,0.25);
  min-height: 3em;
  padding: 0.4rem 0;
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.love-message.fade-out {
  opacity: 0;
  transform: translateY(6px);
}

/* ── FOOTER ─────────────────────────────────────────────────── */
footer {
  text-align: center;
  flex-shrink: 0;
  padding-bottom: 0.5rem;
  animation: fade-up 1.8s cubic-bezier(.22,1,.36,1) 1.3s both;
}

.footer-rule {
  width: 80px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,175,55,0.25), transparent);
  margin: 0 auto 0.6rem;
}

.monogram {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  color: var(--gold-dark);
  opacity: 0.7;
  letter-spacing: 0.08em;
}

/* ── SHOOTING STAR WISH MESSAGE ─────────────────────────────── */
#wish-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% - 12px));
  z-index: 10;
  pointer-events: none;
  text-align: center;
  opacity: 0;
  transition: opacity 1.2s ease, transform 1.2s ease;
  width: 90vw;
  max-width: 520px;
  /* Soft dark halo so text reads on any background */
  filter: drop-shadow(0 0 28px rgba(8,8,18,0.6));
}

#wish-message.visible {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.wish-line-1 {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  color: rgba(245, 240, 232, 0.82);
  text-shadow:
    0 0 20px rgba(212,175,55,0.35),
    0 0 50px rgba(212,175,55,0.12);
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.wish-line-2 {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(0.8rem, 2vw, 1.05rem);
  color: rgba(212, 175, 55, 0.75);
  letter-spacing: 0.16em;
  margin-top: 0.2rem;
  text-shadow: 0 0 15px rgba(212,175,55,0.2);
}

/* ── WEDDING DAY OVERLAY ────────────────────────────────────── */
#wedding-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg-deep);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  opacity: 0;
  transition: opacity 2s ease;
}

#wedding-overlay.hidden {
  display: none;
}

#wedding-overlay.visible {
  opacity: 1;
}

#confetti-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.celebration-content {
  position: relative;
  z-index: 1;
}

.celebration-eyebrow {
  font-family: 'Raleway', sans-serif;
  font-weight: 300;
  font-size: clamp(0.65rem, 1.5vw, 0.85rem);
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  animation: fade-up 1.5s ease 0.5s both;
}

.celebration-title {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(3.5rem, 14vw, 9rem);
  font-weight: 400;
  color: var(--gold-light);
  line-height: 1.1;
  animation: celebration-glow 3s ease infinite alternate, fade-up 1.5s ease both;
}

@keyframes celebration-glow {
  0%   { text-shadow: 0 0 40px rgba(212,175,55,0.7),  0 0 80px rgba(212,175,55,0.35); color: var(--gold-light); }
  100% { text-shadow: 0 0 70px rgba(240,208,96,1),    0 0 140px rgba(212,175,55,0.7); color: var(--gold-pale); }
}

.celebration-divider {
  display: flex;
  justify-content: center;
  margin: 0.8rem 0;
  animation: pulse-heart 1.2s ease infinite, fade-up 1.5s ease 0.3s both;
}

.celebration-divider svg {
  width: 1.4rem;
  height: 1.4rem;
  color: var(--gold);
}

@keyframes pulse-heart {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50%       { transform: scale(1.3); opacity: 1; }
}

.celebration-date {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  color: var(--text-muted);
  letter-spacing: 0.2em;
  animation: fade-up 1.5s ease 0.5s both;
}

.celebration-sub {
  font-family: 'Raleway', sans-serif;
  font-weight: 300;
  font-size: clamp(0.75rem, 1.8vw, 0.9rem);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(184,169,138,0.6);
  margin-top: 1rem;
  animation: fade-up 1.5s ease 0.8s both;
}

/* ── FIREBALL CARD ──────────────────────────────────────────── */
#fireball-card {
  position: fixed;
  bottom: clamp(1rem, 3vh, 2rem);
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 2rem));
  z-index: 100;
  width: min(460px, calc(100vw - 2rem));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.55s cubic-bezier(0.22,1,0.36,1), opacity 0.55s ease;
}

#fireball-card.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.fb-inner {
  background: linear-gradient(150deg,
    rgba(255,255,255,0.03) 0%,
    rgba(8,8,24,0.88)     100%
  );
  border: 1px solid rgba(212,175,55,0.28);
  border-radius: 16px;
  padding: 1rem 1.1rem 0.9rem;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.4),
    0 12px 40px rgba(0,0,0,0.5),
    0 0 30px rgba(212,175,55,0.07);
}

.fb-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.fb-icon {
  color: var(--gold);
  font-size: 0.7rem;
  flex-shrink: 0;
}

.fb-title {
  font-family: 'Raleway', sans-serif;
  font-weight: 400;
  font-size: clamp(0.58rem, 1.4vw, 0.68rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  flex: 1;
}

.fb-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.15rem 0.25rem;
  opacity: 0.5;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

@media (hover: hover) and (pointer: fine) {
  .fb-close:hover { opacity: 1; cursor: pointer; }
}

.fb-date {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(0.8rem, 2vw, 0.92rem);
  color: var(--text-muted);
  margin-bottom: 0.55rem;
  line-height: 1.3;
}

.fb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.fb-chip {
  font-family: 'Raleway', sans-serif;
  font-weight: 300;
  font-size: clamp(0.55rem, 1.3vw, 0.62rem);
  letter-spacing: 0.06em;
  color: var(--text-primary);
  background: rgba(212,175,55,0.07);
  border: 1px solid rgba(212,175,55,0.2);
  border-radius: 20px;
  padding: 0.18rem 0.55rem;
}

/* ── SINCE TIMER (post-wedding forward counter) ─────────────── */
.since-section {
  margin-top: clamp(1.8rem, 4vh, 3rem);
  animation: fade-up 1.5s ease 2s both;
}

.since-eyebrow {
  font-family: 'Raleway', sans-serif;
  font-weight: 300;
  font-size: clamp(0.6rem, 1.4vw, 0.8rem);
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.since-grid {
  display: flex;
  gap: clamp(0.6rem, 2vw, 1.6rem);
  justify-content: center;
  flex-wrap: wrap;
}

.since-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: clamp(56px, 15vw, 90px);
}

.since-number {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: clamp(2rem, 6vw, 3.5rem);
  line-height: 1;
  background: linear-gradient(175deg, #fff8d6 0%, #F0D060 38%, #C9A030 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 8px rgba(212,175,55,0.3));
}

.since-unit {
  font-family: 'Raleway', sans-serif;
  font-weight: 300;
  font-size: clamp(0.48rem, 1vw, 0.58rem);
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: rgba(184,169,138,0.55);
}

/* Reuse .love-message styles for the since-message */
#since-message {
  margin-top: clamp(1rem, 2.5vh, 1.8rem);
  min-height: 2em;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Keyframe Library ───────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .countdown-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 380px;
  }

  main {
    gap: clamp(0.8rem, 2vh, 1.5rem);
    padding: 1.2rem 0.9rem;
  }
}

@media (min-width: 601px) and (max-width: 900px) {
  .countdown-grid {
    max-width: 640px;
  }
}

/* ── REDUCED MOTION ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero, .countdown-section, .message-section, footer,
  .names, .tagline, .divider-wrap, .date-badge {
    opacity: 1 !important;
    transform: none !important;
  }

  #starfield, #particles { display: none; }
}
