/*!
 * Leadmetrica · Intro — estilos
 * Todo va dentro de .lm-intro para no chocar con los estilos de la web.
 */

.lm-intro {
  --lm-bg: #0e0a09;
  --lm-ink: oklch(0.95 0.012 80);
  --lm-ink-2: oklch(0.83 0.012 75);
  --lm-ink-3: oklch(0.7 0.014 65);
  --lm-rule: oklch(0.95 0.012 80 / 0.2);
  --lm-ember: oklch(0.7 0.19 38);
  --lm-lime: oklch(0.92 0.19 122);
  --lm-font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --lm-out: cubic-bezier(0.16, 1, 0.3, 1);
  --lm-pad: clamp(16px, 3vw, 44px);

  /* Escala z interna */
  --lm-z-canvas: 0;
  --lm-z-stage: 1;
  --lm-z-chrome: 2;

  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--lm-bg);
  color: var(--lm-ink);
  font-family: var(--lm-font);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

.lm-intro.is-hidden { visibility: hidden; }

.lm-intro-spacer {
  height: 100vh;
  height: 100svh;
  pointer-events: none;
}

.lm-canvas {
  position: absolute;
  inset: 0;
  z-index: var(--lm-z-canvas);
  display: block;
  width: 100%;
  height: 100%;
}

.lm-stage {
  position: absolute;
  inset: 0;
  z-index: var(--lm-z-stage);
  pointer-events: none;
}

/* ----------------------------------------------------------------- cabecera */
.lm-top,
.lm-bottom {
  position: absolute;
  left: var(--lm-pad);
  right: var(--lm-pad);
  z-index: var(--lm-z-chrome);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.lm-top { top: var(--lm-pad); }
.lm-bottom { bottom: var(--lm-pad); align-items: flex-end; }

.lm-brand {
  font-size: 15px;
  font-weight: 620;
  font-stretch: 112%;
  letter-spacing: 0.005em;
  color: var(--lm-ink);
}
.lm-brand sup {
  font-size: 0.6em;
  font-weight: 400;
  margin-left: 1px;
  color: var(--lm-ink-3);
}

.lm-btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--lm-rule);
  border-radius: 999px;
  background: oklch(0.2 0.01 45 / 0.45);
  color: var(--lm-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 460;
  font-stretch: 104%;
  letter-spacing: 0.01em;
  cursor: pointer;
  pointer-events: auto;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: border-color 200ms var(--lm-out), background-color 200ms var(--lm-out), transform 120ms var(--lm-out);
}
.lm-btn:hover { border-color: oklch(0.95 0.012 80 / 0.45); background: oklch(0.24 0.012 45 / 0.6); }
.lm-btn:active { transform: scale(0.97); }
.lm-btn:focus-visible { outline: 2px solid var(--lm-lime); outline-offset: 3px; }

/* Ecualizador del botón de sonido */
.lm-eq {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  width: 16px;
  height: 14px;
}
.lm-eq i {
  display: block;
  width: 2px;
  height: 13px;
  border-radius: 1px;
  background: currentColor;
  transform: scaleY(0.16);
  transition: transform 300ms var(--lm-out);
}
.lm-sound[aria-pressed="true"] .lm-eq i { animation: lm-eq 1.1s ease-in-out infinite alternate; }
.lm-sound[aria-pressed="true"] .lm-eq i:nth-child(2) { animation-delay: -0.35s; animation-duration: 0.9s; }
.lm-sound[aria-pressed="true"] .lm-eq i:nth-child(3) { animation-delay: -0.7s; animation-duration: 1.3s; }
.lm-sound[aria-pressed="true"] .lm-eq i:nth-child(4) { animation-delay: -0.2s; animation-duration: 1s; }
@keyframes lm-eq {
  from { transform: scaleY(0.22); }
  to { transform: scaleY(1); }
}
.lm-sound[aria-pressed="true"] { border-color: oklch(0.92 0.19 122 / 0.5); }
.lm-sound[aria-pressed="true"] .lm-eq { color: var(--lm-lime); }

