/* =========================================================
   El Morocho — Gran Apertura
   Paleta y tipografías tomadas del sitio original (Renderforest)
   ========================================================= */

@font-face {
  font-family: 'Kurale';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/kurale-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Kurale';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/kurale-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --primary-dark: #A08559;
  --primary-light: #E3B873;
  --secondary-dark: #7D716B;
  --secondary-light: #C6B193;
  --tertiary-dark: #393838;
  --tertiary-normal: #575050;
  --tertiary-light: #F3F0F0;
  --tertiary-extralight: #F9F9F9;
  --white: #FFFFFF;

  --font-heading: 'Kurale', Georgia, serif;
  --font-body: Baskerville, 'Times New Roman', Times, serif;

  --gold-gradient: linear-gradient(-180deg, var(--primary-light) 0%, var(--primary-dark) 96%);
  --nav-h: 155px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--tertiary-dark);
  background: var(--tertiary-extralight);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }

.container {
  width: 95%;
  max-width: 1400px;
  margin: 0 auto;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-block;
  height: 50px;
  line-height: 50px;
  padding: 0 40px;
  max-width: 300px;
  border: none;
  border-radius: 10px;
  background: var(--gold-gradient);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .2s, box-shadow .2s, opacity .2s;
}
.btn--shadow { box-shadow: 0 2px 6px 0 rgba(160, 133, 89, .5); }
@media (min-width: 767px) {
  .btn:hover { background: var(--primary-dark); }
  .btn--shadow:hover { background: var(--primary-light); }
}
.btn:active { background: var(--primary-light); }
.btn:disabled { opacity: .6; cursor: wait; }

/* =========================================================
   NAVBAR
   ========================================================= */
.navbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  background: var(--tertiary-extralight);
  transition: box-shadow .3s;
}
.navbar__inner {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 20px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: height .3s;
}
.navbar__logo img {
  width: 198px;
  height: auto;
  transition: width .3s;
}
.navbar__links a {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--tertiary-dark);
  text-decoration: none;
}
.navbar__links a:hover { color: var(--primary-dark); }

.navbar.is-scrolled { box-shadow: 0 2px 10px rgba(57, 56, 56, .08); }
.navbar.is-scrolled .navbar__inner { height: 70px; }
.navbar.is-scrolled .navbar__logo img { width: 85px; }

/* =========================================================
   HERO
   ========================================================= */
.hero {
  display: flex;
  padding-top: var(--nav-h);
  background: var(--tertiary-extralight);
}
.hero__text {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 48px;
}
.hero__title {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(38px, 3.6vw, 57px);
  line-height: 1.15;
  color: var(--tertiary-dark);
}
.hero__paragraph {
  margin-top: 30px;
  max-width: 560px;
  font-size: 19px;
  line-height: 1.4;
}
.hero__buttons { margin-top: 140px; }

.hero__media {
  flex: 1 1 50%;
  aspect-ratio: 953 / 957;
  overflow: hidden;
}
.hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 70% center;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* =========================================================
   CUENTA REGRESIVA
   ========================================================= */
.feature {
  background: var(--tertiary-dark);
  color: var(--white);
  padding: 80px 0;
}
.feature__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 60px;
  max-width: 1150px;
}
.feature__text { flex: 1 1 50%; max-width: 660px; }
.feature__title {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(30px, 2.8vw, 45px);
  line-height: 1.2;
}
.feature__paragraph {
  margin-top: 25px;
  font-size: 19px;
  line-height: 1.4;
}

.countdown {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}
.countdown__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px;
}
.countdown__value {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 72px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.countdown__label {
  margin-top: 20px;
  font-size: 19px;
  text-transform: uppercase;
}
.countdown__dots {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 40px;
  line-height: 1.3;
}

/* =========================================================
   DETALLES
   ========================================================= */
.details {
  background: var(--tertiary-light);
  padding: 80px 0;
  text-align: center;
}
.details__title {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(32px, 2.8vw, 45px);
}
.details__grid {
  margin-top: 50px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0 40px;
}
.details__block {
  width: 210px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
}
.details__icon {
  width: 80px;
  height: 80px;
  fill: var(--primary-dark);
  transition: transform .3s;
}
a.details__block:hover .details__icon { transform: translateY(-4px); }
.details__block-title {
  margin-top: 30px;
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 21px;
  color: var(--primary-dark);
}
.details__block-text {
  margin-top: 25px;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.4;
}

/* =========================================================
   GALERÍA
   ========================================================= */
.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #000;
}
.gallery__item {
  margin: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}
