/* ==========================================================================
   THEME 3: ROYAL MAROON & LIQUID GOLD 3D ANIMATED WEDDING INVITATION
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;0,700;1,400;1,600&family=Marcellus&family=Tangerine:wght@400;700&family=Montserrat:wght@300;400;500;600&display=swap');

:root {
  /* Royal Palette */
  --ivory: #FBF5E9;
  --maroon: #6E1526;
  --maroon-deep: #4A0E19;
  --maroon-dark: #2B070F;
  --gold: #C79A3E;
  --gold-light: #E4C878;
  --gold-dark: #8c661c;
  --gold-gradient: linear-gradient(135deg, #E4C878 0%, #C79A3E 50%, #8c661c 100%);
  --rose-gold: #e29ca7;
  --ink: #2B211C;
  --bg-dark: #2B070F;
  --bg-card: rgba(74, 14, 25, 0.78);
  --border-gold: rgba(228, 200, 120, 0.35);
  --border-gold-glow: rgba(228, 200, 120, 0.7);
  --shadow-glass: 0 20px 40px rgba(0, 0, 0, 0.6);
  --shadow-paper: 0 15px 45px rgba(74, 14, 25, 0.4);

  /* Fonts */
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-heading: 'Marcellus', serif;
  --font-script: 'Tangerine', cursive;
  --font-sans: 'Montserrat', sans-serif;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  overflow-x: hidden;
}

body {
  background-color: var(--bg-dark);
  color: var(--ivory);
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

::selection {
  background: var(--gold);
  color: var(--maroon-deep);
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--maroon-dark); }
::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 4px; }

/* WebGL Canvas */
#webgl-canvas-3 {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

/* Ambient Glow FX */
.ambient-glow-3 {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 20%, rgba(228, 200, 120, 0.08) 0%, transparent 65%),
              radial-gradient(circle at 80% 80%, rgba(110, 21, 38, 0.4) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

/* Typography */
.script-title-3 {
  font-family: var(--font-script);
  font-weight: 700;
  font-size: 3.5rem;
  color: var(--gold-light);
  text-shadow: 0 0 20px rgba(228, 200, 120, 0.3);
  line-height: 1.1;
}

.heading-gold-3 {
  font-family: var(--font-heading);
  font-size: 3.2rem;
  letter-spacing: 3px;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
}

.section-subtitle-3 {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-bottom: 0.5rem;
  display: block;
}

/* Containers */
.container {
  width: 90%;
  max-width: 1150px;
  margin: 0 auto;
  padding: 0 1rem;
}

.section-padding {
  padding: 7rem 0;
  position: relative;
}

.text-center { text-align: center; }

/* Buttons */
.btn-royal {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1.1rem 2.8rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--maroon-deep);
  background: var(--gold-gradient);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 8px 25px rgba(199, 154, 62, 0.4);
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}

.btn-royal:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 35px rgba(228, 200, 120, 0.6);
}

.btn-royal-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 2.5rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-light);
  background: transparent;
  border: 1px solid var(--gold);
  border-radius: 50px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.4s ease;
}

.btn-royal-outline:hover {
  background: rgba(199, 154, 62, 0.15);
  color: #fff;
  border-color: var(--gold-light);
  transform: translateY(-3px);
}

/* Glassmorphism Card */
.glass-card-3 {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-gold);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: var(--shadow-glass);
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}

.glass-card-3:hover {
  border-color: var(--border-gold-glow);
  box-shadow: 0 20px 45px rgba(110, 21, 38, 0.4), 0 0 25px rgba(228, 200, 120, 0.2);
}

/* 3D Tilt Wrapper */
.tilt-card-3 {
  transform-style: preserve-3d;
  perspective: 1000px;
  will-change: transform;
}

.tilt-inner-3 {
  transform: translateZ(30px);
  transition: transform 0.2s ease-out;
}

/* ==========================================================================
   ENVELOPE INTRO OVERLAY SCREEN (#envelope-screen)
   ========================================================================== */
#envelope-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(160deg, var(--maroon-dark) 0%, var(--maroon-deep) 50%, var(--maroon) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 1s ease, visibility 1s ease;
}

#envelope-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.envelope-wrap {
  text-align: center;
  color: var(--ivory);
  cursor: pointer;
  user-select: none;
  position: relative;
}

.envelope-frame {
  position: relative;
  width: 320px;
  height: 220px;
  margin: 0 auto 2.5rem;
  perspective: 1000px;
}

.env-body {
  position: absolute;
  inset: 0;
  background: var(--ivory);
  border-radius: 8px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  border: 2px solid var(--gold);
  overflow: hidden;
}

.env-body::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px dashed var(--gold);
  border-radius: 4px;
}

.env-letter {
  position: absolute;
  inset: 15px;
  background: #FFFDF9;
  border-radius: 4px;
  padding: 1.5rem 1rem;
  text-align: center;
  transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1;
}

.envelope.open .env-letter {
  transform: translateY(-90px) scale(1.05);
}

.env-letter-names {
  font-family: var(--font-script);
  font-size: 2.8rem;
  color: var(--maroon);
  line-height: 1;
}

.env-letter-text {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  letter-spacing: 2px;
  color: var(--gold-dark);
  text-transform: uppercase;
  margin-top: 0.4rem;
}

.env-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  clip-path: polygon(0 0, 100% 0, 50% 55%);
  background: linear-gradient(160deg, var(--gold-light), var(--gold));
  transform-origin: top center;
  transition: transform 1s cubic-bezier(.6,-0.2,.3,1.4);
  border-radius: 8px 8px 0 0;
  z-index: 3;
}

