/* ============================================================
   SHARED INVITATION WIDGETS — used by all templates
   Theme via CSS variables on :root in each template:
     --w-accent       primary accent color (buttons, headings)
     --w-accent-text  text on top of --w-accent
     --w-bg           page background
     --w-text         primary text color
     --w-card-bg      card / surface background
     --w-border       borders
     --w-shadow       shadow color (rgba)
     --w-font-display Cinzel-style display font
     --w-font-script  Italianno-style script font
   Fallbacks are provided so widgets always render legibly.
   ============================================================ */

:root {
  --w-accent: var(--w-accent, #8b7028);
  --w-accent-text: var(--w-accent-text, #ffffff);
  --w-bg: var(--w-bg, #ffffff);
  --w-text: var(--w-text, #1a1410);
  --w-card-bg: var(--w-card-bg, rgba(255, 255, 255, 0.7));
  --w-border: var(--w-border, rgba(0, 0, 0, 0.1));
  --w-shadow: var(--w-shadow, rgba(0, 0, 0, 0.15));
  --w-font-display: var(--w-font-display, 'Cinzel', serif);
  --w-font-script: var(--w-font-script, 'Italianno', cursive);
}

#invite-widgets {
  margin: 60px auto 40px;
  max-width: 720px;
  padding: 0 24px;
  position: relative;
  z-index: 3;
  font-family: inherit;
  color: var(--w-text);
}

/* === SECTION HEADING === */
.w-heading {
  text-align: center;
  margin-bottom: 28px;
}
.w-heading-script {
  font-family: var(--w-font-script);
  font-size: clamp(38px, 6vw, 52px);
  color: var(--w-accent);
  line-height: 1;
  margin-bottom: 4px;
}
.w-heading-sub {
  font-family: var(--w-font-display);
  font-size: 11px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--w-accent);
  opacity: 0.75;
}

/* === ACTION BAR (4 buttons) === */
.w-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 50px;
}
@media (max-width: 600px) {
  .w-actions { grid-template-columns: repeat(2, 1fr); }
}

.w-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  /* Force every action button to the same intrinsic size — without these,
     buttons inside .w-dropdown wrappers shrink to content width and end up
     narrower than the bare RSVP/Map buttons. */
  width: 100%;
  height: 100%;
  min-height: 80px;
  padding: 18px 12px;
  background: var(--w-card-bg);
  border: 1px solid var(--w-border);
  color: var(--w-text);
  font-family: var(--w-font-display);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  text-decoration: none;
  text-align: center;
  border-radius: 4px;
  -webkit-tap-highlight-color: transparent;
}
.w-btn:hover, .w-btn:focus-visible {
  background: var(--w-accent);
  color: var(--w-accent-text);
  border-color: var(--w-accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--w-shadow);
  outline: none;
}
.w-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}
.w-btn .w-btn-label {
  line-height: 1.2;
}

/* === DROPDOWN (Calendar / Share) === */
.w-dropdown {
  position: relative;
  display: flex;
  /* Stretch the wrapper so the .w-btn inside fills the grid cell evenly */
  width: 100%;
  height: 100%;
}
.w-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 200px;
  background: var(--w-bg);
  border: 1px solid var(--w-border);
  box-shadow: 0 14px 36px var(--w-shadow);
  border-radius: 4px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
  z-index: 20;
  overflow: hidden;
}
.w-dropdown.open .w-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.w-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-family: var(--w-font-display);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--w-text);
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}
.w-dropdown-item:not(:last-child) {
  border-bottom: 1px solid var(--w-border);
}
.w-dropdown-item:hover {
  background: var(--w-accent);
  color: var(--w-accent-text);
}
.w-dropdown-item svg { width: 16px; height: 16px; flex-shrink: 0; }

/* === MODAL (RSVP) === */
.w-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
.w-modal.open {
  opacity: 1;
  visibility: visible;
}
.w-modal-card {
  background: var(--w-bg);
  border: 1px solid var(--w-border);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 4px;
  padding: 36px 32px;
  position: relative;
  transform: translateY(40px) scale(0.96);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.w-modal.open .w-modal-card { transform: translateY(0) scale(1); }

.w-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--w-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--w-text);
  transition: background 0.2s, color 0.2s;
}
.w-modal-close:hover { background: var(--w-accent); color: var(--w-accent-text); border-color: var(--w-accent); }
.w-modal-close svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }

.w-modal-title {
  font-family: var(--w-font-script);
  font-size: 44px;
  color: var(--w-accent);
  text-align: center;
  line-height: 1;
  margin-bottom: 6px;
}
.w-modal-sub {
  text-align: center;
  font-style: italic;
  font-size: 14px;
  color: var(--w-text);
  opacity: 0.75;
  margin-bottom: 28px;
}

