/*********************************************************************************
 * GENERAL
 *********************************************************************************/
:root {
  --background-color: #f0f0f0;
  /* Color palette - elegant, warm, romantic */
  --color-envelope: #d4c4a8;
  --color-envelope-dark: #c4b498;
  --color-envelope-shadow: #b8a888;
  --color-envelope-flap: #e0d4be;

  --color-paper: #fffef9;
  --color-paper-shadow: rgba(0, 0, 0, 0.08);
  --color-text: #3d3833;
  --color-accent: #76440F;
  --color-accent-light: #d4b896;
  --color-seal: #ce0808;
  --color-seal-dark: #480909;

  /* Typography */
  --font-serif: 'Playfair Display', 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Playfair Display', 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Envelope dimensions */
  --envelope-width: min(700px, 85vw);
  --envelope-height: calc(var(--envelope-width) * 0.65);
  --flap-height: calc(var(--envelope-height) * 0.5);

  /* Paper dimensions */
  --paper-width: calc(var(--envelope-width) * 0.9);
  --paper-height: calc(var(--envelope-height) * 3.7);

  /* Back Layer - Envelope background*/
  --z-envelope-back: 1;
  --z-envelope-flap-opened: 2;
  /* Middle Layer - Paper*/
  --z-paper: 3;
  /* Front Layer - Envelope front*/
  --z-overlay: 4;
  --z-envelope-front: 5;
  --z-envelope-flap-closed: 6;
  --z-envelope-seal: 7;
  --z-scroll-hint: 8;

  --ease-smooth: ease;

}

html {
  overscroll-behavior: none;
}

body {
  margin: 0;
  overflow: auto;
  background-color: var(--background-color);
  position: relative;
  overscroll-behavior: none;
}

/*********************************************************************************
 * TEXTOS
 *********************************************************************************/

/* Título de sección */
.section-title {
  font-family: var(--font-sans);
  font-size: clamp(11px, 3.4vw, 14px);
  font-weight: 500;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: var(--color-accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
}

.section-title::before,
.section-title::after {
  content: "";
  display: block;
  height: 1px;
  width: 90%;
  background: var(--color-accent-light);
}

/* Texto destacado */
.important-text-paragraph {
  font-family: var(--font-sans);
  font-size: clamp(16px, 4.4vw, 18px);
  font-weight: 500;
  color: var(--color-text);
}

.standard-justified-paragraph {
  width: 90%;
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 8px;

  font-family: var(--font-sans);
  font-size: clamp(13px, 3.2vw, 14px);
  font-weight: 300;
  color: var(--color-text);

  text-align: justify;
  text-justify: inter-word;
}

/* Ajuste de separación específico para los textos de introducción */
.invitation-request {
  margin-top: 20px;
}


/*********************************************************************************
 * ENVELOPE
 *********************************************************************************/
#overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -500px;
  /* en vez de top: calc(100% - 5px) */
  height: 500px;
  background: var(--background-color);
  z-index: var(--z-overlay);
  pointer-events: none;
}



/* ============================================
   Envelope Assembly
   ============================================ */
.envelope {
  width: var(--envelope-width);
  height: var(--envelope-height);

  position: relative;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transform-style: preserve-3d;
}

/* Envelope back (behind paper) */
.envelope-back {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
      var(--color-envelope) 0%,
      var(--color-envelope-dark) 100%);
  border-radius: 4px;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 -1px 0 var(--color-envelope-shadow);
}

/* Envelope front (pocket that holds paper) */
#envelope-front-container,
#envelope-back-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#envelope-front-container {
  z-index: var(--z-envelope-front);
}

#envelope-back-container {
  z-index: var(--z-envelope-back);
}

