/* ===================================================================
   SAVE THE DATE WEBSITE STYLES
   Critical CSS optimized for performance and accessibility
   ================================================================= */

/* CSS CUSTOM PROPERTIES (VARIABLES)
   ================================================================= */
:root {
  /* Color palette */
  --emerald-dark: #03281c;
  --emerald-mid: #0c3f2b;
  --cream: #f5f1eb;
  --text-dark: #0c2c1d;
  --text-muted: rgba(12, 44, 29, 0.72);
  --accent: #ffe3a2;
  
  /* Layout and effects */
  --transition-fast: 0.2s ease;
  --transition: 0.35s ease;
  --transition-slow: 0.45s ease;
  --card-radius: clamp(20px, 4vw, 36px);
  --card-border: rgba(12, 44, 29, 0.14);
  --countdown-font: 'Cinzel Decorative', serif;
  
  /* Performance optimizations */
  --gpu-acceleration: translateZ(0);
}

/* FOCUS MANAGEMENT & ACCESSIBILITY
   ================================================================= */
*:focus {
  outline: none;
}

*:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* High contrast focus for interactive elements */
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 1px var(--text-dark);
}

/* Ensure sufficient color contrast */
@media (prefers-contrast: high) {
  :root {
    --text-muted: var(--text-dark);
    --card-border: rgba(12, 44, 29, 0.3);
  }
}

/* GLOBAL RESET & BASE STYLES
   ================================================================= */
* {
  box-sizing: border-box;
}

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

.skip-link {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--accent);
  color: var(--text-dark);
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
  z-index: 1000;
  transform: translateY(-180%);
  transition: transform 0.3s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
}

.noscript-note {
  margin: clamp(16px, 5vw, 32px) auto;
  max-width: min(480px, 90vw);
  padding: clamp(12px, 4vw, 18px) clamp(16px, 6vw, 24px);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-dark);
  font-size: clamp(0.85rem, 2.2vw, 1rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

html, body {
  height: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  font-family: 'Spectral', serif;
  background: var(--emerald-dark);
  color: var(--text-dark);
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
}

main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  width: 100%;
}

main > .page-border {
  flex: 1 1 auto;
}

/* MAIN LAYOUT GRID
   ================================================================= */
.page-border {
  display: grid;
  grid-template-columns: minmax(120px, 18vw) minmax(200px, 1fr) minmax(200px, 1fr) minmax(120px, 18vw);
  grid-template-rows: minmax(120px, 18vh) minmax(160px, 32vh) minmax(160px, 32vh) minmax(120px, 18vh);
  grid-template-areas:
    'top-left-wide top-left-wide top-center top-right'
    'middle-left-tall main main right-tall'
    'middle-left-tall main main right-tall'
    'bottom-left bottom-wide bottom-wide bottom-right';
  gap: 0;
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  overflow: hidden;
  padding: 0;
}

/* BORDER CELL PHOTO GALLERY
   ================================================================= */

/* Base border cell styles - optimized for performance */
.border-cell {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  z-index: 1;
  opacity: 0;
  transform: translate3d(0, 24px, 0) scale(0.94);
  transition: opacity 0.9s ease, transform 0.9s ease;
  will-change: opacity, transform;
}

/* Overlay effect for photos */
.border-cell.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  will-change: auto;
}

/* Image styling and hover effects - GPU accelerated */
.border-cell::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 45%, rgba(2, 24, 16, 0.45));
  mix-blend-mode: multiply;
  pointer-events: none;
}

.border-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  transform: scale3d(1.05, 1.05, 1);
  transition: transform var(--transition), filter var(--transition);
  filter: saturate(0.75) contrast(1.05);
  will-change: auto;
  /* Prevent layout shift during loading */
  aspect-ratio: 4 / 3;
}

/* Apply will-change only during interaction */
.border-cell:hover img,
.border-cell:focus img,
.border-cell:active img {
  will-change: transform, filter;
}
/* Specific aspect ratios for tall cells */
.border-cell.middle-left-tall img,
.border-cell.right-tall img {
  aspect-ratio: 2 / 3;
}

/* Wide cells */
.border-cell.top-left-wide img,
.border-cell.bottom-wide img {
  aspect-ratio: 16 / 9;
}