.lm-sound-hint {
  position: absolute;
  top: calc(100% + 10px);
  right: 4px;
  font-size: 12px;
  color: var(--lm-ink-3);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 600ms var(--lm-out);
}
.lm-sound-wrap { position: relative; }
.lm-sound-wrap.show-hint .lm-sound-hint { opacity: 1; }

/* ------------------------------------------------------------------ pie */
.lm-chapter {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  font-weight: 460;
  font-stretch: 100%;
  color: var(--lm-ink-2);
  font-variant-numeric: tabular-nums;
}
.lm-chapter__num {
  min-width: 2.4ch;
  font-weight: 640;
  font-stretch: 116%;
  color: var(--lm-ink);
}
.lm-chapter__name { min-width: 6ch; }
.lm-track {
  position: relative;
  width: clamp(64px, 9vw, 128px);
  height: 1px;
  background: var(--lm-rule);
  overflow: hidden;
}
.lm-track i {
  position: absolute;
  inset: 0;
  background: var(--lm-ink);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.lm-time { min-width: 5ch; color: var(--lm-ink-3); }
.lm-time.is-infinite { color: var(--lm-lime); font-size: 15px; line-height: 12px; }

.lm-skip svg { width: 12px; height: 12px; }

/* ------------------------------------------------------------ narración */
.lm-narr {
  position: absolute;
  left: 0;
  right: 0;
  bottom: clamp(104px, 16.5vh, 196px);
  display: grid;
  padding: 0 20px;
  text-align: center;
}
.lm-line {
  grid-area: 1 / 1;
  justify-self: center;
  align-self: end;
  margin: 0;
  max-width: 26ch;
  font-size: clamp(23px, 3.05vw, 50px);
  font-weight: 260;
  font-stretch: 116%;
  line-height: 1.14;
  letter-spacing: -0.012em;
  text-wrap: balance;
  color: var(--lm-ink);
}
.lm-line .w {
  display: inline-block;
  opacity: 0;
  will-change: transform, opacity, filter;
}
.lm-line em {
  font-style: normal;
  font-weight: 460;
  color: var(--lm-tone, var(--lm-ink));
}
.lm-line[data-tone="ember"] { --lm-tone: var(--lm-ember); }
.lm-line[data-tone="lime"] { --lm-tone: var(--lm-lime); }
.lm-line[data-tone="ivory"] { --lm-tone: oklch(0.99 0.01 85); }

/* ------------------------------------------------------------ épocas */
.lm-era {
  position: absolute;
  left: var(--lm-pad);
  top: 44%;
  transform: translateY(-50%);
  opacity: 0;
}
.lm-era__year {
  display: flex;
  align-items: flex-start;
  gap: 0.14em;
  font-size: clamp(40px, 5.4vw, 88px);
  font-weight: 180;
  font-stretch: 118%;
  line-height: 0.95;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--lm-ink);
}
.lm-era__pre,
.lm-era__suf {
  margin-top: 0.3em;
  font-size: 0.24em;
  font-weight: 420;
  font-stretch: 104%;
  letter-spacing: 0.01em;
  color: var(--lm-ink-2);
}
.lm-era__pre:empty,
.lm-era__suf:empty { display: none; }
.lm-era__name {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 14px;
  font-weight: 440;
  font-stretch: 104%;
  color: var(--lm-ink-2);
}
.lm-era__name::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--lm-ember);
}
.lm-era.is-today .lm-era__name::before { background: var(--lm-lime); }

/* ------------------------------------------------ etiquetas de tareas */
.lm-task {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 10px;
  border: 1px solid var(--lm-rule);
  border-radius: 999px;
  background: oklch(0.16 0.01 45 / 0.55);
  font-size: 12.5px;
  font-weight: 450;
  font-stretch: 100%;
  white-space: nowrap;
  color: var(--lm-ink);
  opacity: 0;
  will-change: transform, opacity;
}
.lm-task__cost {
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  color: var(--lm-ember);
  transition: color 400ms var(--lm-out), opacity 400ms var(--lm-out);
}
.lm-task__cost s { text-decoration-thickness: 1px; text-decoration-color: transparent; transition: text-decoration-color 300ms var(--lm-out); }
.lm-task__auto {
  display: none;
  font-weight: 620;
  color: var(--lm-lime);
}
.lm-task.is-auto { border-color: oklch(0.92 0.19 122 / 0.35); }
.lm-task.is-auto .lm-task__cost { color: var(--lm-ink-3); }
.lm-task.is-auto .lm-task__cost s { text-decoration-color: currentColor; }
.lm-task.is-auto .lm-task__auto { display: inline; }

