/* Mask-revealed text: carved -> lit by fire (SPEC §7, DESIGN §2.4). Owner: fe-cave.
   Default (no JS, reduced motion, failure): everything visible and lit. Masks exist only under html.reveal-masks. */

html.js:not(.reveal-ready) [data-reveal] {
  opacity: 0;
  animation: reveal-failsafe 0s 3s forwards;
}
@keyframes reveal-failsafe {
  to { opacity: 1; }
}

/* SplitText lines hug their text so the mask sweep matches the words, not the column. */
.mline { width: fit-content; max-width: 100%; }
.mword, .mchar { display: inline-block; }

/* Recipe A: relief (fractured rock edge). Recipe B: trazo (dry brush edge). */
html.reveal-masks .reveal-relief:not(.is-revealed) .mline,
html.reveal-masks .reveal-relief.reveal-block:not(.is-revealed) {
  -webkit-mask-image: url(/assets/img/masks/relief-edge.webp);
  mask-image: url(/assets/img/masks/relief-edge.webp);
}
html.reveal-masks .reveal-trazo:not(.is-revealed) .mline,
html.reveal-masks .reveal-trazo.reveal-block:not(.is-revealed) {
  -webkit-mask-image: url(/assets/img/masks/brush-edge.webp);
  mask-image: url(/assets/img/masks/brush-edge.webp);
}
html.reveal-masks :is(.reveal-relief, .reveal-trazo):not(.is-revealed) .mline,
html.reveal-masks :is(.reveal-relief, .reveal-trazo).reveal-block:not(.is-revealed) {
  -webkit-mask-size: 320% 100%;
  mask-size: 320% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: var(--mx, 100%) 0;
  mask-position: var(--mx, 100%) 0;
}

/* Carved state of plain (non-gradient) lines: ghost ink with a lit lower lip. */
html.reveal-masks :is(.reveal-relief, .reveal-trazo):not(.is-revealed):not(.reveal-grad) .mline {
  color: var(--carved-ink, #8A715A);
  text-shadow: var(--carved-shadow);
}

/* Gradient display text: the gradient travels with each line (set inline by reveal.js). */
.reveal-grad .mline {
  -webkit-text-fill-color: transparent;
}
.reveal-grad.is-revealed {
  filter: var(--display-glow);
}

/* ---- The legend (SPEC-v2 §7.2) ---- */
/* The refrain: «toma el fuego y repártelo», once in the cave (b9); the opening text and the bonfire carry the other two. */
.refrain {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 340;
  font-style: italic;
  font-size: var(--fs-h2);
  line-height: 1.1;
  letter-spacing: -.01em;
  text-wrap: balance;
}
.refrain--2 {
  background: var(--grad-fire-text);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  padding-bottom: .08em;
}
.refrain--2.is-revealed { filter: drop-shadow(0 0 .3em rgba(217, 84, 26, .45)); }
.refrain .mline { padding-bottom: .08em; }
.refrain--2 + .trazo-line path { stroke: #D9541A; }

.cave-statement--md { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.5rem); }
/* "han sido olvidadas": fades to bone after it is read (cave.js); reduced / no JS: final colour */
html:not(.is-cave) .lg-line--fading { color: var(--bone-400); }
/* "estarás completamente solo": kaolin, no warm halo — only the legibility layer */
.lg-cold { color: #D8CBB4; }
.station__text .lg-cold { text-shadow: var(--legible-shadow); }

/* Painted underline companion of trazo titles. */
.trazo-line {
  display: block;
  width: clamp(8rem, 40%, 16rem);
  height: auto;
  margin-top: 0.35em;
  overflow: visible;
}
.trazo-line path,
.trazo-line line,
.trazo-line polyline {
  fill: none;
  stroke: #9E3B1F;
  stroke-width: 6px;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
@media not all and (min-width: 768px) and (min-aspect-ratio: 1/1) {
  .trazo-line path,
  .trazo-line line,
  .trazo-line polyline { stroke-width: 4px; }
}
