/* ==========================================================================
   CARTA MAGNA — Carta digital
   ==========================================================================
   The page opens with a carousel hero that carries the old poster claims
   ("menos preguntas", "menos confusiones"…) and their head videos. Between
   slides the changing word is rebuilt letter by letter, so one word turns
   into the next while the constant "menos" stays anchored.

   Below it the five benefits are read as centred sections — the same
   eyebrow + Anton title + lede block used on Reserva de mesa — followed by
   the body copy, the four-point benefit list and the closing actions.

   It reuses the marketing tokens (styles.css), the light field and the
   pricing table (escena.css) and only adds the layer it needs.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Hero — the carousel
   --------------------------------------------------------------------------
   The display claim keeps the home hero scale (not the old fitted poster
   size), so the first screen stays clean and readable on a small laptop.
   The constant word is Rojo Magna; the changing one is rebuilt by carta.js
   letter by letter, each letter cycling the poster tones. */
.cd-hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--nav-h) + clamp(16px, 4vh, 48px)) var(--gutter) clamp(76px, 12vh, 132px);
  text-align: center;
  overflow: clip;
}
.cd-hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(16px, 2.6vh, 34px);
  width: min(100%, var(--es-shell));
}

/* The claim — two lines: the constant word on top, the reels below --------- */
.cd-hero__claim {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.02em;
  font-family: "Anton", var(--font-ui);
  font-weight: 400;
  font-size: clamp(2.2rem, 0.5rem + 7vw, 102px);
  line-height: 1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--title-a);
}
.cd-hero__const {
  display: block;
  /* Reads as selected text, exactly like the marked phrases in the section
     titles: page red under cream type. */
  background-color: transparent;
  background-image: linear-gradient(var(--magna-600), var(--magna-600));
  background-repeat: no-repeat;
  background-position: 50% 50%;
  background-size: 100% 1.15em;
  color: var(--surface-light);
}
/* The changing word is a row of reels, centred on its own line. The row keeps
   a fixed set of equal slots — one per letter of the longest word — so a reel
   never moves: a word of n letters simply lights its n middle slots. Each reel
   is one letter tall and clips a vertical strip of symbols; carta.js spins
   that strip and lands it on the incoming letter, fading reels in or out as
   the word grows or shrinks, without ever changing the layout. */
.cd-hero__var {
  display: inline-flex;
  align-items: flex-start;
  justify-content: center;
  perspective: 900px;
}
.cd-hero__reel {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  /* width is set per letter by carta.js, so each slot takes the glyph's own
     advance and the word keeps its natural letter spacing */
  width: 0;
  height: 1em;
  line-height: 1;
  vertical-align: top;
  /* clip the strip vertically without cutting the wide spinning glyphs on the
     sides; the negative insets leave the horizontal axis open */
  overflow: visible;
  -webkit-clip-path: inset(0 -0.45em);
  clip-path: inset(0 -0.45em);
  will-change: width, opacity;
}
.cd-hero__reel-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  will-change: transform;
}
.cd-hero__reel-cell {
  display: block;
  height: 1em;
  line-height: 1;
  text-align: center;
  white-space: pre;
}
.cd-hero__reel.tw--magna {
  color: var(--title-a);
}
.cd-hero__reel.tw--mar {
  color: var(--title-b);
}
.cd-hero__reel.tw--terracota {
  color: var(--title-c);
}