.border-cell:hover img {
  transform: scale(1.12);
  filter: saturate(1) contrast(1.1);
}

/* Grid area assignments */
.border-cell.top-left-wide {
  grid-area: top-left-wide;
}

.border-cell.top-center {
  grid-area: top-center;
}

.border-cell.top-right {
  grid-area: top-right;
}

.border-cell.middle-left-tall {
  grid-area: middle-left-tall;
}

.border-cell.right-tall {
  grid-area: right-tall;
}

.border-cell.bottom-left {
  grid-area: bottom-left;
}

.border-cell.bottom-wide {
  grid-area: bottom-wide;
}

.border-cell.bottom-right {
  grid-area: bottom-right;
}

@media (prefers-reduced-motion: reduce) {
  .border-cell {
    transition: none;
    opacity: 1;
    transform: none;
  }

  .mobile-frame {
    transition: none;
    opacity: 1;
    transform: none;
  }
  
  /* Reduce all animations for motion sensitivity */
  .countdown-number {
    transition: none;
  }
  
  .save-date-action {
    transition: none;
  }
  
  .save-date-action:hover,
  .save-date-action:focus-visible {
    transform: none;
  }
  
  .save-date-title--spiral {
    animation: none;
    opacity: 1;
    transform: none;
    filter: none;
  }
  
  /* Confetti falls instantly for reduced motion */
  .confetti-piece {
    animation-duration: 0.1s;
  }
}

.card-shell {
  position: relative;
  grid-area: main;
  align-self: center;
  justify-self: center;
  width: min(560px, 100%);
  min-height: clamp(320px, 58vw, 520px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.card-shell > * {
  width: 100%;
}

.mobile-experience {
  display: none;
  width: 100%;
  min-height: 100dvh;
  height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 8vw, 40px);
  background: var(--emerald-dark);
}

.mobile-stage {
  width: 100%;
  max-width: 560px;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-inline: auto;
  position: relative;
}

.mobile-frame {
  width: 100%;
  border-radius: clamp(20px, 6vw, 30px);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.82);
  box-shadow: 0 24px 52px rgba(0, 0, 0, 0.38);
  opacity: 0;
  transform: translate3d(0, 16px, 0) scale(0.98);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  height: 100dvh;
  will-change: opacity, transform;
}

.mobile-frame.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  will-change: auto;
}

.mobile-frame > * {
  flex: 1 1 auto;
  min-height: 0;
}

.mobile-frame--photo {
  aspect-ratio: 3 / 4;
}

.mobile-frame--photo img {
  width: 100vw;
  height: 100dvh;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.mobile-frame--photo-final {
  position: relative;
}

.mobile-frame__image--final {
  animation: mobileFinalPhotoZoom 4.56s cubic-bezier(0.18, 0, 0.12, 1) forwards;
  transform-origin: center center;
  will-change: transform;
}

@keyframes mobileFinalPhotoZoom {
  0% {
    transform: scale(0.7);
  }
  42% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.45);
  }
}



.mobile-frame--video {
  aspect-ratio: 9 / 16;
  background: #000;
  display: flex;
  align-items: stretch;
}

.mobile-frame--video .countdown-wrapper {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  align-items: stretch;
  gap: 0;
}

.mobile-frame--video .video-hashtag {
  display: none;
}

.mobile-frame--video .countdown-video-frame {
  border-radius: 0;
  border: none;
  box-shadow: none;
  height: 100%;
}

.mobile-frame--video .countdown-video:not(.countdown-video--embedded) {
  width: 100vw;
  height: 100dvh;
  object-fit: cover;
  object-position: center center; /* Center for videos */
  display: block;
}

.mobile-frame--video .countdown-video.countdown-video--embedded {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mobile-frame--video .countdown-video-frame.countdown-video-frame--embedded {
  height: auto;
}

.mobile-frame--video.mobile-frame--video-slow-reveal {
  transition: opacity 1.2s ease, transform 1.2s ease;
}

.mobile-frame--card {
  background: transparent;
  box-shadow: none;
}

.mobile-frame--card .countdown-wrapper {
  height: 100%;
  justify-content: center;
}

.countdown-wrapper {
  background: rgba(255, 255, 255, 0.94);
  border-radius: var(--card-radius);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.2);
  border: 1.5px solid var(--card-border);
  padding: clamp(28px, 5vw, 48px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: clamp(18px, 4vw, 30px);
  width: 100%;
  height: 100%;
  min-height: 0;
}

.countdown-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--emerald-dark);
  color: var(--cream);
  z-index: 5;
  font-family: var(--countdown-font);
  font-size: clamp(2.6rem, 9vw, 6rem);
  letter-spacing: 0.2em;
  transition: opacity 0.6s ease;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
}

