/* ============ CUSTOM PROPERTIES ============ */
:root {
  --crimson: #9B1B30;
  --forest: #2D5016;
  --gold: #C9A84C;
  --stone: #F5F0EB;
  --charcoal: #2C2C2C;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Lato', -apple-system, BlinkMacSystemFont, sans-serif;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  --radius: 8px;
  --max-width: 1100px;
}

/* ============ RESET & BASE ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--charcoal);
  background: #fff;
  line-height: 1.6;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--crimson); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ TYPOGRAPHY ============ */
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.3; }

.section-title {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 2rem;
  color: var(--charcoal);
}

.lead { font-size: 1.15rem; color: #555; max-width: 600px; margin: 0 auto 1.5rem; }
.text-center { text-align: center; }
.text-muted { color: #888; font-size: 0.9rem; }

/* ============ LAYOUT ============ */
.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem; }
.container-sm { max-width: 640px; }
.section { padding: 4rem 0; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-block;
  padding: 0.7rem 1.8rem;
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--crimson);
  color: #fff;
  border-color: var(--crimson);
}
.btn-primary:hover { background: #7d1526; border-color: #7d1526; text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--forest);
  border-color: var(--forest);
}
.btn-ghost:hover { background: var(--forest); color: #fff; text-decoration: none; }

.btn-sm { padding: 0.4rem 1rem; font-size: 0.85rem; }
.btn-full { width: 100%; }

/* ============ CARDS ============ */
.card {
  background: var(--stone);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}

/* ============ NAVIGATION ============ */
.main-nav {
  background: #fff;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--charcoal);
}
.nav-logo:hover { text-decoration: none; color: var(--crimson); }

.nav-links {
  list-style: none;
  display: none;
  flex-direction: column;
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  background: #fff;
  box-shadow: var(--shadow-md);
  padding: 1rem 0;
}

.nav-links.open { display: flex; }

.nav-links li a {
  display: block;
  padding: 0.6rem 1.5rem;
  color: var(--charcoal);
  font-size: 0.95rem;
}
.nav-links li a:hover,
.nav-links li a.active { color: var(--crimson); text-decoration: none; }

.nav-rsvp {
  font-weight: 700;
  color: var(--crimson) !important;
}

/* Hamburger */
.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--charcoal);
  transition: all 0.3s;
}
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ============ HERO ============ */
.hero {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--stone);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  width: 100%;
}

.hero-overlay {
  text-align: center;
  padding: 2rem 1.5rem;
  background: rgba(255,255,255,0.85);
  border-radius: var(--radius);
  max-width: 600px;
  margin: 1rem;
}

.hero h1 {
  font-size: 2.5rem;
  color: var(--charcoal);
  margin-bottom: 0.5rem;
}
.hero-date { font-size: 1.15rem; color: #555; margin-bottom: 0.25rem; }
.hero-venue { color: #777; margin-bottom: 1.5rem; }

.hero-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; align-items: center; }

/* Add-to-calendar button alignment in hero */
.hero-buttons add-to-calendar-button { display: inline-flex; align-items: center; line-height: 1; }

/* ============ COUNTDOWN ============ */
.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 1.5rem 0;
}

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

.countdown-number {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--crimson);
}

.countdown-label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #888;
}

/* ============ TIMELINE ============ */
.timeline { position: relative; padding: 2rem 0; }
.timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gold);
}

.timeline-item {
  position: relative;
  padding-left: 50px;
  margin-bottom: 2rem;
}

.timeline-dot {
  position: absolute;
  left: 12px;
  top: 1.5rem;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--crimson);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--gold);
}

.timeline-content { margin: 0; }
.timeline-date { display: inline-block; font-size: 0.85rem; color: var(--crimson); font-weight: 600; margin-bottom: 0.5rem; }

