/* ==========================================================================
   Image-in-Text Hero — a headline whose letters are filled with a painting,
   the painting slowly panning behind them (Ken Burns). Pure CSS.
   Editorial styling, RTL-first. The text is real (accessible + SEO-friendly).
   ========================================================================== */

.image-in-text {
    --iit-ink: #1a1a1a;
    --iit-muted: #6b6b6b;
    --iit-fallback: #1a1a1a;
    box-sizing: border-box;
    width: 100%;
    background-color: #faf9f7;
    padding: 100px 20px;
    overflow: hidden;
}

.iit-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 22px;
    max-width: 1200px;
    margin: 0 auto;
}

/* The headline: painting clipped to the letter shapes */
.iit-headline {
    margin: 0;
    font-family: 'Frank Ruhl Libre', 'David Libre', Georgia, 'Times New Roman', serif;
    font-weight: 800;
    line-height: 0.96;
    /* Fluid default — big and bold so more of the painting shows.
       The typography control can override. */
    font-size: clamp(72px, 19vw, 340px);

    /* Horizontal stretch — wider letters reveal more of the painting */
    transform: scaleX(var(--iit-scalex, 1.12));
    transform-origin: center;

    background-repeat: no-repeat;
    background-position: 50% 45%;
    background-size: 125%;

    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;

    animation: iit-kenburns var(--iit-dur, 22s) ease-in-out infinite alternate;
    will-change: background-position, background-size;
}

@keyframes iit-kenburns {
    from { background-size: 125%; background-position: 38% 40%; }
    to   { background-size: 148%; background-position: 62% 60%; }
}

.iit-subtitle {
    margin: 0;
    max-width: 60ch;
    font-size: 17px;
    line-height: 1.7;
    color: var(--iit-muted);
}

/* CTA — ghost button, matching the editorial line */
.iit-cta {
    display: inline-block;
    margin-top: 6px;
    padding: 11px 26px;
    background: transparent;
    color: var(--iit-ink);
    border: 1px solid var(--iit-ink);
    border-radius: 0;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.iit-cta:hover {
    background: var(--iit-ink);
    color: #ffffff;
    text-decoration: none;
}

.iit-empty {
    padding: 20px;
    color: var(--iit-muted);
    text-align: center;
    border: 1px dashed #e5e2dd;
}

/* Fallback: browsers without background-clip:text show a solid headline */
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
    .iit-headline {
        color: var(--iit-fallback);
        -webkit-text-fill-color: currentColor;
        background: none;
        animation: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .iit-headline { animation: none; }
}