.countdown-overlay.start-prompt {
  cursor: pointer;
}

.countdown-overlay:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 6px;
}

.countdown-overlay-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: clamp(48px, 14vh, 160px) clamp(24px, 12vw, 80px);
  gap: clamp(28px, 7vh, 52px);
  pointer-events: auto;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.countdown-overlay-line {
  display: block;
  width: 100%;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}

.countdown-overlay-line--top,
.countdown-overlay-line--bottom {
  align-self: center;
}

.countdown-overlay-button {
  font-family: 'Spectral', serif;
  font-size: clamp(0.8rem, 2.4vw, 1rem);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  padding: clamp(10px, 1.8vw, 14px) clamp(22px, 4vw, 32px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--cream);
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease,
    border-color 0.25s ease, box-shadow 0.25s ease;
  pointer-events: auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

.countdown-overlay-button:hover,
.countdown-overlay-button:focus-visible {
  background: var(--cream);
  color: var(--emerald-dark);
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.32);
}

.countdown-overlay-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.countdown-overlay-skip {
  font-family: 'Spectral', serif;
  font-size: clamp(0.65rem, 1.8vw, 0.85rem);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding: clamp(6px, 1.4vw, 10px) clamp(18px, 4vw, 26px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease,
    border-color 0.25s ease, box-shadow 0.25s ease;
  margin-top: auto;
  align-self: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

.countdown-overlay-skip:hover,
.countdown-overlay-skip:focus-visible {
  background: rgba(255, 255, 255, 0.92);
  color: var(--emerald-dark);
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28);
}

.countdown-overlay-skip:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.countdown-overlay-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: 'Spectral', serif;
  font-size: clamp(0.75rem, 2.2vw, 1rem);
  letter-spacing: 0.04em;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  margin: 0;
}

.countdown-overlay-hint [aria-hidden] {
  font-size: 1.2em;
  line-height: 1;
}

.countdown-overlay-content.is-clearing {
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
}

.countdown-overlay.is-counting {
  background: transparent;
  pointer-events: none;
}

.countdown-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.countdown-wrapper.has-video {
  gap: clamp(10px, 2.6vw, 18px);
  padding: clamp(16px, 3.6vw, 30px);
  justify-content: center;
  align-items: stretch;
  position: relative;
}

.countdown-wrapper.has-details {
  background: rgba(255, 255, 255, 0.96);
  border: 1.5px solid rgba(12, 44, 29, 0.12);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  padding: clamp(26px, 4.4vw, 42px);
  gap: clamp(12px, 3vw, 20px);
  align-items: flex-start;
  text-align: left;
  position: relative;
}

.save-date-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.4vw, 16px);
  width: 100%;
  flex-wrap: wrap;
}

.save-date-calendar {
  position: relative;
  display: inline-flex;
}

.save-date-calendar-details {
  position: relative;
  display: inline-flex;
}

.save-date-calendar-summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(38px, 4vw, 44px);
  height: clamp(38px, 4vw, 44px);
  border-radius: 50%;
  background: rgba(12, 63, 43, 0.12);
  color: var(--emerald-mid);
  border: 1px solid rgba(12, 44, 29, 0.18);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition), color var(--transition);
  user-select: none;
  position: relative;
  padding: 0;
}

.save-date-calendar-summary::-webkit-details-marker {
  display: none;
}

.save-date-calendar-details[open] .save-date-calendar-summary {
  background: rgba(12, 63, 43, 0.2);
  color: var(--emerald-dark);
}

.save-date-calendar-summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.save-date-calendar-summary::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translate3d(-50%, -8px, 0);
  background: rgba(12, 44, 29, 0.92);
  color: var(--cream);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: clamp(0.6rem, 1.4vw, 0.75rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
  transition: opacity var(--transition), transform var(--transition);
  z-index: 15;
}