.envelope.open .env-flap {
  transform: rotateX(180deg);
  z-index: 0;
}

.env-seal {
  position: absolute;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-light), var(--maroon) 80%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-script);
  font-size: 2rem;
  font-weight: 700;
  color: var(--ivory);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.4);
  z-index: 4;
  transition: opacity 0.5s ease, transform 0.5s ease;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  animation: pulseSeal 2s infinite;
}

@keyframes pulseSeal {
  0% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 0 rgba(228, 200, 120, 0.6); }
  70% { transform: translate(-50%, -50%) scale(1.05); box-shadow: 0 0 0 15px rgba(228, 200, 120, 0); }
  100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 0 rgba(228, 200, 120, 0); }
}

.envelope.open .env-seal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
}

.tap-prompt {
  font-family: var(--font-heading);
  font-size: 1rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold-light);
  animation: fadeInOut 2s infinite;
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ==========================================================================
   NAVBAR
   ========================================================================== */
.navbar-3 {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 1100px;
  background: rgba(43, 7, 15, 0.85);
  backdrop-filter: blur(25px);
  border: 1px solid var(--border-gold);
  border-radius: 50px;
  padding: 0.8rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.nav-brand-3 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  color: var(--gold-light);
  text-decoration: none;
  letter-spacing: 2px;
}

.nav-brand-3 span {
  font-family: var(--font-script);
  color: var(--gold);
  font-size: 2.2rem;
}

.nav-links-3 {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-link-3 {
  color: var(--ivory);
  opacity: 0.8;
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  transition: opacity 0.3s, color 0.3s;
}

.nav-link-3:hover {
  opacity: 1;
  color: var(--gold-light);
}

/* ==========================================================================
   HERO SECTION
   ========================================================================== */
.hero-3 {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding-top: 7rem;
  padding-bottom: 4rem;
  text-align: center;
}

.hero-title-3 {
  font-family: var(--font-heading);
  font-size: clamp(3.2rem, 7vw, 6.5rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 4px;
  color: var(--ivory);
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.hero-title-3 span {
  display: block;
  font-family: var(--font-script);
  color: var(--gold-light);
  font-size: clamp(4rem, 9vw, 8rem);
  margin: -1rem 0;
}

.hero-date-3 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  letter-spacing: 4px;
  color: var(--gold);
  margin: 1.5rem 0 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.hero-date-3::before, .hero-date-3::after {
  content: '';
  width: 50px;
  height: 1px;
  background: var(--gold-gradient);
}

/* Countdown Grid */
.countdown-grid-3 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  max-width: 750px;
  width: 100%;
  margin: 0 auto 3.5rem;
}

.countdown-box-3 {
  background: var(--bg-card);
  backdrop-filter: blur(15px);
  border: 1px solid var(--border-gold);
  border-radius: 16px;
  padding: 1.5rem 1rem;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.countdown-num-3 {
  font-family: var(--font-heading);
  font-size: 3rem;
  color: var(--gold-light);
  line-height: 1;
}

.countdown-lbl-3 {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ivory);
  opacity: 0.7;
  margin-top: 0.5rem;
}

/* ==========================================================================
   TIMELINE SECTION
   ========================================================================== */
.timeline-3 {
  position: relative;
  max-width: 950px;
  margin: 4rem auto 0;
}

.timeline-3::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: linear-gradient(180deg, transparent, var(--gold) 15%, var(--gold) 85%, transparent);
  transform: translateX(-50%);
}

.timeline-item-3 {
  display: flex;
  justify-content: flex-end;
  padding-right: 45px;
  position: relative;
  margin-bottom: 4.5rem;
  width: 50%;
}

.timeline-item-3:nth-child(even) {
  align-self: flex-end;
  justify-content: flex-start;
  padding-right: 0;
  padding-left: 45px;
  margin-left: 50%;
}

.timeline-dot-3 {
  position: absolute;
  top: 25px;
  right: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gold-gradient);
  border: 4px solid var(--maroon-deep);
  box-shadow: 0 0 15px var(--gold);
  z-index: 2;
}

.timeline-item-3:nth-child(even) .timeline-dot-3 {
  right: auto;
  left: -10px;
}

.timeline-img-3 {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 1.2rem;
  border: 1px solid var(--border-gold);
}

/* ==========================================================================
   RSVP MODAL & DRAWER
   ========================================================================== */
.modal-overlay-3 {
  position: fixed;
  inset: 0;
  background: rgba(15, 3, 6, 0.88);
  backdrop-filter: blur(20px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.modal-overlay-3.active {
  opacity: 1;
  pointer-events: all;
}

.rsvp-box-3 {
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.form-input-3, .form-select-3, .form-textarea-3 {
  width: 100%;
  padding: 1rem 1.2rem;
  background: rgba(43, 7, 15, 0.8);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  color: #fff;
  font-family: var(--font-serif);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s;
}

.form-input-3:focus, .form-select-3:focus, .form-textarea-3:focus {
  border-color: var(--gold-light);
  box-shadow: 0 0 15px rgba(228, 200, 120, 0.3);
}

/* Responsive */
@media (max-width: 992px) {
  .timeline-3::before { left: 20px; }
  .timeline-item-3, .timeline-item-3:nth-child(even) {
    width: 100%;
    padding-left: 55px;
    padding-right: 0;
    margin-left: 0;
  }
  .timeline-dot-3, .timeline-item-3:nth-child(even) .timeline-dot-3 {
    left: 10px; right: auto;
  }
}

@media (max-width: 768px) {
  .nav-links-3 { display: none; }
  .countdown-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .hero-title-3 { font-size: 3.5rem; }
}