/* The stage — one video per slide, cross-faded and softly defocused --------- */
.cd-hero__stage {
  position: relative;
  width: 100%;
  max-width: min(1120px, 94vw);
  height: clamp(240px, 46svh, 620px);
  display: grid;
  place-items: center;
  /* A tap anywhere on the clip moves to the next slide. Suppress the mobile
     tap highlight / long-press callout, so tapping the clip shows no focus
     or selection overlay. */
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}
.cd-slide {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: scale(1.07);
  filter: blur(14px);
  transition: opacity 900ms var(--ease-imperio), transform 1100ms var(--ease-imperio),
    filter 900ms var(--ease-imperio), visibility 0s linear 900ms;
}
.cd-slide.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  filter: blur(0);
  transition: opacity 900ms var(--ease-imperio), transform 1100ms var(--ease-imperio),
    filter 900ms var(--ease-imperio), visibility 0s;
}
.cd-slide__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 34px 40px rgba(64, 38, 22, 0.28)) drop-shadow(0 8px 12px rgba(64, 38, 22, 0.16));
  /* Dissolve every side of the clip (shadow included) into the page field,
     exactly as the old Carta digital scene did. */
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 4%, #000 96%, transparent),
    linear-gradient(to bottom, transparent, #000 3%, #000 84%, rgba(0, 0, 0, 0.7) 92%, transparent);
  mask-image:
    linear-gradient(to right, transparent, #000 4%, #000 96%, transparent),
    linear-gradient(to bottom, transparent, #000 3%, #000 84%, rgba(0, 0, 0, 0.7) 92%, transparent);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

/* Controls — the progression marks, anchored to the foot of the hero, where
   the old "Descubre cómo" cue used to sit. A tap on the clip moves on, so no
   arrows are needed. ---------------------------------------------------- */
.cd-hero__controls {
  position: absolute;
  left: 50%;
  bottom: clamp(16px, 3.5vh, 40px);
  z-index: 3;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
}
.cd-hero__dots {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cd-hero__dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(78, 51, 34, 0.22);
  cursor: pointer;
  transition: background 300ms var(--ease-ola), width 360ms var(--ease-imperio);
}
.cd-hero__dot:hover,
.cd-hero__dot:focus-visible {
  background: rgba(78, 51, 34, 0.45);
}
.cd-hero__dot.is-active {
  width: 28px;
  border-radius: var(--r-pill);
  background: var(--magna-600);
}

/* --------------------------------------------------------------------------
   The centred sections
   --------------------------------------------------------------------------
   One section per benefit. The head is the same block Reserva de mesa uses:
   eyebrow, an Anton poster title painted word by word, and the lede. The body
   below pairs the copy with the four-point benefit list. */
.cd-section {
  position: relative;
  z-index: 3;
  padding-block: clamp(56px, 8vw, 112px);
}
.cd-section + .cd-section {
  border-top: 1px solid rgba(78, 51, 34, 0.1);
}
.cd-section__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 780px;
  margin: 0 auto clamp(32px, 4.6vw, 60px);
  text-align: center;
}
.cd-section__head .eyebrow {
  color: var(--magna-600);
}
.cd-title {
  margin: 0;
  font-family: "Anton", var(--font-ui);
  font-weight: 400;
  /* Same poster size as the home page <h3> rows and the Reserva titles. */
  font-size: clamp(2.2rem, 1.2rem + 4vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--title-b);
  text-wrap: balance;
}
.cd-title .tw--magna {
  color: var(--title-a);
}
.cd-title .tw--mar {
  color: var(--title-b);
}
.cd-title .tw--terracota {
  color: var(--title-c);
}
/* A marked phrase reads as selected text: the page red under cream type. */
.cd-title-mark {
  background-color: transparent;
  background-image: linear-gradient(var(--magna-600), var(--magna-600));
  background-repeat: no-repeat;
  background-position: 50% 50%;
  background-size: 100% 1.15em;
  color: var(--surface-light);
}
.cd-title-mark .tw {
  color: inherit;
}
.cd-section__lede {
  margin: 0;
  max-width: 64ch;
  font-size: var(--fs-body-l);
  line-height: 1.55;
  color: var(--text-muted);
  text-wrap: pretty;
}

/* Body — copy on one side, the benefit list on the other ------------------ */
.cd-section__body {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(28px, 5vw, 72px);
  max-width: min(1080px, 90vw);
  margin-inline: auto;
}
.cd-copy {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2vw, 22px);
}
.cd-copy p {
  margin: 0;
  font-family: var(--font-ui);
  font-size: clamp(1rem, 0.94rem + 0.3vw, 1.1875rem);
  line-height: 1.6;
  color: var(--text);
  text-wrap: pretty;
}
.cd-copy__solution {
  color: var(--text-strong);
}

.cd-feats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(18px, 2.6vw, 32px) clamp(16px, 2vw, 30px);
}
.cd-feat {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}
.cd-feat__icon {
  display: block;
  width: 22px;
  height: 22px;
  color: var(--magna-600);
}
.cd-feat__text {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  line-height: 1.3;
}
.cd-feat__text b {
  display: block;
  font-weight: 600;
  color: var(--text-strong);
}
.cd-feat__text span {
  display: block;
  color: var(--text-muted);
}

/* Actions — the same pill CTA and play link as the old scenes -------------- */
.cd-section__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(16px, 2vw, 28px);
  margin-top: clamp(32px, 5vw, 56px);
}

/* Pricing — the comparative table keeps its own (escena.css) look. It only
   gets a clear gap from the closing actions above, instead of the scene's
   own breathing room (the section head already carries the top rhythm). */
.cd-section--pricing .es-pricing {
  margin-top: clamp(40px, 6vw, 72px);
}
.cd-section--pricing .es-pricing__note {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Reveal — the heads, the copy and the cards rise as they arrive
   -------------------------------------------------------------------------- */
.cd-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 720ms var(--ease-imperio) var(--cd-delay, 0ms),
    transform 720ms var(--ease-imperio) var(--cd-delay, 0ms);
}
.cd-reveal.is-in {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .cd-section__body {
    grid-template-columns: minmax(0, 1fr);
    max-width: min(620px, 92vw);
  }
  .cd-feats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cd-section__actions {
    justify-content: center;
  }
}
@media (max-width: 560px) {
  .cd-hero__claim {
    font-size: clamp(2.4rem, 0.5rem + 11vw, 3.8rem);
  }
  .cd-section__actions .es-cta {
    width: 100%;
  }
  /* Keep the two columns on phones too; only tighten the gutters so the
     icon + label pairs still breathe. */
  .cd-feats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 12px;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion — no letter turn, no cross-fade blur, no reveal drift
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .cd-hero__reel-track {
    transition: none !important;
  }
  .cd-slide {
    transition: opacity 200ms linear, visibility 0s;
    transform: none;
    filter: none;
  }
  .cd-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
