/* =========================================================
   PORTADA · monograma MD monumental
   Variables dinámicas (JS):  --p  progreso de scroll 0→1
                               --px / --py  puntero -1→1
   El monograma se corta con el borde, como en la portada
   original del PDF, y se abre al hacer scroll.
   ========================================================= */

.cover {
  --mono-h: min(128svh, 80vw); /* el contraespacio de la D siempre queda dentro de la pantalla */
  --mono-x: 3vw;
  --mono-y: -14svh;
  position: relative;
  height: 190svh;
}
.cover__pin {
  position: sticky; top: 0;
  height: 100svh; overflow: hidden;
}

/* --- Monograma: dos piezas que se separan --- */
.mono { position: absolute; inset: 0; pointer-events: none; }
.mono svg {
  position: absolute; display: block;
  height: var(--mono-h);
  width: calc(var(--mono-h) * 1.259);
  left: var(--mono-x); top: var(--mono-y);
  fill: currentColor;
  will-change: transform;
  /* las piezas se desvanecen mientras aparece la frase del puente */
  opacity: clamp(0, calc((0.8 - var(--p, 0)) * 3.2), 1);
}
.mono__a {
  transform:
    translate3d(
      calc(var(--px, 0) * -1.4vw + var(--p, 0) * -46vw),
      calc(var(--py, 0) * -1vh + var(--p, 0) * -10svh), 0)
    rotate(calc(var(--p, 0) * -5deg));
  transform-origin: 20% 60%;
}
.mono__b {
  transform:
    translate3d(
      calc(var(--px, 0) * 1.4vw + var(--p, 0) * 42vw),
      calc(var(--py, 0) * 1vh + var(--p, 0) * 12svh), 0)
    rotate(calc(var(--p, 0) * 6deg));
  transform-origin: 70% 60%;
}

/* --- Textos --- */
.cover__label,
.cover__role, .cover__quote, .cover__cta {
  font-size: .72rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
}
.cover__label {
  position: absolute; right: var(--margin); top: calc(var(--header-h) + 1.6rem);
}
.cover__id {
  position: absolute; left: max(9vw, 4.6rem); bottom: 7svh;
}
.cover__name {
  font-weight: 400; text-transform: uppercase;
  font-size: clamp(1.5rem, 2.7vw, 2.7rem); line-height: 1.05; letter-spacing: .05em;
}
.cover__name span { display: block; }
.cover__role {
  margin-top: .9rem; opacity: .6; font-weight: 400;
  letter-spacing: .02em; text-transform: none; font-size: clamp(.85rem, 1.05vw, 1rem); line-height: 1.4;
}
.cover__quote {
  /* anclado al contraespacio de la D (a 0,60 del ancho del logotipo) */
  position: absolute; top: 49svh;
  left: calc(var(--mono-x) + var(--mono-h) * 1.259 * 0.6 + 1.4rem);
  width: clamp(11rem, calc(var(--mono-h) * 1.259 * 0.33 - 2rem), 16rem);
  font-weight: 400; letter-spacing: 0; text-transform: none; font-size: .95rem; line-height: 1.5;
}
.cover__cta {
  /* alineado con la cita, dentro del contraespacio de la D */
  position: absolute; left: calc(var(--mono-x) + var(--mono-h) * 1.259 * 0.6 + 1.4rem); top: calc(49svh + 8.4rem);
  display: flex; align-items: center; gap: 1rem;
}
.cover__cta-line { display: block; width: 3.4rem; height: 1px; background: currentColor; transform-origin: left; animation: cue 2.6s var(--ease-in-out) infinite; }
@keyframes cue { 0%, 100% { transform: scaleX(.3); } 50% { transform: scaleX(1); } }

/* texto que desaparece según se abre el monograma */
.cover__label, .cover__id, .cover__quote, .cover__cta {
  opacity: max(0, calc(1 - var(--p, 0) * 2.6));
}

/* --- Puente narrativo --- */
.cover__bridge {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  padding: 0 var(--margin);
  font-weight: 300; letter-spacing: -.03em; line-height: 1.05;
  font-size: clamp(2rem, 6.2vw, 6.4rem);
  opacity: clamp(0, calc((var(--p, 0) - .42) * 3.2), 1);
  transform: translateY(calc((1 - var(--p, 0)) * 6vh));
  pointer-events: none;
}

/* --- Entrada (solo con JS) --- */
.js .mono__a { clip-path: inset(0 0 100% 0); }
.js .mono__b { clip-path: inset(0 100% 0 0); }
.js .cover__label, .js .cover__id, .js .cover__quote, .js .cover__cta { translate: 0 14px; }
.js.is-ready .mono__a { animation: reveal-down 1.7s var(--ease-in-out) .1s both; }
.js.is-ready .mono__b { animation: reveal-right 1.7s var(--ease-in-out) .35s both; }
.js.is-ready .cover__label, .js.is-ready .cover__id,
.js.is-ready .cover__quote, .js.is-ready .cover__cta {
  animation: rise 1.1s var(--ease-out) both;
}
.js.is-ready .cover__id    { animation-delay: 1.15s; }
.js.is-ready .cover__quote { animation-delay: 1.35s; }
.js.is-ready .cover__label { animation-delay: 1.5s; }
.js.is-ready .cover__cta   { animation-delay: 1.65s; }
.js:not(.is-ready) .cover__label, .js:not(.is-ready) .cover__id,
.js:not(.is-ready) .cover__quote, .js:not(.is-ready) .cover__cta { visibility: hidden; }

@keyframes reveal-down  { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes reveal-right { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes rise { from { translate: 0 14px; opacity: 0; } to { translate: 0 0; } }

/* --- Pantallas verticales: el monograma se encuadra más abierto --- */
@media (max-aspect-ratio: 5/6) {
  .cover { --mono-h: min(112vw, 64svh); --mono-x: -26vw; --mono-y: 9svh; }
  .cover__id { left: var(--margin); bottom: 6svh; }
  .cover__quote { left: var(--margin); top: calc(9svh + var(--mono-h) + 1.2rem); width: min(70vw, 18rem); font-size: .9rem; }
  .cover__label { top: calc(var(--header-h) + .6rem); }
  .cover__cta { left: auto; right: var(--margin); top: auto; bottom: calc(6svh + .4rem); }
  .cover__cta-line { width: 2rem; }
}

/* --- Movimiento reducido: sin pin ni separación --- */
@media (prefers-reduced-motion: reduce) {
  .cover { height: 100svh; }
  .cover__bridge { display: none; }
  .cover__label, .cover__id, .cover__quote, .cover__cta { opacity: 1; }
  .cover__cta-line { animation: none; }
}

/* Búlgaro: la frase del puente es más larga; se equilibran las líneas para evitar palabras sueltas */
html:lang(bg) .cover__bridge { text-wrap: balance; }