.envelope-front {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70%;
  background: linear-gradient(180deg,
      var(--color-envelope-dark) 0%,
      var(--color-envelope) 30%,
      var(--color-envelope) 100%);
  border-radius: 0 0 4px 4px;
  clip-path: polygon(0% 25%,
      50% 0%,
      100% 25%,
      100% 100%,
      0% 100%);
  z-index: var(--z-envelope-front);
  box-shadow:
    0 -2px 4px rgba(0, 0, 0, 0.05),
    inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

/* Envelope flap (opens with 3D rotation) */
.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--flap-height);
  transform-origin: top center;
  transform-style: preserve-3d;
  z-index: var(--z-envelope-flap-closed);
  /* Initial state: closed (rotated down) */
  transform: rotateX(0deg);

  /* Avoid 3D "z-fighting" / wrong painter order when rotating back and forth */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Backside of the flap (visible when opened) */
.envelope-flap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg,
      var(--color-envelope-shadow) 0%,
      var(--color-envelope-dark) 100%);
  clip-path: polygon(0% 0%,
      100% 0%,
      50% 100%);
  transform: rotateX(0deg);
}

/* Decorative wax seal */
.envelope-seal {
  position: absolute !important;
  top: calc(var(--flap-height) - 70px) !important;
  left: 50% !important;

  /* Put the seal into its own composite layer to prevent "crossing" artifacts */
  transform: translate3d(-50%, 0, 8px);
  width: 30%;
  height: 46%;

  background-image: url('images/SelloLacra_v3.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;

  border-radius: 100%;
  z-index: var(--z-envelope-seal);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.2),
    inset 0 -2px 4px rgba(0, 0, 0, 0.1),
    inset 0 2px 4px rgba(255, 255, 255, 0.2);

  /* Keep a stable 3D context */
  transform-origin: center top;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform;
  pointer-events: none;
}

#envelope-flap-opened,
#envelope-flap-closed,
.envelope-seal {
  will-change: transform;
}



/*********************************************************************************
 * Scrolling area and Stage
 *********************************************************************************/
#scrolling-area {
  width: 60%;
  height: auto;
  padding-top: 120px;
  padding-bottom: 100px;
  position: relative;
  margin: 0 auto;
}

#stage-area {
  position: sticky;
  top: 0;
  height: 100vh;
}

/*********************************************************************************
 * LAYER 2 - Paper
 *********************************************************************************/
#paper {
  width: var(--paper-width);
  height: auto;
  position: relative;
  margin-top: 900px;
  margin-right: auto;
  margin-left: auto;
  margin-bottom: 0;
  opacity: 1;
  pointer-events: none;
  z-index: var(--z-paper);
}

.paper-inner {
  width: 100%;
  height: 100%;

  padding: 50px clamp(16px, 5vw, 48px);
  box-sizing: border-box;

  display: flex;
  /* Cambia la posicion en la que se ordenan los hijos */
  flex-direction: column;
  align-items: center;
  /*    overflow: hidden;*/

  background: var(--color-paper);
  box-shadow: 0 4px 16px var(--color-paper-shadow), 0 1px 3px var(--color-paper-shadow);
  transition: box-shadow 0.4s var(--ease-smooth);

  border-radius: 4px;
  text-align: center;

  /* Paper frame: dotted outer + thin solid inner */
  position: relative;
}

.paper-inner::before {
  content: "";
  position: absolute;
  inset: 6px;
  /* distance from paper edge */
  border: 2px dotted var(--color-accent-light);
  border-radius: 4px;
  pointer-events: none;
}

.paper-inner::after {
  content: "";
  position: absolute;
  inset: 11px;
  /* inside the dotted line */
  border: 2px solid rgba(184, 149, 110, 0.55);
  /* thin solid line */
  border-radius: 6px;
  pointer-events: none;
}

/* Only specific paragraphs: justified, centered, and aligned with the 80% title divider lines */
.paper-inner p.standard-justified-paragraph,
.paper-inner p.rsvp-request {
  width: 90%;
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;

  text-align: justify;
  text-justify: inter-word;
}

