@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  /* ── 8-color palette — set dynamically by script.js from DB settings ── */
  --color-bg:           #fbf7ef;
  --color-primary:      #b6935b;
  --color-primary-dark: #6c7357;
  --color-secondary:    #e8dcc8;
  --color-accent-light: #f0e8d8;
  --color-accent:       #9a8870;
  --color-neutral:      #756f63;
  --color-surface:      #f0ece4;
  /* derived — recomputed by JS when palette changes */
  --color-primary-border:  var(--color-primary-border);
  --color-primary-border2: var(--color-primary-border2);

  /* ── Legacy aliases → palette ── */
  --cream:  var(--color-bg);
  --gold:   var(--color-primary);
  --olive:  var(--color-primary-dark);
  --muted:  var(--color-neutral);

  /* ── Constants ── */
  --ink:    #2d2a24;
  --paper:  var(--color-surface);
  --shadow: 0 20px 60px rgba(45, 42, 36, 0.12);
  --hero-url: none;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-couple:  'Alex Brush', cursive;
  --font-heading: 'Cormorant Garamond', serif;
  --font-kicker:  inherit;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--color-bg);
}

body.locked { overflow: hidden; }

/* ── Start screen ──────────────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(rgba(40,35,28,.2), rgba(40,35,28,.45)),
    var(--hero-url) center/cover,
    linear-gradient(135deg, var(--color-accent-light), var(--color-secondary));
}

.start-card {
  width: min(92vw, 460px);
  padding: 44px 28px;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 28px;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(18px);
  text-align: center;
  box-shadow: var(--shadow);
}

.start-card h1 {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(74px, 18vw, 132px);
  line-height: .75;
  margin: 18px 0;
  font-weight: 700;
}

.start-card h1 span { color: var(--gold); }

.kicker {
  text-transform: uppercase;
  letter-spacing: .22em;
  font-size: .75rem;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 4px;
  font-family: var(--font-kicker);
}

.date, .subtitle { color: var(--muted); }

/* ── Buttons ───────────────────────────────────────────────────── */
.primary-btn, .ghost-btn {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.primary-btn {
  margin-top: 20px;
  padding: 14px 28px;
  border-radius: 999px;
  background: var(--color-primary);
  color: var(--color-bg);
  font-weight: 700;
  box-shadow: 0 12px 25px rgba(45,42,36,.18);
  transition: background 0.18s;
}
.primary-btn:hover { background: var(--color-primary-dark); }

.ghost-btn {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(255,255,255,.76);
  color: var(--ink);
  border: 1px solid var(--color-primary-border);
  transition: background 0.2s, color 0.2s;
}

.ghost-btn.playing {
  background: var(--color-primary);
  color: var(--color-bg);
  border-color: var(--color-primary);
  animation: music-pulse 2.4s ease-in-out infinite;
}

@keyframes music-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--color-primary), 0); }
  50%       { box-shadow: 0 0 0 6px rgba(0,0,0,0); }
}

/* ── Top bar ───────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  z-index: 10;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.topbar > * { pointer-events: auto; }

.monogram {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.5rem;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.74);
  border: 1px solid var(--color-primary-border);
}

/* ── Section nav dots ──────────────────────────────────────────── */
.section-nav {
  position: fixed;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.section-nav.visible { pointer-events: auto; }

.section-nav button {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid rgba(182,147,91,.5);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, border-color 0.2s;
  opacity: 0.6;
}

.section-nav button.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  opacity: 1;
}

/* ── Scroll to top ─────────────────────────────────────────────── */
.scroll-top-btn {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  background: rgba(255,255,255,.9);
  border: 1px solid var(--color-primary-border);
  border-radius: 999px;
  padding: 9px 22px;
  cursor: pointer;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.1rem;
  color: var(--ink);
  z-index: 9;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

.scroll-top-btn.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ── Sections ──────────────────────────────────────────────────── */
.section {
  padding: 96px 22px 80px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.section > * { max-width: 860px; }

/* Hero stays full-screen — standalone layout, not inheriting .section grid */
.hero {
  min-height: 100vh;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* top padding clears the fixed topbar and adds visual breathing room */
  padding: 120px 28px 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
  /* darker overlay so placeholder or real photo text doesn't bleed through */
  background:
    linear-gradient(rgba(30,26,20,.55), rgba(30,26,20,.78)),
    var(--hero-url) center/cover,
    linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
}

/* hero does not participate in .section > * max-width rule */
.hero > * { max-width: 680px; }

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-shadow: 0 6px 24px rgba(0,0,0,.4);
}

.hero-content .kicker {
  margin-bottom: 16px;
  letter-spacing: .28em;
}

.hero-content h2 {
  font-size: clamp(48px, 10vw, 96px);
  line-height: 1;
  margin: 0 0 16px;
}

.hero-content .subtitle {
  font-size: clamp(14px, 3.5vw, 18px);
  color: rgba(255,255,255,.75);
  letter-spacing: .04em;
}

.scroll-hint {
  margin-top: 48px;
  font-size: 1.4rem;
  opacity: 0.6;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(7px); }
}

h2 {
  font-family: var(--font-heading);
  font-size: clamp(38px, 8vw, 84px);
  line-height: 1;
  margin: 8px 0 16px;
}

.couple-name { font-family: var(--font-couple) !important; }

.story p, .story div, .gifts p, .gifts div {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(20px, 4.5vw, 32px);
  line-height: 1.3;
  color: var(--muted);
}

