/**
 * Typewriter na nadpisech stránek (intro-letter-reveal.js).
 * Tempo: konstantní prodleva mezi znaky (--heading-char-ms), nezávislá na délce textu.
 * Odstavce zůstávají statické — bez animace.
 */

:root {
    /* ~117 ms ≈ tempo detailu článku s ~18 znaky; stejné na všech nadpisech */
    --heading-char-ms: 117;
}

.intro-typewriter__lines {
    display: block;
    min-width: 0;
    max-width: 100%;
}

.intro-typewriter__line {
    display: block;
    width: 100%;
}

.intro-typewriter__line--gap {
    height: 0.65em;
}

.intro-typewriter__track {
    display: block;
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: break-word;
    text-wrap: pretty;
}

.intro-typewriter__letter {
    display: inline;
}

.intro-typewriter__cursor {
    display: inline-block;
    width: 0.55em;
    min-width: 9px;
    height: 1.05em;
    margin-left: 1px;
    background-color: currentColor;
    vertical-align: -0.1em;
    visibility: hidden;
    animation: intro-typewriter-cursor-blink 0.9s step-end infinite;
}

.intro-typewriter--playing
    .intro-typewriter__line.is-typing
    .intro-typewriter__cursor:not(.is-after-space),
.intro-typewriter--done .intro-typewriter__line--last .intro-typewriter__cursor {
    visibility: visible;
}

@keyframes intro-typewriter-cursor-blink {
    0%,
    49% {
        opacity: 1;
    }
    50%,
    100% {
        opacity: 0;
    }
}

/* Nadpisy — jeden kurzor, řádky za sebou */
.intro-typewriter--heading .intro-typewriter__lines {
    display: inline;
}

.intro-typewriter--heading .intro-typewriter__line {
    display: inline;
    width: auto;
}

.intro-typewriter--heading .intro-typewriter__line--gap {
    display: block;
    height: 0;
}

.intro-typewriter--heading .intro-typewriter__track {
    display: inline;
    white-space: normal;
}

.page-heading.intro-typewriter--ready,
.site-page-heading.intro-typewriter--ready,
.obrlobus-section__title.intro-typewriter--ready,
.story-title.intro-typewriter--ready,
.char-alpha-index__title.intro-typewriter--ready {
    overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
    .intro-typewriter__cursor {
        display: none;
    }
}