.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .8s cubic-bezier(.23, 1, .32, 1);
}
.gallery__item:hover img { transform: scale(1.05); }

/* =========================================================
   RSVP — SOBRE
   ========================================================= */
.rsvp {
  background: var(--tertiary-dark);
  padding: 80px 20px;
  overflow: hidden;
}

.envelope {
  --w: min(716px, 100%);
  position: relative;
  width: var(--w);
  aspect-ratio: 716 / 500;
  margin: 272px auto 0;
  transition: margin-bottom .8s ease;
  perspective: 1400px;
}

.envelope__back,
.envelope__front,
.envelope__flap {
  position: absolute;
  inset: 0;
  background-size: 100% 100%;
  background-repeat: no-repeat;
}
.envelope__back {
  z-index: 1;
  border-radius: 12px;
  background-image: url(../img/sobre-fondo.png);
}
.envelope__front {
  z-index: 3;
  border-radius: 0 0 12px 12px;
  background-image: url(../img/sobre-frente.png);
  /* recorta la "V" blanca de la imagen */
  clip-path: polygon(0 3%, 47% 43%, 50% 42%, 53% 43%, 100% 3%, 100% 100%, 0 100%);
  pointer-events: none;
}
.envelope__flap {
  z-index: 4;
  background-image: url(../img/sobre-solapa.png);
  clip-path: polygon(0 0, 100% 0, 100% 6%, 52% 51%, 48% 51%, 0 6%);
  transform-origin: top center;
  transform: rotateX(0deg);
  transition: transform .9s ease-in, z-index 0s .45s;
  border-radius: 12px 12px 0 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .15));
}

/* carta */
.letter {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 2;
  width: calc(100% - 60px);
  max-width: 600px;
  transform: translate(-50%, 70px);
  transition: transform 1s cubic-bezier(.23, 1, .32, 1) .5s;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, .3));
}
.letter__card {
  position: relative;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  padding: 30px 30px 24px;
  text-align: center;
  color: var(--white);
}
.envelope:not(.is-form-open) .letter__card { border-radius: 10px; }
.letter__bg {
  position: absolute;
  inset: 0;
  background: url(../img/tarjeta.jpg) center / cover no-repeat;
}
.letter__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(57, 56, 56, .61);
}
.letter__content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.letter__subtitle {
  font-size: 19px;
  color: var(--primary-light);
}
.letter__title {
  margin-top: 14px;
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.25;
}
.letter__date {
  margin-top: 18px;
  font-size: 19px;
}
.letter__location {
  margin-top: 10px;
  font-size: 19px;
  text-decoration: none;
}
.letter__location:hover { text-decoration: underline; }
.letter__content .btn { margin-top: 26px; }

/* sobre abierto */
.envelope.is-open .envelope__flap {
  transform: rotateX(180deg);
  z-index: 0;
}
.envelope.is-open .letter {
  transform: translate(-50%, -57px);
}

/* formulario (plegado hasta que se toca "Asistiré") */
.rsvp-form { display: none; }
.envelope.is-form-open .letter {
  z-index: 5;
  transform: translate(-50%, -147px);
}
.envelope.is-form-open .rsvp-form { display: block; }

.rsvp-form__part {
  background: var(--tertiary-dark);
  transform-origin: top;
  animation: unfold .7s ease-out both;
}
.rsvp-form__part--1 {
  margin-top: -1px;
  padding: 30px 30px 15px;
}
.rsvp-form__part--2 {
  position: relative;
  margin-top: -1px;
  padding: 1px 30px 40px;
  border-bottom-left-radius: 10px;
  clip-path: polygon(100% 0, 100% calc(100% - 30px), calc(100% - 30px) 100%, 0 100%, 0 0);
  animation-delay: .35s;
  text-align: center;
}
/* esquina doblada */
.rsvp-form__part--2::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  width: 30px;
  height: 30px;
  background-image: linear-gradient(135deg, var(--tertiary-normal) 5%, var(--tertiary-dark) 57%);
  border-radius: 6px 0 0 0;
  box-shadow: 0 4px 6px rgba(255, 255, 255, .3);
}
@keyframes unfold {
  from { transform: perspective(208px) rotateX(90deg); opacity: 0; }
  to   { transform: perspective(208px) rotateX(0deg); opacity: 1; }
}

