/* ===================================================================
   Hero demo: a sample run of the editor under the hero.
   The card's size is fixed so nothing moves around it while it plays.
   =================================================================== */
body.hp-ui .hp-demo { padding-block: 30px 96px; }
body.hp-ui .hp-demo-in { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: 64px; align-items: center; }
body.hp-ui .hp-demo-copy h2 { margin: 0; font-size: clamp(2.3rem, 4vw, 3.4rem) !important; color: var(--hx-ink); text-wrap: balance; }
body.hp-ui .hp-demo-lede { margin: 18px 0 0; color: var(--hx-ink-2); font-size: 1.06rem; line-height: 1.65; max-width: 42ch; }
body.hp-ui .hp-demo-note { margin: 22px 0 0; padding-top: 14px; border-top: 1px solid var(--hx-line); color: var(--hx-ink-3); font-size: .84rem; max-width: 42ch; }

body.hp-ui .hp-demo-card {
    position: relative; margin: 0; height: 412px; display: flex; flex-direction: column;
    background: var(--hx-surface); border: 1px solid var(--hx-line); border-radius: 28px;
    box-shadow: var(--hx-shadow-lg); overflow: hidden;
}
body.hp-ui .hp-demo-card::before {
    content: ""; position: absolute; inset: 0 0 auto; height: 3px; pointer-events: none;
    background: linear-gradient(90deg, var(--hx-royal), var(--hx-quill));
}
body.hp-ui .hp-demo-screen { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: 22px 22px 0; }
body.hp-ui .hp-demo-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
body.hp-ui .hp-demo-modes { display: flex; gap: 6px; flex-wrap: wrap; }
body.hp-ui .hp-demo-chip {
    padding: 7px 13px; border-radius: 999px; border: 1px solid var(--hx-line); background: var(--hx-surface);
    color: var(--hx-ink-2); font-size: .8rem; font-weight: 700; line-height: 1.1;
    transition: background-color .3s ease, color .3s ease, border-color .3s ease;
}
body.hp-ui .hp-demo-chip.is-on { background: var(--hx-royal); border-color: transparent; color: #fff; }
body.hp-ui .hp-demo-chip.is-tap { animation: hpDemoTap .32s var(--hx-ease); }
body.hp-ui .hp-demo-tag {
    flex: none; padding: 5px 10px; border-radius: 999px; background: var(--hx-quill-soft); color: var(--hx-quill-ink);
    font-size: .74rem; font-weight: 700;
}

body.hp-ui .hp-demo-text {
    position: relative; overflow: hidden; flex: 1 1 auto; min-height: 0;
    padding: 18px 20px; border-radius: 18px; background: var(--hx-surface-2); border: 1px solid var(--hx-line);
    transition: opacity .4s ease;
}
body.hp-ui .hp-demo-text p { margin: 0; color: var(--hx-ink); font-size: 1.2rem; line-height: 1.7; text-align: left; }
body.hp-ui .hp-demo-text.is-out { opacity: 0; }
body.hp-ui .hp-demo-after { position: absolute; inset: 18px 20px auto; clip-path: inset(0 100% 0 0); }
body.hp-ui .hp-demo:not(.is-live) .hp-demo-after { display: none; }
body.hp-ui .hp-demo.is-live .hp-demo-w { opacity: 0; transition: opacity .16s ease; }
body.hp-ui .hp-demo.is-live .hp-demo-w.is-on { opacity: 1; }
body.hp-ui .hp-demo-seg { border-radius: 3px; transition: background-size .9s ease, color .6s ease; background: linear-gradient(transparent 58%, rgba(214, 194, 148, .7) 58%) no-repeat 0 0 / 0 100%; }
body.hp-ui .hp-demo-seg.is-new { animation: hpDemoIn .42s var(--hx-ease); background-size: 100% 100%; color: #5f4118; }
body.hp-ui .hp-demo-seg.is-settled { background-size: 100% 100%; background-image: linear-gradient(transparent 92%, rgba(184, 137, 74, .45) 92%); color: inherit; }
body.hp-ui .hp-demo-scan {
    position: absolute; top: -12%; bottom: -12%; left: 0; width: 2px; opacity: 0; pointer-events: none;
    background: var(--hx-quill); box-shadow: 0 0 0 .5px rgba(240, 214, 170, .7);
    transition: opacity .2s ease;
}
body.hp-ui .hp-demo-scan::before {
    content: ""; position: absolute; inset-block: 0; right: 100%; width: 110px;
    background: linear-gradient(90deg, transparent, rgba(15, 69, 54, .07) 55%, rgba(184, 137, 74, .26));
}
body.hp-ui .hp-demo-scan.is-on { opacity: 1; }

body.hp-ui .hp-demo-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
body.hp-ui .hp-demo-slider { display: flex; align-items: center; gap: 12px; min-width: 0; font-size: .82rem; }
body.hp-ui .hp-demo-slider-label { color: var(--hx-ink); font-weight: 700; }
body.hp-ui .hp-demo-slider-value { color: var(--hx-quill-ink); font-weight: 700; min-width: 6.5em; }
body.hp-ui .hp-demo-track {
    --hp-demo-at: 50%; position: relative; flex: none; width: 112px; height: 4px; border-radius: 9px;
    background: linear-gradient(90deg, var(--hx-royal) var(--hp-demo-at), var(--hx-line-2) var(--hp-demo-at));
    transition: --hp-demo-at .6s var(--hx-ease);
}
body.hp-ui .hp-demo-track i {
    position: absolute; top: 50%; left: var(--hp-demo-at); width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
    background: var(--hx-royal); border: 3px solid var(--hx-surface); box-shadow: 0 0 0 1px var(--hx-line-2);
    transition: left .6s var(--hx-ease);
}
[dir="rtl"] body.hp-ui .hp-demo-track { transform: scaleX(-1); }
body.hp-ui .hp-demo-run {
    display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 14px;
    background: var(--hx-royal); color: #fff; font-size: .88rem; font-weight: 700; white-space: nowrap;
    box-shadow: 0 10px 22px -12px rgba(15, 69, 54, .9); transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
}
body.hp-ui .hp-demo-run svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
body.hp-ui .hp-demo-run.is-press { transform: scale(.95); background: var(--hx-royal-hover); box-shadow: 0 4px 10px -6px rgba(15, 69, 54, .9); }

body.hp-ui .hp-demo-stats { display: flex; flex-wrap: wrap; gap: 6px 22px; min-height: 22px; font-size: .84rem; color: var(--hx-ink-2); opacity: 0; transition: opacity .35s ease; }
body.hp-ui .hp-demo:not(.is-live) .hp-demo-stats, body.hp-ui .hp-demo-stats.is-in { opacity: 1; }
body.hp-ui .hp-demo-stat { display: inline-flex; align-items: center; gap: 7px; }
body.hp-ui .hp-demo-stat b { color: var(--hx-ink); font-variant-numeric: tabular-nums; min-width: 1.4em; }
body.hp-ui .hp-demo-arrow { width: 14px; height: 14px; fill: none; stroke: var(--hx-quill); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] body.hp-ui .hp-demo-arrow { transform: scaleX(-1); }

body.hp-ui .hp-demo-foot { flex: none; display: flex; align-items: center; gap: 16px; padding: 14px 22px 16px; }
body.hp-ui .hp-demo-progress { flex: 1 1 auto; display: flex; gap: 6px; }
body.hp-ui .hp-demo-progress i { flex: 1 1 0; height: 3px; border-radius: 3px; background: var(--hx-line); overflow: hidden; }
body.hp-ui .hp-demo-progress b { display: block; height: 100%; background: var(--hx-quill); transform: scaleX(0); transform-origin: 0 50%; }
[dir="rtl"] body.hp-ui .hp-demo-progress b { transform-origin: 100% 50%; }
body.hp-ui .hp-demo-toggle {
    flex: none; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px 0 11px; border-radius: 999px;
    border: 1px solid var(--hx-line-2); background: var(--hx-surface); color: var(--hx-ink); font: 700 .8rem/1 var(--hx-f-body); cursor: pointer;
}
body.hp-ui .hp-demo-toggle[hidden] { display: none; }
body.hp-ui .hp-demo-toggle:hover { border-color: var(--hx-quill); }
body.hp-ui .hp-demo-toggle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
body.hp-ui .hp-demo-i-play, body.hp-ui .hp-demo-toggle.is-play .hp-demo-i-pause { display: none; }
body.hp-ui .hp-demo-toggle.is-play .hp-demo-i-play { display: block; fill: currentColor; }
body.hp-ui .hp-demo:not(.is-live) .hp-demo-progress { visibility: hidden; }

/* Before/after: read by screen readers, shown instead of the run with reduced motion */
body.hp-ui .hp-demo-static, body.hp-ui .hp-demo-sr {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
body.hp-ui .hp-demo-col-label { margin: 0 0 8px; font-size: .78rem; font-weight: 700; color: var(--hx-quill-ink); }
body.hp-ui .hp-demo-col p:last-child { margin: 0; font-size: .98rem; line-height: 1.7; color: var(--hx-ink); text-align: left; }
body.hp-ui .hp-demo-col del { color: var(--hx-ink-3); text-decoration-color: var(--hx-quill); }
body.hp-ui .hp-demo-col mark { color: inherit; background: linear-gradient(transparent 58%, rgba(214, 194, 148, .7) 58%); }

@keyframes hpDemoIn { from { opacity: .15; filter: blur(3px); } to { opacity: 1; filter: none; } }
@keyframes hpDemoTap { 50% { transform: scale(.94); } }

html[data-hp-theme="dark"] body.hp-ui .hp-demo-seg.is-new { color: #f3dcae; }
html[data-hp-theme="dark"] body.hp-ui :is(.hp-demo-seg, .hp-demo-col mark) { background-image: linear-gradient(transparent 58%, rgba(217, 178, 119, .32) 58%); }
html[data-hp-theme="dark"] body.hp-ui .hp-demo-seg.is-settled { background-image: linear-gradient(transparent 92%, rgba(217, 178, 119, .5) 92%); }
html[data-hp-theme="dark"] body.hp-ui .hp-demo-chip.is-on { background: var(--hx-royal); }
html[lang="ar"] body.hp-ui .hp-demo-copy h2 { line-height: 1.3 !important; }

@media (max-width: 980px) {
    body.hp-ui .hp-demo { padding-block: 64px 76px; }
    body.hp-ui .hp-demo-in { grid-template-columns: 1fr; gap: 30px; }
}
@media (max-width: 560px) {
    body.hp-ui .hp-demo { padding-block: 52px 64px; }
    body.hp-ui .hp-demo-in { padding-inline: 12px; }
    body.hp-ui .hp-demo-card { height: 488px; border-radius: 24px; }
    body.hp-ui .hp-demo-screen { padding: 18px 14px 0; gap: 12px; }
    body.hp-ui .hp-demo-text { padding: 14px 16px; }
    body.hp-ui .hp-demo-after { inset: 14px 16px auto; }
    body.hp-ui .hp-demo-text p { font-size: .98rem; }
    body.hp-ui .hp-demo-controls { flex-wrap: wrap; gap: 12px; }
    body.hp-ui .hp-demo-run { flex: 1 1 100%; justify-content: center; }
    body.hp-ui .hp-demo-foot { padding: 12px 14px 14px; }
    body.hp-ui .hp-demo-chip { padding: 6px 11px; font-size: .76rem; }
}

@media (prefers-reduced-motion: reduce) {
    body.hp-ui .hp-demo-screen, body.hp-ui .hp-demo-foot { display: none; }
    body.hp-ui .hp-demo-card { height: auto; }
    body.hp-ui .hp-demo-static {
        position: static; width: auto; height: auto; overflow: auto; clip-path: none; white-space: normal;
        flex: 1 1 auto; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr auto; gap: 14px; padding: 26px 22px 20px;
    }
    body.hp-ui .hp-demo-static-stats { grid-column: 1 / -1; margin: 0; padding-inline: 4px; }
    body.hp-ui .hp-demo-col { padding: 16px 18px; border-radius: 18px; background: var(--hx-surface-2); border: 1px solid var(--hx-line); }
    body.hp-ui .hp-demo-col.is-after { border-color: color-mix(in srgb, var(--hx-quill) 45%, var(--hx-line)); }
}
@media (prefers-reduced-motion: reduce) and (max-width: 560px) {
    body.hp-ui .hp-demo-static { grid-template-columns: 1fr; grid-template-rows: auto auto auto; padding: 18px 14px 16px; }
}
