/* ==========================================================================
   Demo "Revista XV" (/invitaciones/xv-revista) (.mg-*)
   Mundo: revista de moda de edición única. Cobalto en campos completos,
   noche, hielo (el azul del vestido), papel y un solo toque cobre.
   Gloock = cabecera, titulares y cifras. Bricolage Grotesque = todo lo demás.
   ========================================================================== */

:root {
  --mg-cobalt: #1e3be0;
  --mg-cobalt-press: #1730c2;
  --mg-night: #0a1230;
  --mg-ice: #dce6f6;
  --mg-ice-2: #c4d2ef;
  --mg-paper: #f7f9fc;
  --mg-silver: #a9b6cb;
  --mg-copper: #e5683e;
  --mg-ink: #0a1230;
  --mg-ink-2: #3d4766;
  --mg-rule: rgba(10, 18, 48, 0.14);
  --mg-error: #b3261e;

  --mg-serif: "Gloock", "Didot", "Bodoni 72", Georgia, serif;
  --mg-sans: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --mg-script: "Mrs Saint Delafield", "Brush Script MT", cursive;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  --mg-gutter: 24px;
  --mg-width: 480px;
}

/* ---------- Base ---------- */
html {
  background: var(--mg-night);
  scrollbar-color: var(--mg-cobalt) var(--mg-night);
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--mg-sans);
  font-size: 17px;
  line-height: 1.55;
  font-weight: 400;
  color: var(--mg-ink);
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(30, 59, 224, 0.28), transparent 70%),
    var(--mg-night);
  caret-color: var(--mg-cobalt);
}

::selection {
  background: var(--mg-cobalt);
  color: #fff;
}

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

a {
  text-underline-offset: 4px;
}

.mg-sealed,
.mg-sealed body {
  overflow: hidden;
  height: 100%;
}

.mg-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ==========================================================================
   Portada
   ========================================================================== */
.mg-gate {
  display: none;
}

.mg-js .mg-gate {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 100;
  background-color: rgba(10, 18, 48, 1);
  transition: background-color 0.9s ease 0.45s;
}

.mg-gate[hidden] {
  display: none;
}

.mg-gate.is-open {
  background-color: rgba(10, 18, 48, 0);
  pointer-events: none;
}

.mg-book {
  position: relative;
  width: min(100%, var(--mg-width));
  height: 100%;
  margin: 0 auto;
  perspective: 2200px;
  perspective-origin: 0% 50%;
}

.mg-cover {
  position: absolute;
  inset: 0;
  transform-origin: 0% 50%;
  transform-style: preserve-3d;
  transition: transform 1.6s var(--ease-in-out), opacity 0.4s ease 1.2s;
}

.mg-gate.is-open .mg-cover {
  transform: rotateY(-158deg);
  opacity: 0;
}

.mg-cover__front,
.mg-cover__back {
  position: absolute;
  inset: 0;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.mg-cover__front {
  background: var(--mg-night);
  cursor: pointer;
  user-select: none;
}

/* Lomo: sombra del doblez en el borde izquierdo */
.mg-cover__front::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 18px;
  z-index: 3;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.38), rgba(0, 0, 0, 0));
  pointer-events: none;
}

/* La hoja se oscurece al girar */
.mg-cover__front::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  background: var(--mg-night);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.9s ease-in-out;
}

.mg-gate.is-open .mg-cover__front::after {
  opacity: 0.6;
}

.mg-cover__back {
  transform: rotateY(180deg);
  display: grid;
  place-items: center;
  padding: 48px;
  background: var(--mg-paper);
  color: var(--mg-ink);
  text-align: center;
  font-family: var(--mg-serif);
  font-size: 1.5rem;
  line-height: 1.25;
}

.mg-cover__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  transform: scale(1.08);
}

.is-ready .mg-cover__photo {
  transform: scale(1);
  transition: transform 2.8s var(--ease-out);
}

.mg-cover__top {
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
  padding: calc(env(safe-area-inset-top) + 18px) 18px 70px;
  background: linear-gradient(rgba(10, 18, 48, 0.62), rgba(10, 18, 48, 0));
}

.mg-dateline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(220, 230, 246, 0.5);
  color: var(--mg-ice);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
}

.mg-masthead {
  margin-top: 4px;
  color: #fff;
  font-family: var(--mg-serif);
  font-size: 96px;
  line-height: 0.86;
  letter-spacing: -0.03em;
  text-align: center;
  white-space: nowrap;
}

.mg-masthead.is-wrapped {
  line-height: 0.92;
  white-space: normal;
}

.mg-masthead__text {
  display: inline;
}

/* Cada palabra recorta la subida de sus letras */
.mg-word {
  display: inline-block;
  overflow: hidden;
  padding: 0.06em 0.02em 0.02em;
  vertical-align: top;
  white-space: nowrap;
}