.rsvp-form__options {
  border: 0;
  margin: 0;
  padding: 0;
  text-align: center;
}
.rsvp-form__legend {
  width: 100%;
  padding: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 21px;
  color: var(--white);
}
.req { color: var(--primary-light); }
.radios {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 40px;
}
.radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  color: var(--white);
  cursor: pointer;
}
.radio input {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--white);
  cursor: pointer;
  display: grid;
  place-content: center;
}
.radio input::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary-dark);
  transform: scale(0);
  transition: transform .15s;
}
.radio input:checked::before { transform: scale(1); }
.radio input:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 2px; }

.rsvp-form__row {
  display: flex;
  gap: 16px;
  margin-top: 30px;
}
.field { flex: 1; text-align: left; }
.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 14.5px;
  color: var(--white);
}
.field input {
  width: 100%;
  height: 50px;
  padding: 0 15px;
  border: 2px solid transparent;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--tertiary-dark);
  background: var(--white);
  -webkit-appearance: none;
}
.field input:focus { outline: none; border-color: var(--primary-light); }
.field input.is-invalid { border-color: #e06a5a; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.rsvp-form__error {
  min-height: 1em;
  margin-top: 10px;
  font-size: 14px;
  color: #f0a093;
}
.rsvp-form__part--2 .btn { margin-top: 15px; }

/* =========================================================
   POPUP
   ========================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, .55);
  animation: fadeIn .25s ease both;
}
.modal[hidden] { display: none; }
.modal__box {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 50px 30px 40px;
  border-radius: 12px;
  background: var(--tertiary-extralight);
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}
.modal__close {
  position: absolute;
  top: 10px;
  right: 14px;
  border: 0;
  background: none;
  font-size: 30px;
  line-height: 1;
  color: var(--secondary-dark);
  cursor: pointer;
}
.modal__title {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 32px;
  color: var(--tertiary-dark);
}
.modal__text {
  margin-top: 14px;
  font-size: 17px;
  line-height: 1.4;
}
.modal__text:empty { display: none; }

/* =========================================================
   VOLVER ARRIBA
   ========================================================= */
.to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--tertiary-light);
  border-radius: 10px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F3F0F0 100%);
  box-shadow: 0 4px 8px rgba(57, 56, 56, .15);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, visibility .2s;
}
.to-top:hover { background: var(--white); }
.to-top svg { width: 32px; height: 32px; fill: var(--primary-dark); }
.to-top.is-visible { opacity: 1; visibility: visible; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1100px) {
  .feature__inner { flex-direction: column; align-items: flex-start; gap: 50px; }
  .countdown { align-self: center; }
}