.save-date-calendar-summary:hover::after,
.save-date-calendar-details:hover .save-date-calendar-summary::after,
.save-date-calendar-details:focus-within .save-date-calendar-summary::after,
.save-date-calendar-details[open] .save-date-calendar-summary::after {
  opacity: 1;
  transform: translate3d(-50%, 0, 0);
}

.save-date-calendar-icon {
  display: inline-flex;
  width: clamp(18px, 2.4vw, 22px);
  height: clamp(18px, 2.4vw, 22px);
}

.save-date-calendar-icon svg {
  width: 100%;
  height: 100%;
}

.save-date-calendar-menu {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  transform: translate3d(-50%, -8px, 0);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(12, 44, 29, 0.18);
  min-width: clamp(220px, 32vw, 240px);
  max-width: 90vw;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}

.save-date-calendar-details:hover .save-date-calendar-menu,
.save-date-calendar-details:focus-within .save-date-calendar-menu,
.save-date-calendar-details[open] .save-date-calendar-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(-50%, 0, 0);
}

.save-date-calendar-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 0.55em 0.85em 0.45em;
  border-radius: 12px;
  font-weight: 600;
  color: var(--emerald-mid);
  text-decoration: none;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  white-space: nowrap;
  min-height: 44px;
  /* Enhanced mobile behavior */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.save-date-calendar-link:hover,
.save-date-calendar-link:focus-visible {
  background: rgba(12, 63, 43, 0.08);
  color: var(--emerald-dark);
  outline: none;
  transform: translateX(4px);
}

.save-date-calendar-link:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  transform: translateX(2px);
}

@media (max-width: 820px) {
  .save-date-calendar {
    position: static;
    width: 100%;
    justify-content: center;
  }

  .save-date-calendar-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .save-date-calendar-summary {
    margin-bottom: 8px;
  }

  .save-date-calendar-menu {
    position: static;
    width: min(100%, 360px);
    max-width: min(100%, 360px);
    margin-top: 14px;
    margin-inline: auto;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
  }

  .save-date-calendar-summary::after {
    display: none;
  }

  .save-date-header {
    flex-direction: column;
    align-items: center;
    gap: clamp(16px, 4vw, 20px);
  }
}

.countdown-number {
  font-family: var(--countdown-font);
  font-size: clamp(3rem, 10vw, 6rem);
  letter-spacing: 0.12em;
  color: var(--text-dark);
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.countdown-number.is-transitioning {
  opacity: 0.6;
  transform: scale(0.9);
}

.countdown-note {
  margin: 0;
  line-height: 1.6;
  font-size: clamp(1rem, 2.2vw, 1.3rem);
  color: var(--text-muted);
}

.countdown-video-frame {
  width: 100%;
  border-radius: clamp(16px, 3vw, 28px);
  overflow: hidden;
  background: #000;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.2);
  border: 1.5px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 0;
}

.countdown-video-frame.countdown-video-frame--embedded {
  position: relative;
  display: block;
  padding-top: 56.25%;
}

.countdown-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center; /* Center for videos */
  display: block;
}

.countdown-video-frame.countdown-video-frame--embedded > .countdown-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.celebration-video-details {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.6vw, 14px);
  margin: clamp(12px, 2.4vw, 20px) 0 0;
}

.celebration-video-detail {
  color: var(--emerald-mid);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 640px) {
  .celebration-video-detail {
    color: #fff;
  }
}

.video-hashtag {
  font-size: clamp(0.8rem, 1.8vw, 1rem);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(12, 44, 29, 0.72);
  margin: 0;
}

.save-date-title {
  font-family: var(--countdown-font);
  font-size: clamp(1.72rem, 5.6vw, 2.88rem);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-dark);
  margin: 0;
  text-align: center;
  text-wrap: balance;
}

.save-date-title--spiral {
  animation: spiralSpinIn 1.1s ease-out forwards;
}