.mg-ch {
  display: inline-block;
}

.mg-js .mg-gate:not(.is-ready) .mg-ch {
  transform: translateY(110%);
}

.is-ready .mg-ch {
  transition: transform 0.95s var(--ease-out);
  transition-delay: calc(var(--i) * 55ms + 0.2s);
}

.mg-sticker {
  position: absolute;
  z-index: 2;
  top: 47%;
  right: 16px;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--mg-copper);
  color: var(--mg-night);
  font-family: var(--mg-serif);
  font-size: 15px;
  line-height: 1.02;
  text-align: center;
  box-shadow: 0 10px 22px -10px rgba(0, 0, 0, 0.6);
  transform: rotate(-12deg);
}

.mg-sticker::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 1px dashed rgba(10, 18, 48, 0.45);
}

.mg-js .mg-gate:not(.is-ready) .mg-sticker {
  opacity: 0;
  transform: rotate(-30deg) scale(0.9);
}

.is-ready .mg-sticker {
  transition: opacity 0.4s ease-out 1.15s, transform 0.7s var(--ease-out) 1.15s;
}

.mg-cover__bottom {
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 120px 18px calc(env(safe-area-inset-bottom) + 112px);
  background: linear-gradient(to top, rgba(10, 18, 48, 0.94) 0%, rgba(10, 18, 48, 0.72) 42%, rgba(10, 18, 48, 0));
}

.mg-coverlines {
  min-width: 0;
}

.mg-cl {
  margin-top: 5px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
}

.mg-cl b {
  margin-right: 7px;
  color: var(--mg-ice-2);
  font-weight: 700;
  font-variant-numeric: lining-nums;
}

.mg-cl--lead {
  margin: 0;
  font-family: var(--mg-serif);
  font-size: 34px;
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.01em;
}

.mg-cl--date {
  margin: 10px 0 10px;
  color: var(--mg-ice);
  font-size: 16px;
  font-weight: 650;
}

.mg-js .mg-gate:not(.is-ready) .mg-cl,
.mg-js .mg-gate:not(.is-ready) .mg-dateline,
.mg-js .mg-gate:not(.is-ready) .mg-barcode,
.mg-js .mg-gate:not(.is-ready) .mg-open {
  opacity: 0;
  transform: translateY(10px);
}

.is-ready .mg-dateline,
.is-ready .mg-cl,
.is-ready .mg-barcode,
.is-ready .mg-open {
  transition: opacity 0.6s ease-out, transform 0.8s var(--ease-out);
}

.is-ready .mg-dateline { transition-delay: 0.1s; }
.is-ready .mg-cl:nth-child(1) { transition-delay: 0.65s; }
.is-ready .mg-cl:nth-child(2) { transition-delay: 0.72s; }
.is-ready .mg-cl:nth-child(3) { transition-delay: 0.79s; }
.is-ready .mg-cl:nth-child(4) { transition-delay: 0.86s; }
.is-ready .mg-barcode { transition-delay: 0.95s; }
.is-ready .mg-open { transition-delay: 1.4s; }

.mg-barcode {
  flex: none;
  width: 86px;
  padding: 6px 6px 4px;
  background: #fff;
  color: var(--mg-night);
  font-size: 8px;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
}

.mg-barcode__bars {
  width: 100%;
  height: 34px;
  margin-bottom: 3px;
  fill: currentColor;
}

/* Botón principal: abrir */
.mg-open {
  position: absolute;
  z-index: 4;
  left: 18px;
  right: 18px;
  bottom: calc(env(safe-area-inset-bottom) + 22px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 14px 18px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--mg-cobalt);
  color: #fff;
  box-shadow: 0 14px 30px -12px rgba(30, 59, 224, 0.9);
  touch-action: manipulation;
}

.mg-open::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 2px rgba(220, 230, 246, 0.7);
  opacity: 0;
  pointer-events: none;
}

.is-ready .mg-open::after {
  animation: mg-ring 2.6s var(--ease-out) 2.4s infinite;
}

@keyframes mg-ring {
  0% { opacity: 0.8; transform: scale(1); }
  70%, 100% { opacity: 0; transform: scale(1.06, 1.35); }
}

.mg-open__label {
  font-size: 17px;
  font-weight: 650;
  line-height: 1.1;
}

.mg-open__hint {
  color: var(--mg-ice-2);
  font-size: 12px;
  line-height: 1.2;
}

.is-ready .mg-open:active {
  transform: scale(0.97);
  transition: transform 160ms var(--ease-out);
}

.is-settled .mg-open {
  transition: transform 160ms var(--ease-out), background-color 200ms ease;
  transition-delay: 0s;
}