#header-couple-names {
  width: 75%;
}

a {
  text-decoration: none;
  /* Removes underline from the link */
  pointer-events: auto;

}

.date-button,
.place-button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;

  padding: 12px 20px;
  margin-top: 15px;
  margin-bottom: 20px;

  border: 2px solid var(--color-accent-light);
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);

  background: var(--color-paper);
  color: var(--color-text);
  cursor: pointer;

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.date-button:hover,
.place-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
  border-color: var(--color-accent);
  background: rgba(212, 184, 150, 0.08);
}

.date-button:active,
.place-button:active {
  transform: translateY(0);
}

.date-button:focus-visible,
.place-button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.date-button-icon {
  position: relative;
  width: 18px;
  height: 16px;
  flex: 0 0 18px;

  border: 2px solid var(--color-accent);
  border-radius: 4px;
  box-sizing: border-box;
}

/* barra superior del calendario */
.date-button-icon::before {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  top: -2px;
  height: 5px;

  background: var(--color-accent);
  border-radius: 4px 4px 0 0;
}

/* dos anillas superiores */
.date-button-icon::after {
  content: "";
  position: absolute;
  top: -5px;
  left: 3px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 7px 0 0 var(--color-accent);
}

.place-button-icon {
  position: relative;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.place-button-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 12px;
  height: 12px;
  border: 2px solid var(--color-accent);
  border-radius: 50% 50% 50% 0;
  transform: translateX(-50%) rotate(-45deg);
  box-sizing: border-box;
}

.place-button-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 4px;
  width: 4px;
  height: 4px;
  background: var(--color-accent);
  border-radius: 50%;
  transform: translateX(-50%);
}

/* ============================================
   Decorative Flourishes
   ============================================ */
.flourish {
  position: relative;
  width: 120px;
  height: 24px;
  opacity: 0.6;
}

/* Líneas laterales */
.flourish::before,
.flourish::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: linear-gradient(90deg,
      transparent,
      var(--color-accent),
      transparent);
}

.flourish::before {
  left: 0;
}

.flourish::after {
  right: 0;
}

/* Rombo central */
.flourish span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background: var(--color-accent);
  transform: translate(-50%, -50%) rotate(45deg);
}

/* Variantes de layout */
.top-flourish {
  margin-bottom: 20px;
}

.bottom-flourish {
  margin-top: auto;
  padding-top: 20px;
}


/* ============================================
   Invitation Content
   ============================================ */
.invitation-header {
  margin-bottom: 12px;
}

.header-photo {
  width: 80%;
  max-width: 80%;
  margin: 14px auto 0;
  position: relative;

  /* subtle fade into the paper around the edges */
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.10));
}