@keyframes spiralSpinIn {
  0% {
    opacity: 0;
    transform: scale(0.2) rotate(-540deg);
    filter: blur(6px);
  }
  55% {
    opacity: 1;
    transform: scale(1.08) rotate(18deg);
    filter: blur(0);
  }
  75% {
    transform: scale(0.96) rotate(-8deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.save-date-title > span {
  display: block;
  margin: 0;
}

.save-date-title .save-date-name {
  letter-spacing: 0.18em;
}

.save-date-title .save-date-amp {
  font-size: clamp(2rem, 6.4vw, 3.2rem);
  letter-spacing: 0.38em;
  margin-block: clamp(4px, 1vw, 10px);
}

.save-date-date {
  margin: 0;
  font-size: clamp(0.9rem, 2vw, 1.12rem);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(12, 44, 29, 0.82);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 1vw, 8px);
  align-self: center;
}

.save-date-date > span {
  display: block;
}

.save-date-date-location {
  font-size: clamp(0.82rem, 1.9vw, 0.96rem);
  letter-spacing: 0.16em;
}

.save-date-note {
  font-size: clamp(0.88rem, 1.9vw, 1.04rem);
  text-align: center;
  align-self: center;
}

.save-date-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(10px, 2.4vw, 16px);
  width: min(100%, 640px);
  margin-inline: auto;
}

.save-date-action-icons {
  display: flex;
  justify-content: center;
  gap: clamp(12px, 3.6vw, 18px);
  align-items: center;
  width: min(100%, 320px);
  margin-inline: auto;
  align-self: center;
}

.save-date-action--full {
  width: min(100%, 440px);
  min-width: 0;
  margin-inline: auto;
}

.save-date-action {
  font: inherit;
  font-size: clamp(0.82rem, 2vw, 0.96rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1.5px solid rgba(12, 44, 29, 0.24);
  background: rgba(12, 63, 43, 0.08);
  color: var(--text-dark);
  padding: clamp(9px, 2.4vw, 12px) clamp(16px, 5.2vw, 24px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(9px, 2.6vw, 12px);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease,
    border-color 0.25s ease;
  text-decoration: none;
  min-width: clamp(200px, 58%, 260px);
  min-height: 44px; /* Enhanced touch target for accessibility */
  /* Improved mobile touch behavior */
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation; /* Prevents zoom on double-tap */
}

.save-date-action--icon-only {
  position: relative;
  min-width: 0;
  width: clamp(54px, 14vw, 66px);
  height: clamp(54px, 14vw, 66px);
  padding: clamp(10px, 2.6vw, 12px);
  border-radius: 50%;
  gap: 0;
  background: rgba(12, 63, 43, 0.12);
  min-height: 48px; /* Enhanced touch target for accessibility */
  border-color: rgba(12, 44, 29, 0.2);
}
.save-date-action--icon-only::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translate3d(-50%, -8px, 0);
  background: rgba(12, 44, 29, 0.94);
  color: var(--cream);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: clamp(0.6rem, 1.4vw, 0.75rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.22);
  transition: opacity var(--transition), transform var(--transition);
  z-index: 5;
}

.save-date-action--icon-only:hover::after,
.save-date-action--icon-only:focus-visible::after {
  opacity: 1;
  transform: translate3d(-50%, 0, 0);
}

.save-date-action:hover,
.save-date-action:focus-visible {
  background: rgba(12, 63, 43, 0.16);
  border-color: rgba(12, 44, 29, 0.38);
  box-shadow: 0 12px 26px rgba(3, 40, 28, 0.22);
  transform: translateY(-1px);
}

.save-date-action:active {
  transform: translateY(0);
  transition-duration: 0.1s;
}

.save-date-action:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

/* Loading state for buttons */
.save-date-action[aria-busy="true"] {
  pointer-events: none;
  opacity: 0.7;
  cursor: wait;
}

.save-date-action[aria-busy="true"]::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--text-muted);
  border-top-color: var(--emerald-dark);
  border-radius: 50%;
  animation: button-loading 1s linear infinite;
}

@keyframes button-loading {
  to { transform: rotate(360deg); }
}

.save-date-action__icon {
  width: clamp(34px, 5.6vw, 42px);
  height: clamp(34px, 5.6vw, 42px);
  border-radius: 50%;
  background: var(--emerald-mid);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 10px 20px rgba(3, 40, 28, 0.28);
}

.save-date-action--icon-only .save-date-action__icon {
  width: 100%;
  height: 100%;
  background: transparent;
  color: var(--emerald-mid);
  box-shadow: none;
}

