/* ---------- Home — phone layout: How It Works (design "b": big number + render, step pill, step cards) ----------
 * Markup: components/home/mobile/hiw-m.php · Script: home-mobile-hiw-steps.js (sets is-active / is-done, the number,
 * the counter and the render). The active card's line fills over --hmh-dur; done cards show a check instead.
 */
@media (max-width: 767px) {
    .hmh { --hmh-dur: 4200ms; padding: 20px 20px 20px; }
    .hmh .hm__glow { top: 90px; left: 62%; width: 560px; height: 560px; background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0) 65%); }
    .hmh__head { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
    .hmh__title { margin: 0; font-family: var(--hm-display); font-size: 34px; line-height: 1.08; letter-spacing: -0.045em; font-weight: 600; color: #fff; }
    .hmh__title span { color: rgba(255, 255, 255, 0.42); }
    html[dir="rtl"] .hmh__title { letter-spacing: 0; line-height: 1.25; }
    .hmh__count { flex-shrink: 0; display: flex; align-items: flex-start; gap: 3px; padding-bottom: 4px; font-family: var(--hm-display); font-size: 15px; font-weight: 600; line-height: 1; color: #fff; }
    .hmh__of { font-size: 11px; font-weight: 500; color: rgba(255, 255, 255, 0.32); }

    .hmh__stage { position: relative; display: flex; align-items: center; margin-top: 28px; min-height: clamp(150px, 46vw, 179px); }
    .hmh__num {
        /* DM Sans: plain "1" without a foot; line-height 1 keeps the gradient box from clipping the glyph tops */
        position: relative; z-index: 1; display: block; margin: -0.1em 0; font-family: 'DM Sans', var(--hm-display); font-size: clamp(150px, 47vw, 196px);
        font-weight: 300; line-height: 1; letter-spacing: -0.06em; font-variant-numeric: proportional-nums;
        background: linear-gradient(180deg, #fff 0%, #d9d9de 45%, #6e6e75 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
    }
    .hmh__num.is-in { animation: hmhNum .7s var(--hm-ease) both; }
    /* One render per step (assets/images/topic-*.webp), stacked; the current step's fades and rises in. */
    .hmh__art {
        position: relative; z-index: 2; flex-shrink: 0; width: clamp(108px, 34vw, 140px); aspect-ratio: 1; margin: 22px 0 0 -9%;
        pointer-events: none; transition: margin .5s var(--hm-ease);
    }
    .hmh__art-img {
        position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none;
        filter: drop-shadow(-8px 14px 18px rgba(0, 0, 0, 0.7));
        opacity: 0; transform: translateY(10px) scale(0.9); transition: opacity .45s ease, transform .6s var(--hm-ease);
    }
    .hmh__art-img.is-active { opacity: 1; transform: none; }
    /* a trailing "1" is a thin stroke in a wide box: overlap less so the picture doesn't hide it */
    .hmh__stage.is-narrow .hmh__art { margin-left: 2%; }

    .hmh__panel { position: relative; margin-top: 24px; min-height: 96px; }
    .hmh__step.is-active { animation: hmIn .6s var(--hm-ease) both; }
    .hmh__step[hidden] { display: none; }
    .hmh__pill {
        display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 13px; padding-inline-start: 10px; border-radius: 999px;
        background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1);
        font-family: var(--hm-display); font-size: 12.5px; font-weight: 500; color: rgba(255, 255, 255, 0.88);
    }
    .hmh__pill i { font-size: 11px; color: rgba(255, 255, 255, 0.7); }
    .hmh__step-title { margin: 14px 0 0; font-family: var(--hm-display); font-size: 28px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.15; color: #fff; }
    html[dir="rtl"] .hmh__step-title { letter-spacing: 0; line-height: 1.35; }
    .hmh__step-desc { margin: 8px 0 0; font-size: 16px; line-height: 1.55; color: rgba(255, 255, 255, 0.55); text-wrap: pretty; }

    /* Step cards */
    .hmh__tabs { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 24px; }
    .hmh__tab {
        position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; padding: 12px 12px 14px;
        border-radius: 20px; border: 1px solid rgba(255, 255, 255, 0.07); background: rgba(255, 255, 255, 0.015);
        color: #fff; cursor: pointer; text-align: start; font: inherit; -webkit-tap-highlight-color: transparent;
        transition: background .35s ease, border-color .35s ease;
    }
    .hmh__tab.is-active { border-color: rgba(255, 255, 255, 0.22); background: linear-gradient(180deg, #19191c 0%, #0e0e10 100%); }
    .hmh__tab:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
    .hmh__tab-top { display: flex; align-items: center; justify-content: space-between; align-self: stretch; }
    .hmh__tab-art { width: 34px; height: 34px; object-fit: contain; pointer-events: none; user-select: none; opacity: .35; transition: opacity .35s ease, filter .35s ease; }
    .hmh__tab.is-done .hmh__tab-art { opacity: .6; }
    .hmh__tab.is-active .hmh__tab-art { opacity: 1; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.7)); }
    .hmh__tab-check { display: none; width: 18px; height: 18px; border-radius: 50%; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.7); font-size: 8px; }
    .hmh__tab.is-done .hmh__tab-check { display: flex; }
    .hmh__tab-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; max-width: 100%; }
    .hmh__tab-name { font-family: var(--hm-display); font-size: 15px; font-weight: 600; letter-spacing: -0.02em; color: rgba(255, 255, 255, 0.38); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .35s ease; }
    html[dir="rtl"] .hmh__tab-name { letter-spacing: 0; }
    .hmh__tab.is-done .hmh__tab-name { color: rgba(255, 255, 255, 0.6); }
    .hmh__tab.is-active .hmh__tab-name { color: #fff; }
    .hmh__tab-no { font-family: var(--hm-display); font-size: 11.5px; font-weight: 500; color: rgba(255, 255, 255, 0.38); }
    /* progress line along the active card's bottom edge */
    .hmh__bar { position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; border-radius: 2px; overflow: hidden; }
    .hmh__tab.is-active .hmh__bar { background: rgba(255, 255, 255, 0.12); }
    .hmh__bar::after { content: ""; position: absolute; inset: 0; background: #fff; transform-origin: left; transform: scaleX(0); }
    html[dir="rtl"] .hmh__bar::after { transform-origin: right; }
    .hmh__tab.is-active .hmh__bar::after { animation: hmhFill var(--hmh-dur) linear forwards; }
    .hmh.is-still .hmh__tab.is-active .hmh__bar::after { animation: none; transform: none; }
}
@media (max-width: 360px) {
    .hmh { padding-inline: 16px; }
    .hmh__title { font-size: 29px; }
    .hmh__step-title { font-size: 24px; }
    .hmh__step-desc { font-size: 15px; }
    .hmh__tab { padding: 10px 10px 12px; }
    .hmh__tab-name { font-size: 13.5px; }
}
@keyframes hmhNum { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes hmhFill { from { transform: scaleX(0); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
    .hmh__num.is-in, .hmh__step.is-active, .hmh__tab.is-active .hmh__bar::after { animation: none !important; }
    .hmh__tab.is-active .hmh__bar::after { transform: none; }
    .hmh__art, .hmh__art-img, .hmh__tab, .hmh__tab-art, .hmh__tab-name { transition: none !important; }
}
