/*********************************************************************************
 * GENERAL
 *********************************************************************************/
:root {
    --background-color: #f0f0f0; /* Define el color de fondo como una variable */
      /* 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-text-muted: #6b635a;
    --color-accent: #b8956e;
    --color-accent-light: #d4b896;
    --color-seal: #ce0808;
    --color-seal-dark: #480909;

    /* Typography */
    --font-serif: 'Cormorant Garamond', Georgia, serif;
    --font-sans: '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;

}

html {
  overscroll-behavior: none;
}

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

/*********************************************************************************
 * ENVELOPE
 *********************************************************************************/
#overlay {
    position: absolute;
    left: 0;
    width: 100%;
    height: 500px;

    /* CLAVE */
    top: calc(100% - 5px);

    background-color: var(--background-color);
    z-index: var(--z-overlay);
    pointer-events: none;
}


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

    position: fixed;
    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 {
    position: fixed;
    z-index: var(--z-envelope-front);
}

#envelope-back-container {
    position: fixed;
    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);
}

#envelope-flap-opened{
  will-change: transform;
}

#envelope-flap-closed{
  will-change: transform;
}


/* 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;
  top: calc(var(--flap-height) - 70px);
  left: 50%;
  transform: translateX(-50%);
  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);
  /* Seal follows the flap initially */
  transform-origin: center top;
}

/*********************************************************************************
 * PAPER
 *********************************************************************************/
/* Scrolling area */
#scrolling-area {
    width: 60%;
    height: auto;
    padding-top: 120px;
    padding-bottom: 100px;
    position: relative;
    margin: 0 auto;
    z-index: var(--z-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;
}

.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;
}

/* Enhanced shadow when paper is the main focus */
.paper.interactive .paper-inner {
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.15),
    0 8px 20px rgba(0, 0, 0, 0.1);
  max-height: 90dvh;
  overflow: auto; /* permitir lectura */
  -webkit-overflow-scrolling: touch;
}

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

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

}

#maps-icon {
  width: 10%;
  height: auto;
  border-radius: 50%;
  box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.3);
  border: 2px solid #ccc; /* Adds a light gray border */
  padding: 5px; /* Adds space between the image and the border */
}

a:hover #maps-icon {
  transform: scale(1.1); /* Slightly enlarges the image on hover */
  box-shadow: 0px 6px 8px rgba(0, 0, 0, 0.5); /* Makes the shadow more prominent */
}

#calendar-icon {
  width: 10%;
  height: auto;
  border-radius: 50%;
  box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.3);
  border: 2px solid #ccc; /* Adds a light gray border */
  padding: 5px; /* Adds space between the image and the border */
}

a:hover #calendar-icon {
  transform: scale(1.1); /* Slightly enlarges the image on hover */
  box-shadow: 0px 6px 8px rgba(0, 0, 0, 0.5); /* Makes the shadow more prominent */
}


/* ============================================
   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: 32px;
}

.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-muted);
  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;
}

.invitation-request {
  font-family: var(--font-serif);
  font-size: clamp(13px, 3.6vw, 15px);
  line-height: 1.7;
  font-style: italic;
  color: var(--color-text-muted);
  margin-top: 20px;
  line-height: 1.7;
}

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

.detail-block {
  padding: 8px 0;
}

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

.detail-value {
  font-family: var(--font-serif);
  font-size: clamp(16px, 4.4vw, 18px);
  font-weight: 500;
  color: var(--color-text);
}

.detail-sub {
  font-family: var(--font-sans);
  font-size: clamp(11px, 3.2vw, 12px);
  font-weight: 300;
  color: var(--color-text-muted);
  margin-top: 2px;
}

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

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

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

.rsvp-request {
  font-family: var(--font-sans);
  font-size: clamp(11px, 3.2vw, 12px);
  font-weight: 400;
  color: var(--color-text-muted);
  margin-bottom: 20px;
}

.rsvp-button {
  display: inline-block;
  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-paper);
  background: var(--color-accent);
  padding: 14px 36px;
  border-radius: 2px;
  transition:
    background-color 0.2s var(--ease-smooth),
    transform 0.2s var(--ease-smooth);
  margin-top: 20px;
}

.rsvp-button:hover {
  background: var(--color-seal-dark);
  transform: translateY(-1px);
}

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

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

/* 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: 40px;
  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;
  bottom: calc(40px + env(safe-area-inset-bottom));
}

.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-muted);
}

.scroll-hint-arrow {
  width: 20px;
  height: 20px;
  border-right: 1.5px solid var(--color-text-muted);
  border-bottom: 1.5px solid var(--color-text-muted);
  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% */
  #maps-icon, #calendar-icon { width: 16%; } /* antes 10% */
}