.save-date-action__icon-graphic {
  width: clamp(16px, 3.2vw, 18px);
  height: clamp(16px, 3.2vw, 18px);
}

.save-date-action--icon-only .save-date-action__icon-graphic {
  width: clamp(34px, 7.8vw, 44px);
  height: clamp(34px, 7.8vw, 44px);
}

.save-date-action__label {
  white-space: normal;
  text-align: left;
  text-wrap: balance;
}

.save-date-action--secondary {
  background: rgba(255, 227, 162, 0.24);
  border-color: rgba(12, 44, 29, 0.22);
}

.save-date-action--secondary:hover,
.save-date-action--secondary:focus-visible {
  background: rgba(255, 227, 162, 0.36);
  border-color: rgba(12, 44, 29, 0.32);
}

.save-date-action--ghost {
  background: transparent;
  border-color: rgba(12, 44, 29, 0.16);
  box-shadow: none;
}

.save-date-action--ghost .save-date-action__icon {
  background: rgba(12, 63, 43, 0.12);
  color: var(--emerald-mid);
  box-shadow: none;
}

.save-date-action--ghost:hover,
.save-date-action--ghost:focus-visible {
  background: rgba(12, 63, 43, 0.08);
  border-color: rgba(12, 44, 29, 0.26);
  box-shadow: none;
}

.save-date-back-button {
  align-self: center;
}

@media (min-width: 560px) {
  .save-date-actions {
    align-items: center;
    gap: clamp(12px, 2.2vw, 18px);
  }

  .save-date-action--full {
    width: min(100%, 500px);
  }

  .save-date-action-icons {
    width: min(100%, 360px);
    gap: clamp(14px, 2.6vw, 20px);
  }
}

.sneak-peek-wrapper {
  align-items: center;
  gap: clamp(12px, 3vw, 22px);
}

.sneak-peek-hashtag {
  letter-spacing: 0.36em;
}

.countdown-video-frame.sneak-peek-frame {
  position: relative;
  padding-top: 56.25%;
  display: block;
}

.sneak-peek-embed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.sneak-peek-caption {
  max-width: 32ch;
  margin-inline: auto;
}

.sneak-peek-wrapper .save-date-back-button {
  margin-top: clamp(4px, 1.6vw, 12px);
  color: var(--emerald-dark);
  border-color: var(--emerald-mid);
  background: rgba(245, 241, 235, 0.08);
}

.sneak-peek-wrapper .save-date-back-button .save-date-action__icon {
  background: rgba(245, 241, 235, 0.2);
  color: var(--emerald-dark);
}

.sneak-peek-wrapper .save-date-back-button:hover,
.sneak-peek-wrapper .save-date-back-button:focus-visible {
  background: rgba(245, 241, 235, 0.18);
  border-color: var(--emerald-dark);
  box-shadow: 0 12px 26px rgba(3, 40, 28, 0.32);
}

.confetti-container {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 8;
}

.confetti-piece {
  position: absolute;
  width: clamp(8px, 1.2vw, 12px);
  height: clamp(14px, 3vh, 18px);
  border-radius: 2px;
  top: -12vh;
  left: var(--confetti-left, 50%);
  transform: translate3d(calc(-50% + var(--confetti-drift, 0px)), 0, 0) rotate(0deg);
  opacity: 0;
  animation: confettiFall var(--confetti-duration, 3s) linear forwards;
  animation-delay: var(--confetti-delay, 0s);
  mix-blend-mode: screen;
}

@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translate3d(calc(-50% + var(--confetti-drift, 0px)), -12vh, 0) rotate(0deg);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(calc(-50% + var(--confetti-drift, 0px)), 110vh, 0) rotate(540deg);
  }
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: clamp(0.7rem, 1.4vw, 0.9rem);
  font-family: var(--countdown-font);
  color: var(--emerald-mid);
  margin-bottom: clamp(10px, 1.4vw, 16px);
}

h1 {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  letter-spacing: 0.06em;
  margin: 0 0 clamp(12px, 2vw, 20px);
  color: var(--text-dark);
}

@media (max-width: 960px) {
  .page-border {
    grid-template-columns: minmax(90px, 22vw) 1fr minmax(90px, 22vw);
    grid-template-rows: minmax(90px, 25vh) minmax(0, 50vh) minmax(90px, 25vh);
  }
}