/* === FORM FIELDS === */
.w-field {
  margin-bottom: 18px;
}
.w-field label {
  display: block;
  font-family: var(--w-font-display);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--w-accent);
  opacity: 0.85;
  margin-bottom: 6px;
}
.w-field input[type="text"],
.w-field input[type="number"],
.w-field input[type="email"],
.w-field textarea {
  width: 100%;
  background: var(--w-card-bg);
  border: 1px solid var(--w-border);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 16px;
  color: var(--w-text);
  outline: none;
  border-radius: 4px;
  transition: border-color 0.2s, background 0.2s;
}
.w-field textarea {
  min-height: 90px;
  resize: vertical;
}
.w-field input:focus,
.w-field textarea:focus {
  border-color: var(--w-accent);
  background: var(--w-bg);
}

.w-radio-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.w-radio {
  position: relative;
}
.w-radio input { position: absolute; opacity: 0; pointer-events: none; }
.w-radio span {
  display: block;
  text-align: center;
  padding: 12px 8px;
  border: 1px solid var(--w-border);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--w-font-display);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: all 0.2s;
  background: var(--w-card-bg);
  color: var(--w-text);
}
.w-radio input:checked + span {
  background: var(--w-accent);
  color: var(--w-accent-text);
  border-color: var(--w-accent);
}

.w-submit {
  width: 100%;
  padding: 14px;
  background: var(--w-accent);
  color: var(--w-accent-text);
  border: none;
  font-family: var(--w-font-display);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
  margin-top: 8px;
}
.w-submit:hover {
  letter-spacing: 0.4em;
  filter: brightness(1.1);
}

/* === SUCCESS STATE === */
.w-success {
  text-align: center;
  padding: 30px 0;
  display: none;
}
.w-success.show { display: block; animation: w-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes w-pop {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}
.w-success-circle {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--w-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--w-accent-text);
  position: relative;
}
.w-success-circle svg {
  width: 32px;
  height: 32px;
  stroke: currentColor;
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 50;
  stroke-dashoffset: 50;
  animation: w-check 0.5s ease 0.2s forwards;
}
@keyframes w-check { to { stroke-dashoffset: 0; } }
.w-success-title {
  font-family: var(--w-font-script);
  font-size: 36px;
  color: var(--w-accent);
  margin-bottom: 4px;
  line-height: 1;
}
.w-success-msg {
  font-style: italic;
  font-size: 14px;
  opacity: 0.8;
}

/* === WISHES WALL === */
.w-wishes {
  margin-top: 50px;
}

.w-wish-form {
  background: var(--w-card-bg);
  border: 1px solid var(--w-border);
  padding: 24px;
  border-radius: 4px;
  margin-bottom: 28px;
}
.w-wish-form-title {
  font-family: var(--w-font-script);
  font-size: 28px;
  color: var(--w-accent);
  text-align: center;
  margin-bottom: 4px;
  line-height: 1;
}
.w-wish-form-sub {
  text-align: center;
  font-style: italic;
  font-size: 13px;
  opacity: 0.7;
  margin-bottom: 18px;
}

.w-photo-upload {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px dashed var(--w-border);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--w-font-display);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--w-accent);
  background: transparent;
  transition: border-color 0.2s, background 0.2s;
}
.w-photo-upload:hover {
  border-color: var(--w-accent);
  background: var(--w-card-bg);
}
.w-photo-upload svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.w-photo-upload input { display: none; }