.mg-open:focus-visible {
  outline-color: #fff;
}

/* ==========================================================================
   Revista
   ========================================================================== */
.mg-mag {
  position: relative;
  max-width: var(--mg-width);
  margin: 0 auto;
  overflow: clip;
  background: var(--mg-paper);
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, 0.7);
}

.mg-page {
  position: relative;
  padding: 88px var(--mg-gutter) 26px;
}

.mg-title {
  margin-bottom: 24px;
  font-family: var(--mg-serif);
  font-size: 2.6rem;
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.mg-title--second {
  margin-top: 64px;
}

.mg-lead {
  max-width: 40ch;
  margin-bottom: 20px;
  color: var(--mg-ink-2);
  font-size: 17px;
}

.mg-folio {
  display: flex;
  justify-content: space-between;
  margin-top: 64px;
  padding-top: 10px;
  border-top: 1px solid var(--mg-rule);
  color: var(--mg-ink-2);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Campos de color: cada página vive en su propio material */
.mg-count,
.mg-credits,
.mg-rsvp {
  background: var(--mg-cobalt);
  color: #fff;
}

.mg-session,
.mg-album {
  background: var(--mg-night);
  color: #fff;
}

.mg-program,
.mg-dress {
  background: var(--mg-ice);
}

.mg-count .mg-folio,
.mg-credits .mg-folio,
.mg-rsvp .mg-folio,
.mg-session .mg-folio,
.mg-album .mg-folio {
  border-top-color: rgba(255, 255, 255, 0.28);
  color: var(--mg-ice-2);
}

.mg-count .mg-lead,
.mg-rsvp .mg-lead,
.mg-album .mg-lead {
  color: var(--mg-ice);
}

.mg-count :focus-visible,
.mg-credits :focus-visible,
.mg-rsvp > :focus-visible,
.mg-session :focus-visible,
.mg-album :focus-visible,
.mg-back :focus-visible {
  outline-color: #fff;
}

/* ---------- Botones ---------- */
.mg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
  padding: 14px 22px;
  border: 0;
  border-radius: 999px;
  font-family: var(--mg-sans);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: transform 160ms var(--ease-out), background-color 200ms ease, color 200ms ease, box-shadow 200ms ease;
}

.mg-btn svg {
  flex: none;
  width: 20px;
  height: 20px;
}

.mg-btn:active {
  transform: scale(0.97);
}

.mg-btn--light {
  background: var(--mg-paper);
  color: var(--mg-cobalt);
}

.mg-btn--line {
  background: transparent;
  color: var(--mg-ink);
  box-shadow: inset 0 0 0 1.5px var(--mg-ink);
}

.mg-btn--whatsapp {
  width: 100%;
  margin-top: 0;
  padding: 16px 22px;
  background: var(--mg-cobalt);
  color: #fff;
}

@media (hover: hover) and (pointer: fine) {
  .mg-btn--light:hover { background: #fff; }
  .mg-btn--line:hover { background: var(--mg-ink); color: var(--mg-paper); }
  .mg-btn--whatsapp:hover { background: var(--mg-cobalt-press); }
  .mg-open:hover { background: var(--mg-cobalt-press); }
}

/* ---------- Revelado de fotos (la foto se "imprime" de arriba abajo) ---------- */
.mg-develop {
  display: block;
  overflow: hidden;
}

.mg-develop img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mg-js .mg-reveal .mg-develop {
  clip-path: inset(0 0 100% 0);
}

.mg-js .mg-reveal .mg-develop img {
  transform: scale(1.12);
}

.mg-js .mg-reveal.is-in .mg-develop {
  clip-path: inset(0 0 0 0);
  transition: clip-path 1.1s var(--ease-in-out);
}

.mg-js .mg-reveal.is-in .mg-develop img {
  transform: scale(1);
  transition: transform 1.6s var(--ease-out);
}

figcaption {
  margin-top: 8px;
  color: var(--mg-ink-2);
  font-size: 13px;
  line-height: 1.35;
}

/* ---------- Índice ---------- */
.mg-index {
  padding-top: 72px;
}

.mg-index__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
  padding-bottom: 14px;
  border-bottom: 3px solid var(--mg-ink);
}

.mg-index__head .mg-title {
  margin: 0;
}

.mg-index__head .mg-title:focus {
  outline: none;
}

.mg-index__issue {
  flex: none;
  color: var(--mg-cobalt);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  text-align: right;
}

.mg-toc a {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: baseline;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--mg-rule);
  color: inherit;
  text-decoration: none;
  transition: background-color 200ms ease;
}

.mg-toc a:active {
  background: var(--mg-ice);
}

.mg-toc__n {
  color: var(--mg-cobalt);
  font-family: var(--mg-serif);
  font-size: 30px;
  line-height: 1;
  font-variant-numeric: lining-nums;
}