@media (max-width: 720px) {
  body {
    align-items: flex-start;
  }

  .page-border {
    grid-template-columns: minmax(70px, 25vw) 1fr minmax(70px, 25vw);
    grid-template-rows: minmax(70px, 30vh) minmax(0, 40vh) minmax(70px, 30vh);
  }

}

@media (max-width: 640px), (max-height: 520px) {
  body {
    display: block;
    overflow-y: auto;
    /* Improve mobile font rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  .page-border {
    display: none;
  }

  .mobile-experience {
    display: flex;
    width: 100vw;
    min-height: 100dvh;
    height: 100dvh;
    padding: 0;
    align-items: stretch;
  }

  .mobile-stage {
    max-width: none;
    height: 100dvh;
    min-height: 100dvh;
    flex: 1 1 auto;
    align-items: stretch;
    justify-content: stretch;
    margin: 0;
  }
  
  /* Enhanced mobile button interactions */
  .countdown-overlay-button {
    min-height: 48px;
    min-width: 120px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Better mobile navigation */
  .skip-link {
    position: fixed;
    z-index: 1001;
  }
  
  /* Optimize mobile calendar interactions */
  .save-date-action {
    min-height: 48px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-frame {
    border-radius: 0;
    height: 100dvh;
    min-height: 100dvh;
    width: 100vw;
    box-shadow: none;
  }

  .mobile-frame--photo,
  .mobile-frame--video,
  .mobile-frame--card {
    aspect-ratio: auto;
  }

  .mobile-frame--video .countdown-video-frame {
    border-radius: 0;
  }

  .mobile-frame--card .countdown-wrapper {
    padding: clamp(28px, 12vw, 48px);
    border-radius: 0;
    box-shadow: none;
    border: none;
  }

  .mobile-frame--video .sneak-peek-wrapper .countdown-note {
    color: #ffffff;
  }

  .mobile-frame--video .sneak-peek-wrapper .save-date-back-button {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.7);
  }

  .mobile-frame--video .sneak-peek-wrapper .save-date-back-button .save-date-action__icon {
    background: rgba(255, 255, 255, 0.22);
    color: var(--emerald-dark);
  }

  /* Disable hover behaviors for action icons on mobile */
  /* Make action icon tooltips always visible on mobile for better UX */
  .save-date-action--icon-only::after {
    display: none; /* Hide tooltips on mobile - they're not needed */
  }

  .save-date-calendar-summary::after {
    display: none; /* Hide calendar tooltips on mobile - they're not needed */
  }

  /* Improve action icons layout on mobile */
  .save-date-action-icons {
    gap: clamp(16px, 4vw, 24px);
  }

  .save-date-action--icon-only {
    width: clamp(60px, 16vw, 80px);
    height: clamp(60px, 16vw, 80px);
    padding: clamp(12px, 3vw, 16px);
  }

  /* Override calendar positioning to prevent off-screen issues */
  .save-date-calendar {
    position: static;
    width: 100%;
    justify-content: center;
  }

  .save-date-calendar-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    position: relative;
  }

  /* Improved mobile calendar positioning and backdrop */
  .save-date-calendar-menu {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(calc(100vw - 32px), 320px);
    max-width: calc(100vw - 32px);
    margin: 0;
    opacity: 1;
    pointer-events: auto;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    border-radius: 16px;
    padding: 20px;
    z-index: 1000;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(12, 44, 29, 0.15);
  }

  /* Handle closed state for mobile with smooth transitions */
  .save-date-calendar-details:not([open]) .save-date-calendar-menu {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  /* Improved backdrop for better mobile UX and accessibility */
  .save-date-calendar-details[open]::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    backdrop-filter: blur(2px);
    animation: backdrop-fade-in 0.2s ease;
  }

  @keyframes backdrop-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  /* Improved calendar links for mobile touch targets */
  .save-date-calendar-link {
    min-height: 48px;
    padding: 0.75em 1em;
    font-size: 1rem;
    border-radius: 12px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
  }

  .save-date-calendar-link:last-child {
    margin-bottom: 0;
  }

  .save-date-calendar-link:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
  }
}

@media (max-width: 520px) {
  .countdown-overlay-line {
    font-size: clamp(2.2rem, 12vw, 4.4rem);
  }
}