.header-photo img {
  display: block;
  width: 100%;
  height: auto; /* keeps aspect ratio */
  border-radius: 4px;

  /*
    Rectangular edge fade (NOT oval):
    fade only within ~10px from each edge.
  */
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 10px, #000 calc(100% - 10px), transparent),
    linear-gradient(to bottom, transparent, #000 10px, #000 calc(100% - 10px), transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent, #000 10px, #000 calc(100% - 10px), transparent),
    linear-gradient(to bottom, transparent, #000 10px, #000 calc(100% - 10px), transparent);
  mask-composite: intersect;
}

.invitation-prelude {
  font-family: var(--font-sans);
  font-size: clamp(10px, 2.6vw, 11px);
  font-weight: 400;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--color-text);
  margin-bottom: 16px;
}

.couple-names {
  font-family: var(--font-serif);
  font-size: clamp(36px, 8vw, 52px);
  font-weight: 400;
  line-height: 1.2;
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.couple-names .name {
  display: block;
}

.couple-names .ampersand {
  font-style: italic;
  font-size: 0.7em;
  color: var(--color-accent);
  margin: 4px 0;
}

/* ============================================
   Event Details
   ============================================ */
.invitation-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
}

.detail-block {
  padding: 1px 0;
  margin-bottom: 12px;
}

/* ============================================
   Copy-to-clipboard (IBAN)
   ============================================ */
.copy-to-clipboard.important-text-paragraph {
  pointer-events: auto;
  /* important: #paper has pointer-events:none by default */
  appearance: none;
  border: 1px solid var(--color-accent-light);
  background: transparent;
  border-radius: 12px;
  padding: 10px 14px;
  margin-top: 10px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  cursor: pointer;
  position: relative;
  /* anchor for the hint */
  user-select: all;
  -webkit-tap-highlight-color: transparent;
}

.copy-to-clipboard.important-text-paragraph:hover {
  background: rgba(212, 184, 150, 0.12);
  border-color: var(--color-accent);
}

.copy-to-clipboard.important-text-paragraph:active {
  transform: scale(0.99);
}

.copy-to-clipboard.important-text-paragraph:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* little "copiado" tooltip */
.copy-to-clipboard .copied-hint {
  position: absolute;
  left: 50%;
  top: -10px;
  transform: translate(-50%, -100%);
  background: var(--color-accent);
  color: var(--color-paper);
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;

  padding: 6px 10px;
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);

  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
}

.copy-to-clipboard .copied-hint.is-visible {
  opacity: 1;
  transform: translate(-50%, calc(-100% - 4px));
}


/* ============================================
   TRANSPORTE - Itinerario autobús
   ============================================ */
.transport-itinerary-img {
  display: block;
  width: 80%;
  max-width: 80%;
  margin: 12px auto 6px;
}

/* ============================================
   Footer & RSVP
   ============================================ */
.invitation-footer {
  margin-top: 0;
  padding-top: 0;
}

.rsvp-text {
  font-family: var(--font-serif);
  font-size: clamp(13px, 3.6vw, 14px);
  font-style: italic;
  color: var(--color-text);
}

.rsvp-divider {
  width: 40px;
  height: 1px;
  background: var(--color-accent-light);
  margin: 12px auto 36px;
}


.rsvp-button {
  display: inline-flex;
  align-self: center;
  align-items: center;
  justify-content: center;

  font-family: var(--font-sans);
  font-size: clamp(10px, 2.8vw, 11px);
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-decoration: none;

  color: var(--color-text);
  background: var(--color-paper);
  padding: 8px 36px;
  margin-top: 20px;

  border: 2px solid var(--color-accent-light);
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
  cursor: pointer;

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.rsvp-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
  border-color: var(--color-accent);
  background: rgba(212, 184, 150, 0.08);
}

.rsvp-button:active {
  transform: translateY(0);
}

.rsvp-button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.rsvp-form {
  width: 85%;
  max-width: 420px;
  margin: 40px auto 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  pointer-events: auto;
}

/* Etiquetas */
.form-label {
  font-family: var(--font-sans);
  font-size: clamp(9px, 2.6vw, 10px);
  font-weight: 500;
  text-align: left;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 6px;
}

/* Input y textarea */
.form-input,
.form-textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-sans);
  font-size: clamp(13px, 3.6vw, 14px);
  border: 1px solid #000;
  background: transparent;
  box-sizing: border-box;
}

/* Textarea */
.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Focus elegante */
.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-width: 2px;
}


/* ============================================
   Scroll Hint
   ============================================ */
.scroll-hint {
  position: fixed;
  bottom: calc(40px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: var(--z-scroll-hint);
  opacity: 1;
  transition: opacity 0.5s var(--ease-smooth);
  pointer-events: none;
}

.scroll-hint.hidden {
  opacity: 0;
}

.scroll-hint-text {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-text);

  /* Center the text inside the hint */
  display: block;
  text-align: center;
}

.scroll-hint-arrow {
  width: 20px;
  height: 20px;
  border-right: 1.5px solid var(--color-text);
  border-bottom: 1.5px solid var(--color-text);
  transform: rotate(45deg);
  animation: bounce-arrow 1.5s ease-in-out infinite;
}

