/* =====================================================================
   Shared pieces every invite template gets: scroll hint, photo viewer,
   and the cancel-an-RSVP modal. Colors and fonts come from the
   template's --color-* / --font-* variables, with neutral fallbacks.
   Templates style .form-input, .form-label, .btn-primary, .btn-secondary
   and .form-message, which the modal reuses.
   ===================================================================== */

[hidden] { display: none !important; }

.modal .btn-secondary { margin-top: 12px; }

/* ===================== CANCEL-AN-RSVP MODAL ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--color-surface, #fdfaf7);
  padding: 32px 28px;
  width: min(400px, 100%);
  border: 1px solid color-mix(in srgb, var(--color-accent, #c9b99a) 50%, white);
  border-radius: 2px;
}

.modal h3 {
  font-family: var(--font-serif, Georgia, serif);
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 8px;
}

.modal p {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 13px;
  color: #888;
  margin-bottom: 24px;
  line-height: 1.6;
}

.modal-close {
  background: none;
  border: none;
  position: absolute;
  top: 16px;
  right: 16px;
  cursor: pointer;
  color: #888;
  font-size: 20px;
}

/* ===================== SCROLL HINT ===================== */
/* Lives outside the template markup: a transformed ancestor would break position: fixed */
.scroll-hint {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  z-index: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 18px 8px;
  background: rgba(26,26,26,0.78);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(201,185,154,0.5);
  border-radius: 999px;
  color: #fdfaf7;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 9px;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.scroll-hint.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.scroll-hint svg {
  width: 14px;
  height: 14px;
  color: var(--color-accent, #c9b99a);
  animation: scroll-bounce 1.6s ease-in-out infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .scroll-hint svg { animation: none; }
}

/* ===================== PHOTO VIEWER ===================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 950;
  background: #0a0a0a;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 16px 96px;
  touch-action: pan-y;
}

.lightbox.open { display: flex; }

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: none;
  border: none;
  color: #fdfaf7;
  cursor: pointer;
  padding: 12px;
  line-height: 1;
}

.lightbox-close { top: 8px; right: 8px; font-size: 28px; }

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 36px;
  opacity: 0.7;
}

.lightbox-nav:hover { opacity: 1; }
.lightbox-prev { left: 4px; }
.lightbox-next { right: 4px; }

.lightbox-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(20px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
}

.lightbox-credit {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #bbb;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-save {
  flex-shrink: 0;
  background: var(--color-surface, #fdfaf7);
  color: #1a1a1a;
  border: none;
  padding: 12px 22px;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 500;
  cursor: pointer;
  border-radius: 2px;
}

.lightbox-save:disabled { opacity: 0.6; cursor: default; }

/* ===================== PREVIEW BANNER ===================== */
/* Shown on drafts opened with a preview link from the admin page */
.preview-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100; /* above the envelope intro */
  padding: 8px 16px;
  background: #fbf3e2;
  border-bottom: 1px solid #e2c48a;
  color: #8a6420;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 11px;
  letter-spacing: 0.5px;
  text-align: center;
}

/* ===================== MAJOR BADGES ===================== */
/* Filled into any [data-majors] slot. "bold" = big badge ("Future RN"),
   "subtle" = small icon + "Nursing · Class of 2027". Templates can restyle. */
[data-majors] {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

[data-majors]:empty { display: none; }

.major-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans, system-ui, sans-serif);
  color: var(--color-text, #1a1a1a);
}