.mg-toc__t {
  font-size: 18px;
  font-weight: 650;
  line-height: 1.2;
  transition: color 200ms ease;
}

.mg-toc__t small {
  display: block;
  margin-top: 3px;
  color: var(--mg-ink-2);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.35;
}

@media (hover: hover) and (pointer: fine) {
  .mg-toc a:hover .mg-toc__t { color: var(--mg-cobalt); }
}

/* ---------- Carta ---------- */
.mg-letter__photo {
  margin: 0 0 36px;
}

.mg-letter__photo .mg-develop {
  aspect-ratio: 4 / 5;
}

.mg-letter__body p {
  max-width: 62ch;
  margin-bottom: 14px;
  font-size: 18px;
  line-height: 1.62;
}

.mg-dropcap::first-letter {
  float: left;
  margin: 0.08em 0.1em 0 0;
  color: var(--mg-cobalt);
  font-family: var(--mg-serif);
  font-size: 4.4em;
  line-height: 0.8;
}

.mg-signature {
  margin: 4px 0 30px;
  color: var(--mg-cobalt);
  font-family: var(--mg-script);
  font-size: 68px;
  line-height: 1.1;
  transform: rotate(-4deg);
  transform-origin: left center;
}

.mg-signature span {
  display: inline-block;
  padding: 0 0.15em;
}

.mg-js .mg-signature span {
  clip-path: inset(0 100% 0 0);
}

.mg-js .mg-signature.is-in span {
  clip-path: inset(0 0 0 0);
  transition: clip-path 1.6s var(--ease-in-out) 0.2s;
}

.mg-parents {
  padding-top: 18px;
  border-top: 1px solid var(--mg-rule);
}

.mg-parents__label {
  color: var(--mg-ink-2);
  font-size: 14px;
}

.mg-parents__names {
  margin-top: 4px;
  font-family: var(--mg-serif);
  font-size: 23px;
  line-height: 1.25;
}

.mg-parents__names em {
  color: var(--mg-cobalt);
  font-style: normal;
}

/* ---------- Cuenta regresiva ---------- */
.mg-count .mg-title {
  font-size: 3.6rem;
}

.mg-count__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid rgba(255, 255, 255, 0.35);
}

.mg-count__cell {
  padding: 18px 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

.mg-count__cell:nth-child(odd) {
  padding-right: 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.35);
}

.mg-count__cell:nth-child(even) {
  padding-left: 18px;
}

.mg-count__num {
  display: block;
  font-family: var(--mg-serif);
  font-size: clamp(56px, 18vw, 84px);
  line-height: 0.92;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums lining-nums;
}

.mg-count__num.is-tick {
  animation: mg-tick 0.4s var(--ease-out);
}

@keyframes mg-tick {
  from { opacity: 0.3; transform: translateY(-12%); }
}

.mg-count__unit {
  display: block;
  margin-top: 6px;
  color: var(--mg-ice);
  font-size: 14px;
}

.mg-count__note {
  margin-top: 18px;
  color: var(--mg-ice);
  font-size: 16px;
}

/* ---------- Programa ---------- */
.mg-timeline li {
  display: grid;
  grid-template-columns: 118px 1fr;
  align-items: baseline;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--mg-rule);
}

.mg-timeline li:first-child {
  border-top: 1px solid var(--mg-rule);
}

.mg-timeline time {
  color: var(--mg-cobalt);
  font-family: var(--mg-serif);
  font-size: 38px;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: lining-nums;
  white-space: nowrap;
}

.mg-timeline time small {
  margin-left: 3px;
  color: var(--mg-ink-2);
  font-family: var(--mg-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
}

.mg-timeline p {
  color: var(--mg-ink-2);
  font-size: 15px;
  line-height: 1.35;
}

.mg-timeline b {
  display: block;
  color: var(--mg-ink);
  font-size: 17px;
  font-weight: 650;
  line-height: 1.25;
}

.mg-js .mg-timeline li {
  opacity: 0;
  transform: translateY(10px);
}

.mg-js .mg-timeline.is-in li {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s ease-out, transform 0.7s var(--ease-out);
}

.mg-timeline.is-in li:nth-child(2) { transition-delay: 70ms; }
.mg-timeline.is-in li:nth-child(3) { transition-delay: 140ms; }
.mg-timeline.is-in li:nth-child(4) { transition-delay: 210ms; }
.mg-timeline.is-in li:nth-child(5) { transition-delay: 280ms; }
.mg-timeline.is-in li:nth-child(6) { transition-delay: 350ms; }

/* ---------- Ubicaciones ---------- */
.mg-venue + .mg-venue {
  margin-top: 56px;
}

.mg-venue__photo {
  margin: 0;
}

.mg-venue__photo .mg-develop {
  aspect-ratio: 4 / 3;
}

.mg-venue__when {
  margin-top: 18px;
  color: var(--mg-cobalt);
  font-size: 15px;
  font-weight: 650;
}

.mg-venue__name {
  margin-top: 4px;
  font-family: var(--mg-serif);
  font-size: 31px;
  font-weight: 400;
  line-height: 1.05;
}

.mg-venue__addr {
  margin-top: 6px;
  color: var(--mg-ink-2);
}

.mg-venue .mg-btn {
  margin-top: 16px;
}

/* ---------- Sesión de fotos ---------- */
.mg-session__dek {
  max-width: 38ch;
  color: var(--mg-ice);
}

.mg-spread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 10px;
  margin-top: 30px;
}