.detail-grid {
  width: min(100%, 940px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 28px;
}

.detail-grid article {
  background: var(--paper);
  border: 1px solid var(--color-primary-border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.icon { font-size: 2rem; }

.text-link { color: var(--olive); font-weight: 700; }

/* ── Slideshow ─────────────────────────────────────────────────── */
.slideshow {
  position: relative;
  width: min(100%, 480px);
  margin-top: 28px;
}

.slides-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  aspect-ratio: 4 / 5;
  background: #e7dac5;
  box-shadow: var(--shadow);
}

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.slide.active { opacity: 1; }

.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.slide-arrow {
  position: absolute;
  top: 45%;
  transform: translateY(-50%);
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.88);
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
  transition: opacity .15s;
}

.slide-arrow:hover { opacity: 0.8; }
.slide-prev { left: -19px; }
.slide-next { right: -19px; }

.slide-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 14px;
}

.slide-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary-border);
  cursor: pointer;
  padding: 0;
  transition: background 0.2s;
}

.slide-dot.active { background: var(--color-primary); }

/* ── Schedule ──────────────────────────────────────────────────── */
.timeline {
  width: min(100%, 640px);
  display: grid;
  gap: 10px;
  text-align: left;
  margin-top: 8px;
}

.timeline div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  border-radius: 18px;
  background: rgba(255,255,255,.62);
  border: 1px solid var(--color-primary-border2);
}

/* ── RSVP ──────────────────────────────────────────────────────── */
.rsvp-contact {
  color: var(--muted);
  margin-bottom: 28px;
  line-height: 1.8;
}

.rsvp-members-container {
  width: min(100%, 560px);
  display: grid;
  gap: 12px;
}

.rsvp-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  background: var(--paper);
  border: 1px solid var(--color-primary-border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.rsvp-name { font-family: "Cormorant Garamond", serif; font-size: 1.35rem; text-align: left; }
.rsvp-toggle { display: flex; gap: 8px; flex-shrink: 0; }

.rsvp-yes,
.rsvp-no {
  padding: 10px 22px;
  border-radius: 999px;
  border: 2px solid;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  transition: background .18s, color .18s;
}

.rsvp-yes          { border-color: var(--color-primary); color: var(--color-primary); background: transparent; }
.rsvp-yes.active   { background: var(--color-primary); color: var(--color-bg); }
.rsvp-no           { border-color: #8b3a3a; color: #8b3a3a; background: transparent; }
.rsvp-no.active    { background: #8b3a3a;   color: white; }

/* Stacked layout — used when button labels are multi-word */
.rsvp-member-row.stacked { flex-direction: column; align-items: stretch; gap: 10px; }
.rsvp-member-row.stacked .rsvp-toggle { width: 100%; }
.rsvp-member-row.stacked .rsvp-yes,
.rsvp-member-row.stacked .rsvp-no { flex: 1; text-align: center; }

.rsvp-total { margin-top: 8px; font-size: 1.05rem; color: var(--muted); text-align: center; }
.rsvp-total strong { color: var(--ink); font-size: 1.2rem; }

.rsvp-submit-area { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 4px; }

.rsvp-result {
  padding: 14px 20px;
  border-radius: 14px;
  background: #eef4e8;
  border: 1px solid rgba(108,115,87,.3);
  text-align: center;
  width: 100%;
}

.rsvp-result.error { background: #f4e8e8; border-color: rgba(139,58,58,.3); }

.rsvp-deadline-note {
  font-size: .9rem;
  color: var(--color-primary-dark);
  font-style: italic;
  margin-bottom: 16px;
  text-align: center;
}

.rsvp-deadline-msg {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(18px, 4vw, 26px);
  color: var(--color-primary-dark);
  text-align: center;
  line-height: 1.5;
  padding: 16px 0;
}

/* ── Misc ──────────────────────────────────────────────────────── */
.small-note, .tiny { color: var(--muted); font-size: .9rem; }

/* ── Messages section ─────────────────────────────────────────────── */
.message-form-wrap { width: min(100%, 560px); }

.message-textarea {
  width: 100%;
  min-height: 140px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--color-primary-border);
  background: var(--paper);
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  resize: vertical;
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}
.message-textarea:focus { outline: none; border-color: var(--gold); }

.message-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.char-counter              { font-size: .85rem; color: var(--muted); }
.char-counter.near-limit   { color: #d4880a; }
.char-counter.at-limit     { color: #8b3a3a; font-weight: 600; }

.message-result {
  margin-top: 14px;
  padding: 14px 18px;
  border-radius: 14px;
  background: #eef4e8;
  border: 1px solid rgba(108,115,87,.3);
  text-align: center;
}
.message-result.error { background: #f4e8e8; border-color: rgba(139,58,58,.3); }

/* ── Section backgrounds ───────────────────────────────────────────── */
.story    { background: var(--color-surface); }
.details  { background: var(--color-bg); }
.gallery  { background: var(--color-accent-light); }
.schedule { background: var(--color-surface); }
.rsvp     { background: var(--color-bg); }
.messages { background: var(--color-accent-light); }
.gifts    { background: var(--color-surface); }

footer {
  padding: 60px 20px 80px;
  text-align: center;
  background: var(--color-primary-dark);
  color: var(--color-bg);
}
footer p, footer .tiny { color: inherit; opacity: 0.88; }

.hidden { display: none !important; }

@media (max-width: 760px) {
  .detail-grid { grid-template-columns: 1fr; }
  .timeline div { display: grid; }
  .section-nav { display: none; }
  .slide-prev { left: 8px; }
  .slide-next { right: 8px; }
}