.major-badge svg {
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.major-badge--subtle {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.75;
}

.major-badge--subtle svg { width: 15px; height: 15px; color: var(--color-accent, #c9b99a); }

.major-badge--bold {
  padding: 9px 16px 9px 12px;
  border-radius: 999px;
  background: var(--color-primary, #1a1a1a);
  color: var(--color-surface, #fff);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.major-badge--bold svg { width: 20px; height: 20px; color: var(--color-accent, #c9b99a); }

/* Homepage sample invites (events.is_demo): same spot, links to the inquiry form */
.demo-banner {
  display: block;
  background: #1a1a1a;
  border-bottom-color: #c9b99a;
  color: #fdfaf7;
  text-decoration: none;
  font-weight: 500;
}

/* ===================== ENVELOPE INTRO ===================== */
/* Shared by every design (markup is in api/_lib/invite-shell.js; the
   animation is in shared/invite.js). Guests tap the envelope to open the
   invite. Each design sets the --env-* variables in its template.css; these
   defaults are the Classic look. */
#envelope-scene {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--env-backdrop, #1a1a1a);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease;
}

#envelope-scene.fade-out { opacity: 0; pointer-events: none; }

.envelope-wrapper { position: relative; width: min(340px, 88vw); cursor: pointer; perspective: 1000px; }

.tap-hint {
  position: absolute;
  bottom: -48px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--env-hint, #c9b99a);
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  white-space: nowrap;
  animation: env-pulse 2s ease-in-out infinite;
}

@keyframes env-pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

.envelope {
  position: relative;
  width: 100%;
  padding-top: 66%;
  background: var(--env-paper, #f5f0eb);
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--env-line, rgba(201, 185, 154, 0.3)), 0 32px 80px rgba(0, 0, 0, 0.45), 0 8px 24px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

/* Paper texture lines */
.envelope::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent, transparent 28px, rgba(0, 0, 0, 0.025) 28px, rgba(0, 0, 0, 0.025) 29px);
  pointer-events: none;
}

.envelope svg { width: 100%; height: 100%; display: block; }
.env-bottom-fill { fill: var(--env-bottom, #e8e1d7); }
.env-side-fill { fill: var(--env-side, #ede6db); }
.env-fold { stroke: var(--env-line, rgba(201, 185, 154, 0.3)); stroke-width: 1; }

.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 60%;
  transform-origin: top center;
  transform-style: preserve-3d;
  transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
}

.envelope-flap.open { transform: rotateX(-180deg); }
.envelope-bottom { position: absolute; bottom: 0; left: 0; width: 100%; height: 55%; }
.envelope-left, .envelope-right { position: absolute; top: 0; width: 52%; height: 60%; }
.envelope-left { left: 0; }
.envelope-right { right: 0; }

.wax-seal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  z-index: 15;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.wax-seal.hide { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }

.seal-circle {
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 35% 35%, var(--env-seal-light, #3a3a3a), var(--env-seal-dark, #1a1a1a));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  border: 1px solid var(--env-line, rgba(201, 185, 154, 0.3));
}

.seal-circle span {
  font-family: var(--env-seal-font, var(--font-serif, Georgia, serif));
  font-size: 20px;
  font-style: var(--env-seal-style, italic);
  font-weight: 400;
  color: var(--env-seal-text, #c9b99a);
}

.envelope-card {
  position: absolute;
  bottom: 8%;
  left: 5%;
  width: 90%;
  height: 85%;
  background: var(--env-card, #fdfaf7);
  border: 1px solid var(--env-card-border, #e0d5c5);
  display: flex;
  align-items: flex-end;   /* words sit below the wax seal, like an address */
  justify-content: center;
  padding-bottom: 4%;
  z-index: 5;
  transition: transform 1.6s cubic-bezier(0.16, 1, 0.3, 1);
  padding-left: 12px;
  padding-right: 12px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
}

.envelope-card.reveal { transform: translateY(-105%); }

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

/* The small top line stays off the envelope (it crowds the seal; the invite shows it) */
.card-mini-text .look {
  display: none;
  margin-bottom: 2px;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 7px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--env-lead, #888);
}

.card-mini-text .graduating {
  display: block;
  line-height: 1.05;
  font-family: var(--env-title-font, var(--font-script, var(--font-serif, Georgia, serif)));
  font-size: var(--env-title-size, 26px);
  font-weight: var(--env-title-weight, 400);
  text-transform: var(--env-title-transform, none);
  color: var(--env-title, #1a1a1a);
}

.card-mini-text .name {
  display: block;
  margin-top: 4px;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 8px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--env-name, #1a1a1a);
}

/* ===================== KEYBOARD FOCUS ===================== */
/* A clear ring on anything you can tab to (templates restyle inputs on focus) */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible,
input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--color-accent, #8a6420);
  outline-offset: 3px;
}

/* ===================== PRIVACY NOTES ON FORMS (shared/invite.js) ===================== */
.form-consent {
  font-size: 12px;
  line-height: 1.55;
  opacity: 0.85;
  margin: 4px 0 14px;
  text-align: left;
}
.form-consent a { color: inherit; text-decoration: underline; }
.form-consent-check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.form-consent-check input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  flex-shrink: 0;
  accent-color: var(--color-primary, #1a1a1a);
}

/* Policy links at the bottom of every invite */
.legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  padding: 18px 16px 28px;
  font-size: 11px;
  letter-spacing: 0.5px;
}
.legal-links a { color: inherit; opacity: 0.6; text-decoration: none; }
.legal-links a:hover { opacity: 1; text-decoration: underline; }

/* ===================== ADD TO CALENDAR (shared/invite.js) ===================== */
.add-cal-slot { margin: 16px 0 4px; text-align: center; }
.add-cal-slot--done { margin: 14px 0; }
.add-cal { position: relative; display: inline-block; text-align: left; }
.add-cal summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.add-cal summary::-webkit-details-marker { display: none; }
.add-cal summary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.add-cal-list {
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  z-index: 50;
  min-width: 190px;
  padding: 6px;
  background: #fff;
  color: #1a1a1a;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.add-cal-list a {
  display: block;
  padding: 11px 14px;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
}
.add-cal-list a:hover, .add-cal-list a:focus-visible { background: #f2eee8; }

/* ===================== PLUS-ONES + CAPACITY (shared/invite.js) ===================== */
.form-select { appearance: auto; -webkit-appearance: menulist; cursor: pointer; }
.guest-plus { opacity: 0.65; font-size: 0.85em; }
.rsvp-full-note { font-weight: 600; opacity: 1; }

/* Hidden spam trap on the RSVP form (shared/invite.js) */
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ===================== SECRET SANTA (shared/invite.js) ===================== */
.santa-join { margin: 6px 0 10px; }
.santa-wish { margin-top: 10px; }
.santa-wish textarea { resize: vertical; min-height: 64px; }
.santa-match {
  margin: 16px auto;
  padding: 16px 18px;
  max-width: 420px;
  border: 1px dashed currentColor;
  border-radius: 10px;
  text-align: center;
}
.santa-match-title { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; opacity: 0.75; }
.santa-match-name { font-size: 24px; font-weight: 600; margin: 4px 0; }
.santa-match-wish { font-size: 15px; opacity: 0.85; }