.mg-shot {
  margin: 0;
  min-width: 0;
}

.mg-shot--full {
  grid-column: 1 / -1;
}

.mg-shot__btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  touch-action: manipulation;
}

.mg-shot .mg-develop {
  aspect-ratio: 2 / 3;
}

.mg-shot--full .mg-develop {
  aspect-ratio: 4 / 5;
}

.mg-shot--wide .mg-develop {
  aspect-ratio: 3 / 2;
}

.mg-session figcaption {
  color: var(--mg-ice-2);
  font-size: 12.5px;
}

@media (hover: hover) and (pointer: fine) {
  .mg-shot__btn img { transition: transform 1.6s var(--ease-out), filter 300ms ease; }
  .mg-shot__btn:hover img { filter: brightness(1.08); }
}

.mg-pull {
  grid-column: 1 / -1;
  margin: 18px 0;
  padding: 26px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
  border-bottom: 1px solid rgba(255, 255, 255, 0.28);
}

.mg-pull p {
  font-family: var(--mg-serif);
  font-size: 31px;
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

/* ---------- Entrevista ---------- */
.mg-qa > div {
  padding: 16px 0;
  border-bottom: 1px solid var(--mg-rule);
}

.mg-interview .mg-qa:first-of-type > div:first-child {
  border-top: 1px solid var(--mg-rule);
}

.mg-qa dt {
  color: var(--mg-cobalt);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.3;
}

.mg-qa dd {
  margin: 4px 0 0;
  font-family: var(--mg-serif);
  font-size: 22px;
  line-height: 1.28;
}

.mg-js .mg-qa__more {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s var(--ease-in-out);
}

.mg-js .mg-qa__more.is-open {
  grid-template-rows: 1fr;
}

.mg-qa__inner {
  min-height: 0;
  overflow: hidden;
}

.mg-js .mg-qa__more:not(.is-open) .mg-qa__inner {
  visibility: hidden;
  transition: visibility 0s linear 0.45s;
}

.mg-interview .mg-btn {
  margin-top: 22px;
}

/* ---------- Vestimenta ---------- */
.mg-dress__code {
  color: var(--mg-cobalt);
  font-family: var(--mg-serif);
  font-size: 68px;
  line-height: 0.95;
  letter-spacing: -0.02em;
}

.mg-dress__note {
  margin-top: 10px;
  color: var(--mg-ink-2);
}

.mg-chips {
  margin-top: 36px;
}

.mg-chips__label {
  font-size: 15px;
  font-weight: 650;
}

.mg-chips__row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.mg-chip {
  padding: 8px 8px 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(10, 18, 48, 0.12), 0 10px 20px -12px rgba(10, 18, 48, 0.4);
}

.mg-chip:nth-child(1) { --r: -2deg; }
.mg-chip:nth-child(2) { --r: 1.5deg; }
.mg-chip:nth-child(3) { --r: -1deg; }

.mg-chip {
  transform: rotate(var(--r));
}

.mg-chip__swatch {
  display: block;
  aspect-ratio: 1;
  background: var(--chip);
  border: 1px solid rgba(10, 18, 48, 0.1);
}

.mg-chip__swatch--silver {
  background: linear-gradient(135deg, #e9edf3 0%, #a9b6cb 38%, #f4f6fa 55%, #8e9bb2 100%);
}

.mg-chip__name {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
}

.mg-js .mg-chips .mg-chip {
  opacity: 0;
  transform: translateY(14px) rotate(var(--r));
}

.mg-js .mg-chips.is-in .mg-chip {
  opacity: 1;
  transform: rotate(var(--r));
  transition: opacity 0.45s ease-out, transform 0.7s var(--ease-out);
}

.mg-chips.is-in .mg-chip:nth-child(2) { transition-delay: 80ms; }
.mg-chips.is-in .mg-chip:nth-child(3) { transition-delay: 160ms; }

.mg-dress__photo {
  margin: 40px 0 0;
}

.mg-dress__photo .mg-develop {
  aspect-ratio: 3 / 2;
}

/* ---------- Créditos ---------- */
.mg-staff > div {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.28);
}

.mg-staff > div:first-child {
  border-top: 1px solid rgba(255, 255, 255, 0.28);
}

.mg-staff dt {
  color: var(--mg-ice);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}

.mg-staff dd {
  margin: 0;
  font-family: var(--mg-serif);
  font-size: 19px;
  line-height: 1.3;
}

.mg-staff--small {
  margin-top: 36px;
}

.mg-staff--small dd {
  font-family: var(--mg-sans);
  font-size: 14px;
}

.mg-js .mg-staff.mg-reveal > div {
  opacity: 0;
}

.mg-js .mg-staff.mg-reveal.is-in > div {
  opacity: 1;
  transition: opacity 0.6s ease-out;
}

.mg-staff.is-in > div:nth-child(2) { transition-delay: 60ms; }
.mg-staff.is-in > div:nth-child(3) { transition-delay: 120ms; }
.mg-staff.is-in > div:nth-child(4) { transition-delay: 180ms; }
.mg-staff.is-in > div:nth-child(5) { transition-delay: 240ms; }
.mg-staff.is-in > div:nth-child(6) { transition-delay: 300ms; }
.mg-staff.is-in > div:nth-child(7) { transition-delay: 360ms; }

/* ---------- Regalos y hospedaje ---------- */
.mg-list li {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 14px;
  padding: 18px 0;
  border-top: 1px solid var(--mg-rule);
}

.mg-list li:last-child {
  border-bottom: 1px solid var(--mg-rule);
}

.mg-list svg {
  width: 24px;
  height: 24px;
  margin-top: 4px;
  color: var(--mg-cobalt);
}

.mg-list b {
  display: block;
  font-family: var(--mg-serif);
  font-size: 23px;
  font-weight: 400;
  line-height: 1.2;
}

.mg-list span {
  display: block;
  margin-top: 2px;
  color: var(--mg-ink-2);
  font-size: 15px;
  line-height: 1.4;
}

.mg-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--mg-cobalt);
  font-size: 15px;
  font-weight: 650;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
}

