*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
:root {
  --bg: #FAF6F1;
  --surface: #FFFFFF;
  --text: #5C4A3A;
  --primary: #C4967A;
  --secondary: #A8B5A0;
}
.t12-body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Josefin Sans', sans-serif;
  font-weight: 400;
}

/* Loading */
.loader-wrap {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.8s, visibility 0.8s;
  background: var(--bg);
}
.loader-wrap.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-leaf { animation: floatLeaf 2s ease-in-out infinite; }
@keyframes floatLeaf {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-12px) rotate(8deg); }
}
.loader-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin: 0 3px;
  animation: dotPulse 1.2s infinite;
}
.loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.loader-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}

/* Cover */
.cover-section {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cover-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #D4A98C 0%, #C4967A 25%, #B8907A 50%, #A8B5A0 75%, #8FA889 100%);
  background-size: 400% 400%;
  animation: gradShift 12s ease infinite;
}
@keyframes gradShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.cover-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(250, 246, 241, 0.15) 0%, rgba(92, 74, 58, 0.45) 100%);
}
.cover-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 1rem 1.25rem;
  max-width: 28rem;
  margin-inline: auto;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1.2s ease, transform 1.2s ease;
}
.cover-content.visible { opacity: 1; transform: translateY(0); }

/* Ornaments */
.ornament { position: absolute; pointer-events: none; opacity: 0.15; }
.float-1 { animation: float1 6s ease-in-out infinite; }
.float-2 { animation: float2 8s ease-in-out infinite; }
.float-3 { animation: float3 5s ease-in-out infinite; }
@keyframes float1 {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-20px) rotate(5deg); }
}
@keyframes float2 {
  0%, 100% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-15px) translateX(10px); }
}
@keyframes float3 {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.05); }
}

.butterfly { position: absolute; pointer-events: none; opacity: 0.2; animation: butterflyPath 10s ease-in-out infinite; }
.butterfly svg { animation: wingFlap 0.4s ease-in-out infinite alternate; }
@keyframes butterflyPath {
  0% { transform: translate(0, 0); }
  25% { transform: translate(40px, -30px); }
  50% { transform: translate(-20px, -50px); }
  75% { transform: translate(30px, -20px); }
  100% { transform: translate(0, 0); }
}
@keyframes wingFlap {
  0% { transform: scaleX(1); }
  100% { transform: scaleX(0.5); }
}

.deer-orn { opacity: 0.08; }

/* Invitation states */
.inv-closed .main-scroll { display: none; }
.inv-open .main-scroll { display: block; }
.inv-open .cover-section { height: auto; min-height: 100%; }
#coverSection.cover-dismissed {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Main scroll area */
.main-scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.main-scroll::-webkit-scrollbar { width: 5px; }
.main-scroll::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background: rgba(196, 150, 122, 0.35);
}

/* Section rhythm — spacing konsisten */
.t12-section {
  padding: 3.25rem 1.25rem;
  position: relative;
  width: 100%;
}
@media (min-width: 768px) {
  .t12-section { padding: 3.75rem 1.5rem; }
}
.t12-section--tight-top { padding-top: 2.5rem; }
.t12-inner { max-width: 40rem; margin-inline: auto; }
.t12-inner--wide { max-width: 42rem; }
.t12-inner--grid { max-width: 37.5rem; }

.section-reveal {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.75s ease, transform 0.75s ease;
}
.section-reveal.visible { opacity: 1; transform: translateY(0); }
.section-zoom {
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.75s ease, transform 0.75s ease;
}
.section-zoom.visible { opacity: 1; transform: scale(1); }

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  z-index: 100;
  transition: width 0.15s ease;
  background: var(--primary);
  width: 0%;
}

.music-btn {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  right: max(20px, env(safe-area-inset-right));
  z-index: 100;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  background: var(--surface);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  transition: transform 0.3s ease;
}
.music-btn:hover { transform: scale(1.08); }
.music-btn.playing .music-bars span { animation: musicBar 0.6s ease-in-out infinite alternate; }
.music-btn.playing .music-bars span:nth-child(2) { animation-delay: 0.15s; }
.music-btn.playing .music-bars span:nth-child(3) { animation-delay: 0.3s; }
.music-bars { display: flex; gap: 2px; align-items: flex-end; height: 16px; }
.music-bars span { width: 3px; border-radius: 2px; transition: height 0.3s; }
@keyframes musicBar {
  0% { height: 4px; }
  100% { height: 14px; }
}