.w-photo-preview {
  margin-top: 12px;
  position: relative;
  display: none;
  border-radius: 4px;
  overflow: hidden;
  max-width: 200px;
}
.w-photo-preview.show { display: block; animation: w-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.w-photo-preview img { display: block; width: 100%; height: auto; }
.w-photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.w-wishes-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.w-wish-empty {
  text-align: center;
  font-style: italic;
  opacity: 0.6;
  padding: 30px 20px;
  font-size: 14px;
}
.w-wish-item {
  background: var(--w-card-bg);
  border: 1px solid var(--w-border);
  border-radius: 4px;
  padding: 18px;
  position: relative;
  animation: w-slide-in 0.5s ease-out;
}
@keyframes w-slide-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.w-wish-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.w-wish-name {
  font-family: var(--w-font-script);
  font-size: 24px;
  color: var(--w-accent);
  line-height: 1;
}
.w-wish-time {
  font-family: var(--w-font-display);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.5;
}
.w-wish-message {
  font-style: italic;
  font-size: 15px;
  line-height: 1.55;
  color: var(--w-text);
}
.w-wish-photo {
  margin-top: 12px;
  border-radius: 4px;
  overflow: hidden;
  max-width: 280px;
}
.w-wish-photo img { display: block; width: 100%; height: auto; }

/* === BACKGROUND MUSIC BUTTON === */
.w-music-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 220;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--w-card-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--w-accent);
  color: var(--w-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s, background 0.3s, color 0.3s, box-shadow 0.3s;
  -webkit-tap-highlight-color: transparent;
}
.w-music-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 24px var(--w-shadow);
}
.w-music-btn.on {
  background: var(--w-accent);
  color: var(--w-accent-text);
}
.w-music-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}
.w-music-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Pulse ring that shows when music is OFF — gentle hint */
.w-music-pulse {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--w-accent);
  opacity: 0.5;
  pointer-events: none;
  animation: w-music-pulse 2.6s ease-out infinite;
}
.w-music-btn.on .w-music-pulse {
  display: none;
}
@keyframes w-music-pulse {
  0%   { transform: scale(1);   opacity: 0.45; }
  70%  { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* === CURTAIN REVEAL =====================================================
   Velvet-style two-panel curtain covers the whole page on first load.
   Click the centered button (or the page) to slide the panels apart.
   Theme-aware via --w-accent / --w-accent-text. Activated by adding
   data-curtain="true" to #invite-widgets in the template HTML. */

.w-curtain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: stretch;
  pointer-events: auto;
}
.w-curtain.opening { pointer-events: none; }
.w-curtain.closed  { display: none; }

.w-curtain-half {
  flex: 1;
  position: relative;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.08), transparent 60%),
    linear-gradient(180deg, var(--w-accent), color-mix(in srgb, var(--w-accent) 65%, black));
  transition: transform 1.6s cubic-bezier(0.65, 0, 0.35, 1);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.4);
}
/* Velvet vertical pleats — alternating dark/light stripes */
.w-curtain-half::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0,
    rgba(0, 0, 0, 0.08) 6px,
    transparent 12px,
    rgba(255, 255, 255, 0.05) 18px,
    transparent 24px
  );
  pointer-events: none;
}
/* Soft inner edge highlight where the two halves meet */
.w-curtain-half.left::after,
.w-curtain-half.right::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 40px;
  pointer-events: none;
}
.w-curtain-half.left::after  { right: 0; background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.5)); }
.w-curtain-half.right::after { left: 0;  background: linear-gradient(-90deg, transparent, rgba(0, 0, 0, 0.5)); }

.w-curtain.opening .w-curtain-half.left  { transform: translateX(-101%); }
.w-curtain.opening .w-curtain-half.right { transform: translateX(101%); }

/* Center prompt + button overlay (separate so we can fade it independently) */
.w-curtain-center {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  pointer-events: none;
  text-align: center;
  padding: 30px;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.w-curtain.opening + .w-curtain-center {
  opacity: 0;
  transform: scale(0.92);
}

.w-curtain-eyebrow {
  font-family: var(--w-font-display);
  font-size: 12px;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--w-accent-text);
  opacity: 0.85;
}
.w-curtain-prompt {
  font-family: var(--w-font-script);
  font-size: clamp(48px, 9vw, 88px);
  color: var(--w-accent-text);
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  line-height: 1;
  animation: w-curtain-prompt-pulse 2.6s ease-in-out infinite;
}
@keyframes w-curtain-prompt-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}

.w-curtain-btn {
  pointer-events: auto;
  padding: 14px 36px;
  background: var(--w-accent-text);
  color: var(--w-accent);
  border: 1px solid var(--w-accent-text);
  font-family: var(--w-font-display);
  font-size: 11px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.3s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.w-curtain-btn:hover {
  transform: translateY(-2px);
  letter-spacing: 0.45em;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

/* Decorative tassel hanging from top center */
.w-curtain-tassel {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  width: 4px;
  height: 80px;
  background: linear-gradient(180deg, var(--w-accent-text), transparent);
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.w-curtain-tassel::after {
  content: '';
  position: absolute;
  top: 70px;
  left: 50%;
  width: 16px;
  height: 22px;
  background: var(--w-accent-text);
  border-radius: 50% 50% 30% 30%;
  transform: translateX(-50%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.w-curtain.opening ~ .w-curtain-tassel { opacity: 0; }

/* === COPIED TOAST === */
.w-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--w-text);
  color: var(--w-bg);
  padding: 12px 22px;
  border-radius: 4px;
  font-family: var(--w-font-display);
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 250;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.w-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