/* ------------------------------------------ anotación "cuello de botella" */
.lm-annot { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lm-annot path { fill: none; stroke: var(--lm-ember); stroke-width: 1; }
.lm-annot circle { fill: var(--lm-ember); }
.lm-annot__label {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 13px;
  font-weight: 480;
  font-stretch: 104%;
  white-space: nowrap;
  color: var(--lm-ink);
  opacity: 0;
}
.lm-annot__label span { position: relative; }
.lm-annot__label span::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  top: 55%;
  height: 1.5px;
  background: var(--lm-lime);
  transform-origin: 0 50%;
  transform: scaleX(var(--strike, 0));
}

/* --------------------------------------------------------------- final */
.lm-final {
  position: absolute;
  left: 0;
  right: 0;
  bottom: clamp(96px, 15vh, 180px);
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 0 20px;
  text-align: center;
  opacity: 0;
}
.lm-final__mark {
  margin: 0;
  font-size: clamp(34px, 4.6vw, 68px);
  font-weight: 560;
  font-stretch: 118%;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--lm-ink);
}
.lm-final__claim {
  margin: 0;
  font-size: clamp(14px, 1.2vw, 17px);
  font-weight: 400;
  font-stretch: 106%;
  color: var(--lm-ink-2);
}

.lm-cue {
  position: absolute;
  left: 50%;
  bottom: var(--lm-pad);
  z-index: var(--lm-z-chrome);
  display: grid;
  justify-items: center;
  gap: 10px;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 460;
  color: var(--lm-ink-2);
  opacity: 0;
  pointer-events: none;
}
.lm-cue i {
  position: relative;
  display: block;
  width: 1px;
  height: 36px;
  background: var(--lm-rule);
  overflow: hidden;
}
.lm-cue i::after {
  content: "";
  position: absolute;
  left: 0;
  top: -40%;
  width: 1px;
  height: 40%;
  background: var(--lm-ink);
  animation: lm-cue 2.2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes lm-cue {
  from { transform: translateY(0); }
  to { transform: translateY(350%); }
}

.lm-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------ sin WebGL2: versión estática */
.lm-intro.is-static .lm-canvas {
  background:
    radial-gradient(60% 50% at 50% 42%, oklch(0.24 0.03 45) 0%, transparent 70%),
    var(--lm-bg);
}
.lm-intro.is-static .lm-final,
.lm-intro.is-static .lm-cue { opacity: 1; }
.lm-intro.is-static .lm-bottom .lm-chapter { visibility: hidden; }

/* -------------------------------------------------------------- móvil */
@media (max-width: 720px) {
  .lm-line { font-size: clamp(21px, 6.2vw, 30px); max-width: 20ch; }
  .lm-narr { bottom: clamp(92px, 17vh, 150px); }
  .lm-era { top: calc(var(--lm-pad) + 64px); transform: none; }
  .lm-era__year { font-size: clamp(34px, 11vw, 52px); }
  .lm-era__name { margin-top: 8px; font-size: 13px; }
  .lm-track { display: none; }
  .lm-chapter { gap: 10px; }
  .lm-task { font-size: 11.5px; padding: 4px 9px; }
  .lm-btn { min-height: 38px; padding: 0 13px; font-size: 12.5px; }
  .lm-final { bottom: clamp(150px, 20vh, 190px); }
  .lm-cue { bottom: calc(var(--lm-pad) + 58px); }
}

@media (max-width: 380px) {
  .lm-sound .lm-sound__label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .lm-sound[aria-pressed="true"] .lm-eq i { animation: none; transform: scaleY(0.7); }
  .lm-cue i::after { animation: none; top: 30%; }
  .lm-btn { transition: none; }
}