.section-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 1.25rem 1.5rem;
  opacity: 0.55;
}
.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  max-width: 80px;
  height: 1px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  max-width: 600px;
  margin-inline: auto;
}
.gallery-item {
  overflow: hidden;
  border-radius: 12px;
  aspect-ratio: 1;
  position: relative;
}
.gallery-item .gallery-inner {
  width: 100%;
  height: 100%;
  transition: transform 0.45s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-item:hover .gallery-inner { transform: scale(1.06); }
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wish-card {
  border-radius: 16px;
  padding: 1.25rem 1.35rem;
  transition: transform 0.3s ease;
  position: relative;
  background: var(--surface);
  border: 1px solid rgba(196, 150, 122, 0.14);
}
.wish-card:hover { transform: translateY(-3px); }

.wishes-stack { display: flex; flex-direction: column; gap: 1rem; max-width: 600px; margin-inline: auto; }

.rsvp-input {
  border: none;
  border-bottom: 1.5px solid rgba(196, 150, 122, 0.35);
  padding: 12px 4px;
  font-size: 15px;
  background: transparent;
  width: 100%;
  outline: none;
  transition: border-color 0.3s ease;
  color: var(--text);
  font-family: inherit;
}
.rsvp-input:focus { border-color: var(--primary); }
.rsvp-radio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.rsvp-label {
  padding: 10px 22px;
  border-radius: 999px;
  border: 1.5px solid;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  display: inline-block;
}
.rsvp-label[for='attendYes'] { border-color: var(--primary); color: var(--primary); }
.rsvp-label[for='attendNo'] { border-color: var(--secondary); color: var(--secondary); }
#attendYes:checked + .rsvp-label {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
#attendNo:checked + .rsvp-label {
  background: var(--secondary);
  color: #fff;
  border-color: var(--secondary);
}
.rsvp-pills { display: flex; gap: 12px; flex-wrap: wrap; }

.rsvp-card {
  max-width: 420px;
  margin-inline: auto;
  padding: 1.75rem 1.5rem 1.85rem;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid rgba(196, 150, 122, 0.15);
}
@media (min-width: 480px) {
  .rsvp-card { padding: 2rem 1.75rem; }
}
.rsvp-field { margin-bottom: 1.35rem; }
.rsvp-field:last-of-type { margin-bottom: 1.5rem; }
.rsvp-submit {
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.2s ease;
}
.rsvp-submit:hover { opacity: 0.92; }
.rsvp-submit:disabled { opacity: 0.55; cursor: not-allowed; }

.event-card {
  max-width: 480px;
  margin-inline: auto;
  padding: 1.75rem 1.35rem;
  border-radius: 20px;
  border: 1px solid rgba(196, 150, 122, 0.2);
  background: var(--surface);
}
@media (min-width: 480px) {
  .event-card { padding: 2rem 1.75rem; }
}
.event-card__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.event-card__block { text-align: center; min-width: 100px; }
.event-card__sep { width: 1px; height: 44px; background: var(--primary); opacity: 0.2; }
.event-card__venue { margin-top: 1.35rem; padding-top: 1.35rem; border-top: 1px solid rgba(196, 150, 122, 0.15); }

.map-wrap {
  max-width: 600px;
  margin-inline: auto;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(196, 150, 122, 0.15);
}
.map-placeholder {
  min-height: 220px;
  background: linear-gradient(135deg, #e8e0d8, #d4ccc4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  padding: 1.5rem;
}
.map-wrap iframe { width: 100%; height: 220px; border: 0; display: block; }

.toast {
  position: fixed;
  bottom: max(88px, calc(88px + env(safe-area-inset-bottom)));
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  padding: 12px 22px;
  border-radius: 12px;
  z-index: 200;
  opacity: 0;
  transition: all 0.35s ease;
  pointer-events: none;
  font-size: 14px;
  max-width: min(90vw, 360px);
  text-align: center;
  line-height: 1.4;
  background: var(--text);
  color: var(--bg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  background: rgba(92, 74, 58, 0.35);
  backdrop-filter: blur(4px);
}
.confirm-overlay.show { opacity: 1; visibility: visible; }

.couple-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem 1.75rem;
  justify-content: center;
  max-width: 700px;
  margin-inline: auto;
}
.couple-card { flex: 1; min-width: 230px; max-width: 320px; text-align: center; }

.avatar-ring {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  margin: 0 auto 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--primary);
  overflow: hidden;
  background: linear-gradient(135deg, #f0d9cc, #e8c4b8);
}
.avatar-ring--groom {
  border-color: var(--secondary);
  background: linear-gradient(135deg, #c8d4c4, #b5c4b0);
}

.open-btn {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 14px 36px;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.35s ease;
  margin-top: 0.25rem;
}
.open-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.85);
}

.t12-kicker {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
  opacity: 0.5;
}
.t12-heading {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.65rem, 4vw, 2.35rem);
  margin: 0;
  font-weight: 300;
}

.gift-wrap { max-width: 480px; margin-inline: auto; }
.t12-gift-registry { margin-top: 0.35rem; }
.t12-gift-registry .gift-registry-shared { margin-top: 0.25rem; }
.t12-gift-lead { text-align: center; color: rgba(92, 74, 58, 0.78); font-size: 0.95rem; line-height: 1.65; margin: 0 0 1.5rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.quote-mark { margin: 0 auto 1.1rem; display: block; }