@keyframes bounce-arrow {

  0%,
  100% {
    transform: rotate(45deg) translateY(0);
  }

  50% {
    transform: rotate(45deg) translateY(5px);
  }
}

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

  .envelope-flap,
  .envelope,
  #paper {
    transition: none;
  }
}

@media (max-width: 480px) {
  #scrolling-area {
    width: var(--envelope-width);
    max-width: 100%;
  }

  #header-couple-names {
    width: 90%;
  }

  /* antes 75% */
}


/* ============================================
   Countdown frame behind
   ============================================ */
.countdown-frame {
  position: relative;
  width: 80%;
  max-width: 560px;
  /* ancho real del marco */
  aspect-ratio: 4 / 1;
  margin: 10px auto 10px;
  /* reduce espacio externo arriba/abajo */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;

}

.countdown-frame #countdown {
  position: relative;
  z-index: 1;
}

/* ============================================
   Countdown
   ============================================ */
#countdown {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
}

#countdown .time-box {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin: 0 8px;
  white-space: nowrap;
}

/* El número grande de cada caja */
#countdown .time-box span:not(.label) {
  display: block;
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 500;
  font-family: var(--font-sans);
  letter-spacing: 6px;
  text-transform: uppercase;
  color: var(--color-accent);
}

/* Ajustes específicos para pantallas pequeñas */
@media (max-width: 480px) {
  #countdown {
    gap: 6px;
  }

  #countdown .time-box {
    margin: 0 4px;
  }

  #countdown .time-box span:not(.label) {
    font-size: clamp(18px, 5.5vw, 24px);
  }

  #countdown .time-box .label {
    font-size: clamp(9px, 2.8vw, 11px);
    color: var(--color-text);
  }
}

/* Labels ("días/horas/minutos/segundos") should match .standard-justified-paragraph color */
#countdown .time-box .label {
  color: var(--color-text);
}


/* ============================================
   Countdown animation
   ============================================ */

/* (moved) base number style is defined above to match .detail-label */

/* Clase que activará la animación */
#countdown .time-box span:not(.label).animate {
  animation: countdownPop 0.3s ease;
}

/* Keyframes de la animación (pequeño "pop") */
@keyframes countdownPop {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.15);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ============================================
   ITINERARIO - Timeline vertical
   ============================================ */

.timeline {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin: 20px auto 0;
  max-width: 420px;
  text-align: left;

  /* Desplaza ligeramente el bloque completo hacia la derecha */
  padding-left: 14px;
  box-sizing: border-box;
}

.timeline-item {
  display: grid;
  grid-template-columns: 44px 56px minmax(0, 1fr);
  align-items: start;
  column-gap: 20px;
  row-gap: 6px;
}

.timeline-time {
  grid-column: 2;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text);
  text-align: right;
  white-space: nowrap;
}

.timeline-content {
  grid-column: 3;
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--color-text);
  padding-left: 2px;
}

.timeline-description {
  grid-column: 2 / 4;
  margin: 0;
  width: 100%;
  max-width: 100%;
  text-align: left;
}

.timeline-line {
  position: relative;
  display: flex;
  justify-content: center;
}

.timeline-line::before {
  content: "";
  position: absolute;
  top: -28px;
  bottom: -28px;
  width: 1px;
  background-color: var(--color-accent-light);
  z-index: 0;
}

.timeline-item:first-child .timeline-line::before {
  top: 50%;
}

.timeline-item:last-child .timeline-line::before {
  bottom: 50%;
}

.timeline-icon {
  width: 40px;
  height: 40px;
  background-color: var(--color-paper);
  z-index: 1;
}

/* iOS Safari: tapa el contenido que se ve por detrás de la barra inferior */

@supports (-webkit-touch-callout: none) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