/* ============ PAGE SUBTITLE ============ */
.section-subtitle {
  text-align: center;
  color: #666;
  font-size: 1.1rem;
  margin-top: -1.25rem;
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.hero-overlay .section-subtitle { margin-top: 0.1rem; margin-bottom: 0.5rem; color: #555; }
.timeline-page-title ~ .section-subtitle { color: rgba(255,255,255,0.85); }

/* ============ ITINERARY ============ */
.itinerary-schedule { max-width: 680px; margin: 0 auto; padding: 0; overflow: hidden; }
.schedule-row { display: flex; gap: 1.5rem; padding: 1rem 1.5rem; border-bottom: 1px solid rgba(0,0,0,0.07); }
.schedule-row--last { border-bottom: none; }
.schedule-time { min-width: 90px; font-weight: 700; color: var(--crimson); font-size: 0.9rem; padding-top: 0.15rem; }
.schedule-title { font-family: var(--font-display); font-size: 1rem; }
.schedule-desc { margin: 0.25rem 0 0; color: #666; font-size: 0.9rem; }

/* ============ HOTELS ============ */
.hotels-grid { display: grid; gap: 1rem; }
.hotel-card h3 { margin-bottom: 0.5rem; }
.hotel-address { color: #666; font-size: 0.9rem; }
.hotel-phone { font-size: 0.9rem; margin: 0.25rem 0; }
.hotel-notes { font-style: italic; font-size: 0.9rem; color: #777; margin: 0.5rem 0; }

/* ============ GALLERY ============ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.gallery-item {
  cursor: pointer;
  overflow: hidden;
  border-radius: var(--radius);
  position: relative;
}

.gallery-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.3s;
}
.gallery-item:hover img { transform: scale(1.05); }

.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.lightbox.active { display: flex; }

.lightbox-img { max-width: 90vw; max-height: 80vh; object-fit: contain; }
.lightbox-caption { color: #fff; margin-top: 1rem; font-size: 0.95rem; }

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
}
.lightbox-close { top: 1rem; right: 1.5rem; font-size: 2.5rem; }
.lightbox-prev { left: 1rem; top: 50%; transform: translateY(-50%); font-size: 3rem; }
.lightbox-next { right: 1rem; top: 50%; transform: translateY(-50%); font-size: 3rem; }

/* ============ FAQ ============ */
.faq-list { max-width: 640px; margin: 0 auto; }

.faq-item {
  background: var(--stone);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.faq-item summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::after {
  content: '+';
  font-size: 1.5rem;
  color: var(--crimson);
  transition: transform 0.2s;
}
.faq-item[open] summary::after { content: '-'; }

.faq-answer { padding: 0 1.25rem 1rem; color: #555; }

/* ============ VENUE ============ */
.venue-image { border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem; }
.venue-image img { width: 100%; max-height: 400px; object-fit: cover; }
.map-embed { margin-top: 1.5rem; border-radius: var(--radius); overflow: hidden; }
.map-embed iframe { width: 100%; height: 350px; border: 0; }

/* ============ RSVP FORM ============ */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.35rem; font-size: 0.9rem; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--crimson);
}

/* ============ FLASH MESSAGES ============ */
.flash {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}
.flash-success { background: #d4edda; color: #155724; }
.flash-error { background: #f8d7da; color: #721c24; }

/* ============ FOOTER ============ */
.site-footer {
  text-align: center;
  padding: 2rem 0;
  background: var(--stone);
  margin-top: auto;
  font-size: 0.9rem;
  color: #888;
}
.site-footer p:first-child {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--charcoal);
  margin-bottom: 0.25rem;
}

/* ============ BADGES ============ */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: capitalize;
}
.badge-yes { background: #d4edda; color: #155724; }
.badge-no { background: #f8d7da; color: #721c24; }
.badge-maybe { background: #fff3cd; color: #856404; }

/* ============ LOGIN PAGE ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--stone);
}
.login-card {
  width: 100%;
  max-width: 400px;
  margin: 1rem;
  background: #fff;
}
.login-card h1 {
  text-align: center;
  margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
  .hero-countdown-wrap { flex-direction: column; }
  .hero-couple-img img { width: 150px; height: 150px; }
}

/* ============ RESPONSIVE: TABLET ============ */
@media (min-width: 768px) {
  .nav-links {
    display: flex;
    flex-direction: row;
    position: static;
    box-shadow: none;
    padding: 0;
    gap: 0.25rem;
  }
  .nav-links li a { padding: 0.4rem 0.6rem; }
  .hamburger { display: none; }

  .hero h1 { font-size: 3.5rem; }
  .section-title { font-size: 2.5rem; }

  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
  .gallery-item img { height: 240px; }

  .hotels-grid { grid-template-columns: repeat(2, 1fr); }

  .form-row { display: flex; gap: 1rem; }
  .form-row .form-group { flex: 1; }

  .timeline::before { left: 50%; }
  .timeline-item { padding-left: 0; width: 50%; }
  .timeline-left { padding-right: 2rem; text-align: right; }
  .timeline-left .timeline-dot { right: -9px; left: auto; }
  .timeline-right { margin-left: 50%; padding-left: 2rem; }
  .timeline-right .timeline-dot { left: -9px; }
}

/* ============ RESPONSIVE: DESKTOP ============ */
@media (min-width: 1024px) {
  .gallery-grid { grid-template-columns: repeat(4, 1fr); }
  .gallery-item img { height: 260px; }
}

/* ============ SONG SEARCH (RSVP) ============ */
.song-search-wrap {
  position: relative;
}

.song-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 50;
  max-height: 280px;
  overflow-y: auto;
}

.song-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}
.song-result-item:hover { background: var(--stone); }

.song-result-art {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}
.song-result-art-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: #e8e8e8;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bbb;
  font-size: 1.1rem;
}

.song-result-info { min-width: 0; }
.song-result-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-result-sub { font-size: 0.8rem; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.song-results-message {
  padding: 0.75rem 0.9rem;
  color: #888;
  font-size: 0.9rem;
}

.song-list {
  list-style: none;
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.song-list-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--stone);
  border-radius: var(--radius);
  padding: 0.45rem 0.75rem;
}

.song-list-art {
  width: 32px;
  height: 32px;
  border-radius: 3px;
  object-fit: cover;
  flex-shrink: 0;
}
.song-list-art-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 3px;
  background: #e0e0e0;
  flex-shrink: 0;
}

.song-list-info { flex: 1; min-width: 0; }
.song-list-name { font-size: 0.88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-list-sub { font-size: 0.78rem; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.song-list-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #bbb;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.15rem;
  transition: color 0.15s;
  flex-shrink: 0;
}
.song-list-remove:hover { color: var(--crimson); }

/* ============ TIMELINE PAGE BACKGROUND ============ */
.page-timeline { background: transparent; }

.timeline-bg-wrapper {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(135deg, #1a0a0f 0%, #2a1520 100%);
  overflow: hidden;
}

.timeline-bg-panel {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.4s ease-in-out;
  will-change: transform, opacity;
}
.timeline-bg-panel.active { opacity: 1; }
.timeline-bg-panel:nth-child(1) { animation: kenBurns1 22s ease-in-out infinite alternate; }
.timeline-bg-panel:nth-child(2) { animation: kenBurns2 22s ease-in-out infinite alternate; }

@keyframes kenBurns1 {
  0%   { transform: scale(1.0) translate(0%, 0%); }
  100% { transform: scale(1.1) translate(-2%, -1.5%); }
}
@keyframes kenBurns2 {
  0%   { transform: scale(1.08) translate(-1%, -0.5%); }
  100% { transform: scale(1.0) translate(1%, 1.2%); }
}

/* Dark overlay scrim so cards are readable */
.timeline-bg-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  pointer-events: none;
}

/* ============ TIMELINE PAGE SECTION ============ */
.timeline-page-section { background: transparent; }
.timeline-page-title { color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.5); }

/* ============ HERO COUPLE IMAGE ============ */
.hero-countdown-wrap { display: flex; align-items: center; justify-content: center; gap: 2rem; }
.hero-couple-img img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  border: 4px solid rgba(255,255,255,0.6);
}

/* ============ TIMELINE IMAGE CAROUSEL ============ */
.timeline-carousel {
  margin: -1.5rem -1.5rem 1rem -1.5rem;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  position: relative;
}
.timeline-carousel-slide { display: none; }
.timeline-carousel-slide.active { display: block; }
.timeline-carousel-slide img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.38);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  padding: 0;
  transition: background 0.2s;
}
.carousel-btn:hover { background: rgba(0,0,0,0.62); }
.carousel-prev { left: 0.5rem; }
.carousel-next { right: 0.5rem; }
.carousel-dots {
  position: absolute;
  bottom: 0.5rem;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  pointer-events: none;
}
.carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  cursor: pointer;
  pointer-events: all;
  transition: background 0.2s, transform 0.15s;
}
.carousel-dot.active { background: #fff; transform: scale(1.25); }

/* ============ TIMELINE EVENT IMAGES ============ */
.timeline-event-img {
  margin: -1.5rem -1.5rem 1rem -1.5rem; /* bleed to card edges */
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  max-height: 220px;
}
.timeline-event-img img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.timeline-event-img img:hover { transform: scale(1.03); }

/* ============ SCROLL-REVEAL ANIMATION ============ */
.timeline-animate .timeline-item {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.timeline-animate .timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
}
/* Stagger left vs right */
.timeline-animate .timeline-left  { transition-delay: 0.05s; }
.timeline-animate .timeline-right { transition-delay: 0.15s; }

/* ============ CHECKBOX GROUP (RSVP) ============ */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-bottom: 0.75rem;
}
.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: normal;
  cursor: pointer;
}

/* ============ PAGE BACKGROUNDS ============ */
.page-bg-fixed {
  position: fixed;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: -2;
  pointer-events: none;
}
.page-bg-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
body.page-registry,
body.page-venue,
body.page-itinerary,
body.page-hotels,
body.page-gallery,
body.page-faq {
  background: transparent;
}

/* ============ REGISTRY LETTER CARD ============ */
.letter-card {
  max-width: 640px;
  margin: 2rem auto;
  padding: 2.5rem 3rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(0,0,0,0.08);
}
.letter-body {
  font-size: 1.05rem;
  line-height: 1.8;
  text-align: left;
  margin-bottom: 1.5rem;
  white-space: pre-wrap;
}
.letter-closing {
  text-align: left;
  margin-top: 1rem;
}
.letter-closing p { margin: 0; line-height: 1.6; }
.letter-signature {
  font-family: 'Dancing Script', cursive;
  font-size: 2rem;
  color: var(--crimson);
  margin-top: 0.25rem;
}