/* ---------- Álbum con QR ---------- */
.mg-album__body {
  display: grid;
  grid-template-columns: 1fr 136px;
  align-items: center;
  gap: 18px;
}

.mg-album .mg-lead {
  margin: 0;
}

.mg-qr {
  width: 136px;
  height: 136px;
  padding: 9px;
  border-radius: 6px;
  background: #fff;
}

.mg-qr canvas,
.mg-qr img {
  width: 100% !important;
  height: auto !important;
}

/* ---------- Confirmación: tarjeta que se desprende ---------- */
.mg-card {
  margin-top: 26px;
  color: var(--mg-ink);
  filter: drop-shadow(0 22px 30px rgba(5, 10, 40, 0.35));
}

.mg-card__body,
.mg-card__stub {
  background: var(--mg-paper);
}

.mg-card__body {
  padding: 22px 20px 22px;
  border-radius: 8px 8px 0 0;
  -webkit-mask:
    radial-gradient(circle 11px at 0 100%, #0000 98%, #000) bottom left / 51% 100% no-repeat,
    radial-gradient(circle 11px at 100% 100%, #0000 98%, #000) bottom right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle 11px at 0 100%, #0000 98%, #000) bottom left / 51% 100% no-repeat,
    radial-gradient(circle 11px at 100% 100%, #0000 98%, #000) bottom right / 51% 100% no-repeat;
}

.mg-card__stub {
  position: relative;
  padding: 20px 20px 22px;
  border-radius: 0 0 8px 8px;
  transform-origin: 100% 0;
  -webkit-mask:
    radial-gradient(circle 11px at 0 0, #0000 98%, #000) top left / 51% 100% no-repeat,
    radial-gradient(circle 11px at 100% 0, #0000 98%, #000) top right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle 11px at 0 0, #0000 98%, #000) top left / 51% 100% no-repeat,
    radial-gradient(circle 11px at 100% 0, #0000 98%, #000) top right / 51% 100% no-repeat;
}

/* Perforación */
.mg-card__stub::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  border-top: 2px dashed rgba(10, 18, 48, 0.25);
}

.mg-card.is-torn .mg-card__stub {
  opacity: 0;
  transform: translate(10px, 26px) rotate(-5deg);
  transition: transform 0.7s var(--ease-in-out), opacity 0.45s ease 0.25s;
  pointer-events: none;
}

.mg-card__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--mg-ink);
  color: var(--mg-cobalt);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
}

.mg-field {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.mg-field + .mg-field {
  margin-top: 20px;
}

.mg-field.is-hidden {
  display: none;
}

.mg-field label,
.mg-field legend,
.mg-field__label {
  display: block;
  margin-bottom: 7px;
  padding: 0;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.3;
}

.mg-field small {
  color: var(--mg-ink-2);
  font-weight: 400;
}

.mg-field input[type="text"],
.mg-field textarea {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid rgba(10, 18, 48, 0.25);
  border-radius: 10px;
  background: #fff;
  color: var(--mg-ink);
  font-size: 17px;
  line-height: 1.4;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.mg-field textarea {
  resize: vertical;
  min-height: 92px;
}

.mg-field input::placeholder,
.mg-field textarea::placeholder {
  color: #6b7591;
}

.mg-field input[type="text"]:focus,
.mg-field textarea:focus {
  outline: none;
  border-color: var(--mg-cobalt);
  box-shadow: 0 0 0 3px rgba(30, 59, 224, 0.2);
}

.mg-field input[aria-invalid="true"] {
  border-color: var(--mg-error);
}

.mg-field__error {
  margin-top: 6px;
  color: var(--mg-error);
  font-size: 14px;
  font-weight: 500;
}

.mg-field__error:empty {
  display: none;
}

.mg-segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--mg-ice);
}

.mg-segment label {
  position: relative;
  margin: 0;
  cursor: pointer;
}

.mg-segment input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.mg-segment span {
  display: block;
  padding: 11px 8px;
  border-radius: 9px;
  color: var(--mg-ink-2);
  font-size: 15px;
  font-weight: 650;
  text-align: center;
  user-select: none;
  transition: background-color 200ms ease, color 200ms ease, box-shadow 200ms ease;
}

.mg-segment input:checked + span {
  background: #fff;
  color: var(--mg-cobalt);
  box-shadow: 0 1px 3px rgba(10, 18, 48, 0.2);
}

.mg-segment input:focus-visible + span {
  outline: 2px solid var(--mg-cobalt);
  outline-offset: 2px;
}

.mg-stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mg-stepper__btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: inset 0 0 0 1.5px rgba(10, 18, 48, 0.3);
  color: var(--mg-ink);
  font-size: 24px;
  line-height: 1;
  touch-action: manipulation;
  user-select: none;
  transition: transform 160ms var(--ease-out), opacity 200ms ease;
}

.mg-stepper__btn:active {
  transform: scale(0.94);
}

.mg-stepper__btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.mg-stepper__value {
  min-width: 56px;
  font-family: var(--mg-serif);
  font-size: 32px;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums lining-nums;
}

.mg-rsvp__done {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 16px;
}

.mg-rsvp__done:not([hidden]) {
  animation: mg-done 0.55s var(--ease-out) 0.35s both;
}

@keyframes mg-done {
  from { opacity: 0; transform: translateY(10px); }
}

.mg-rsvp__done:focus {
  outline: none;
}

.mg-rsvp__done a,
.mg-rsvp__done button {
  color: #fff;
  font-weight: 650;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
}

.mg-rsvp__done button {
  display: block;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 15px;
  text-underline-offset: 4px;
}

/* ---------- Contraportada ---------- */
.mg-back {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: min(100svh, 920px);
  overflow: hidden;
  background: var(--mg-night);
  color: #fff;
}

.mg-back__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%;
}

.mg-back__content {
  position: relative;
  width: 100%;
  padding: 160px var(--mg-gutter) calc(env(safe-area-inset-bottom) + 92px);
  background: linear-gradient(to top, rgba(10, 18, 48, 0.95) 0%, rgba(10, 18, 48, 0.75) 50%, rgba(10, 18, 48, 0));
}

.mg-back__big {
  font-family: var(--mg-serif);
  font-size: clamp(64px, 21vw, 98px);
  line-height: 0.9;
  letter-spacing: -0.03em;
}

.mg-back__date {
  margin-top: 10px;
  color: var(--mg-ice);
  font-size: 17px;
}

.mg-back__status {
  min-height: 1.4em;
  margin-top: 8px;
  color: var(--mg-ice);
  font-size: 14px;
}

.mg-barcode--back {
  width: 150px;
  margin-top: 26px;
}

/* ---------- Visor de fotos ---------- */
.mg-lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(5, 9, 26, 0.97);
  color: #fff;
  overscroll-behavior: contain;
}