@media (max-width: 900px) {
  :root { --nav-h: 100px; }
  .navbar__logo img { width: 140px; }
  .hero { flex-direction: column; }
  .hero__text { padding: 50px 24px 40px; }
  .hero__buttons { margin-top: 40px; }
  .hero__media { aspect-ratio: 1 / 1; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .envelope { margin-top: 150px; }
  .letter { width: calc(100% - 40px); }
  .letter { transition: transform 1s cubic-bezier(.23, 1, .32, 1) .5s, opacity .6s ease .5s; }
  .envelope:not(.is-open) .letter { opacity: 0; }
  /* en móvil la carta queda delante del sobre, como en el original */
  .envelope.is-open .letter { z-index: 5; transform: translate(-50%, -40px); }
  .envelope.is-form-open .letter { transform: translate(-50%, -100px); }
}

@media (max-width: 600px) {
  .navbar__links a { font-size: 14px; }
  .feature { padding: 60px 0; }
  .countdown { gap: 6px; }
  .countdown__item { min-width: 0; width: 64px; }
  .countdown__value { font-size: 40px; }
  .countdown__dots { font-size: 26px; line-height: 1.2; }
  .countdown__label { font-size: 13px; margin-top: 12px; }
  .details { padding: 60px 0; }
  .details__grid { gap: 40px; flex-direction: column; align-items: center; }
  .details__icon { width: 64px; height: 64px; }
  .details__block-title { margin-top: 18px; }
  .details__block-text { margin-top: 12px; }
  .rsvp { padding: 60px 12px; }
  .envelope { margin-top: 110px; }
  .letter__card { padding: 24px 16px 20px; }
  .letter__subtitle, .letter__date, .letter__location { font-size: 17px; }
  .letter__date { margin-top: 12px; }
  .letter__content .btn { margin-top: 18px; }
  .rsvp-form__part--1 { padding: 24px 14px 10px; }
  .rsvp-form__part--2 { padding: 1px 14px 40px; }
  .rsvp-form__row { flex-direction: column; gap: 20px; margin-top: 24px; }
}


/* =========================================================
   ANIMACIONES (solo con html.anim; se desactivan con
   "reducir movimiento")
   ========================================================= */
:root {
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-wipe: cubic-bezier(.77, 0, .18, 1);
}

/* --- Entrada del hero: el momento principal --- */
.anim .navbar          { animation: navIn .8s var(--ease-out) both; }
.anim .hero__title     { animation: titleIn 1.2s var(--ease-out) .3s both; }
.anim .hero__paragraph { animation: riseIn 1s var(--ease-out) .55s both; }
.anim .hero__buttons   { animation: riseIn 1s var(--ease-out) .75s both; }
.anim .hero__media     { animation: wipeIn 1.4s var(--ease-wipe) .1s both; }
.anim .hero__media img { animation: settle 2.8s var(--ease-out) .1s both; }

@keyframes navIn   { from { opacity: 0; transform: translateY(-12px); } }
@keyframes riseIn  { from { opacity: 0; transform: translateY(26px); } }
@keyframes titleIn { from { opacity: 0; letter-spacing: .14em; transform: translateY(18px); } }
@keyframes wipeIn  { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
@keyframes settle  { from { transform: scale(1.12); } to { transform: scale(1); } }

/* --- Aparición al hacer scroll --- */
.anim [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
.anim [data-reveal].is-visible { opacity: 1; transform: none; }

/* la galería se descubre con una cortina que sube
   (no se recorta la figura: el observador la daría por invisible) */
.anim .gallery__item[data-reveal] {
  position: relative;
  opacity: 1;
  transform: none;
}
.anim .gallery__item[data-reveal]::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--tertiary-dark);
  transform-origin: top;
  transition: transform 1.2s var(--ease-wipe);
  transition-delay: var(--d, 0ms);
  pointer-events: none;
}
.anim .gallery__item[data-reveal].is-visible::after { transform: scaleY(0); }

/* --- Línea dorada bajo los títulos --- */
.feature__title::after,
.details__title::after {
  content: '';
  display: block;
  width: 56px;
  height: 2px;
  margin-top: 20px;
  background: linear-gradient(90deg, var(--primary-light), var(--primary-dark));
  transform-origin: left;
  transition: transform 1.1s var(--ease-out) .45s;
}
.details__title::after { margin-inline: auto; transform-origin: center; }
.anim [data-reveal]:not(.is-visible) .feature__title::after,
.anim .details__title[data-reveal]:not(.is-visible)::after { transform: scaleX(0); }

/* --- Cuenta regresiva: el número gira al cambiar --- */
.countdown__value { display: inline-block; }
.countdown__value.tick { animation: tick .55s var(--ease-out); }
@keyframes tick { from { opacity: .1; transform: translateY(-32%); } }

/* --- Botones y enlaces --- */
.btn {
  transition: background .25s, box-shadow .3s, transform .3s var(--ease-out), opacity .2s;
}
@media (hover: hover) {
  .btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(160, 133, 89, .35); }
}
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 3px; }

.navbar__links a { position: relative; }
.navbar__links a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1px;
  background: var(--primary-dark);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .45s var(--ease-out);
}
.navbar__links a:hover::after { transform: scaleX(1); transform-origin: left; }

/* --- "Asistiré" invita a tocarlo cuando sale la carta --- */
.anim .envelope.is-open:not(.is-form-open) #open-form { animation: invite 2.2s ease-out 1.8s 2; }
@keyframes invite {
  0%       { box-shadow: 0 0 0 0 rgba(227, 184, 115, .6); }
  70%, 100% { box-shadow: 0 0 0 16px rgba(227, 184, 115, 0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