.mg-lightbox::backdrop {
  background: rgba(5, 9, 26, 0.6);
}

.mg-lightbox[open] {
  display: grid;
  animation: mg-fade 0.25s ease-out;
}

@keyframes mg-fade {
  from { opacity: 0; }
}

.mg-lightbox__figure {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: center;
  gap: 12px;
  height: 100%;
  margin: 0;
  padding: calc(env(safe-area-inset-top) + 64px) 12px calc(env(safe-area-inset-bottom) + 20px);
  touch-action: pan-y;
}

.mg-lightbox__figure img {
  max-width: 100%;
  max-height: calc(100dvh - 150px);
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.mg-lightbox figcaption {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin: 0;
  color: var(--mg-ice);
  font-size: 14px;
  text-align: center;
}

.mg-lightbox__count {
  color: var(--mg-silver);
  font-variant-numeric: tabular-nums;
}

.mg-lightbox__nav,
.mg-lightbox__close {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  touch-action: manipulation;
  transition: background-color 200ms ease, transform 160ms var(--ease-out);
}

.mg-lightbox__nav:active,
.mg-lightbox__close:active {
  transform: scale(0.94);
}

.mg-lightbox__nav {
  top: 50%;
  margin-top: -24px;
  font-family: var(--mg-serif);
  font-size: 34px;
  line-height: 1;
}

.mg-lightbox__nav--prev { left: 10px; }
.mg-lightbox__nav--next { right: 10px; }

.mg-lightbox__close {
  top: calc(env(safe-area-inset-top) + 12px);
  right: 12px;
}

.mg-lightbox__close svg {
  width: 22px;
  height: 22px;
}

.mg-lightbox :focus-visible {
  outline-color: #fff;
}

@media (hover: hover) and (pointer: fine) {
  .mg-lightbox__nav:hover,
  .mg-lightbox__close:hover { background: rgba(255, 255, 255, 0.22); }
}

/* ---------- Botón de música ---------- */
.mg-music {
  position: fixed;
  z-index: 60;
  right: max(16px, calc(50% - var(--mg-width) / 2 + 16px));
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 13px;
  border: 0;
  border-radius: 999px;
  background: rgba(10, 18, 48, 0.86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  font-family: var(--mg-sans);
  font-size: 13px;
  font-weight: 650;
  box-shadow: 0 0 0 1px rgba(220, 230, 246, 0.25), 0 12px 26px -10px rgba(5, 10, 40, 0.7);
  opacity: 0;
  transform: translateY(14px);
  touch-action: manipulation;
  transition: opacity 0.4s ease-out, transform 0.6s var(--ease-out);
}

.mg-music.is-shown {
  opacity: 1;
  transform: none;
}

.mg-music:active {
  transform: scale(0.97);
  transition-duration: 160ms;
}

.mg-music:focus-visible {
  outline-color: #fff;
}

.mg-music__bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.mg-music__bars i {
  width: 3px;
  height: 4px;
  border-radius: 1px;
  background: var(--mg-ice);
}

.mg-music.is-playing .mg-music__bars i {
  animation: mg-eq 0.9s ease-in-out infinite;
}

.mg-music.is-playing .mg-music__bars i:nth-child(2) { animation-delay: 0.2s; }
.mg-music.is-playing .mg-music__bars i:nth-child(3) { animation-delay: 0.4s; }
.mg-music.is-playing .mg-music__bars i:nth-child(4) { animation-delay: 0.1s; }

@keyframes mg-eq {
  50% { height: 14px; }
}

/* ==========================================================================
   Pantallas anchas: la revista al centro, la portada sobre su propia luz
   ========================================================================== */
@media (min-width: 520px) {
  .mg-js .mg-gate::before {
    content: "";
    position: absolute;
    inset: -40px;
    background: url("https://images.unsplash.com/photo-1776143032005-2210d50940b8?auto=format&fit=crop&w=600&q=50") center / cover;
    filter: blur(36px) brightness(0.45) saturate(1.2);
    opacity: 1;
    transition: opacity 0.8s ease 0.5s;
  }

  .mg-gate.is-open::before {
    opacity: 0;
  }

  .mg-book {
    box-shadow: 0 40px 120px -20px rgba(0, 0, 0, 0.8);
  }

  .mg-gate.is-open .mg-book {
    box-shadow: none;
  }
}

@media (max-width: 360px) {
  :root { --mg-gutter: 18px; }
  .mg-title { font-size: 2.25rem; }
  .mg-timeline li { grid-template-columns: 100px 1fr; }
  .mg-timeline time { font-size: 32px; }
  .mg-album__body { grid-template-columns: 1fr; }
  .mg-cl--lead { font-size: 30px; }
  .mg-sticker { width: 84px; height: 84px; font-size: 13px; }
}

/* ==========================================================================
   Movimiento reducido: sin giros ni desplazamientos, solo fundidos breves
   (reset.css ya acorta todas las duraciones)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .mg-gate.is-open .mg-cover {
    transform: none;
  }

  .mg-cover__photo,
  .mg-js .mg-reveal .mg-develop img {
    transform: none;
  }

  .mg-open::after {
    display: none;
  }
}
