/* "How It Works" — inline walkthrough slider for the dedicated /how-it-works
   page. Adapted from docs/how-it-works/how-it-works.css (originally a
   click-to-open modal): same dark on-brand card and screenshot frame, but
   laid out inline in the page instead of a fixed overlay, and using the
   site's actual brand colors (#F94735 red / #0f313a navy) instead of the
   draft's orange placeholder. */

:root {
    --hiw-accent: #F94735;
    --hiw-accent-2: #ff7a63;
    --hiw-accent-dark: #d6301e;
    --hiw-panel-line: rgba(255, 255, 255, 0.09);
    --hiw-gray: #9aa0a4;
    --hiw-frame-ratio: 1.5625; /* 2400 / 1536 — every step image shares this exact frame */
}

.hiw-card {
    position: relative;
    max-width: 780px;
    margin: 0 auto;
    background:
        radial-gradient(ellipse 90% 50% at 50% -10%, rgba(249, 71, 53, 0.16), transparent 60%),
        linear-gradient(165deg, #1e1b18 0%, #16130f 55%, #100e0c 100%);
    border: 1px solid var(--hiw-panel-line);
    border-radius: 26px;
    overflow: hidden;
    box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.hiw-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 26px 26px 0;
}
.hiw-progress {
    flex: 1;
    display: flex;
    gap: 6px;
}
.hiw-progress-seg {
    flex: 1;
    height: 3px;
    border-radius: 3px;
    background: var(--hiw-panel-line);
    overflow: hidden;
    position: relative;
}
.hiw-progress-seg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--hiw-accent), var(--hiw-accent-2));
    box-shadow: 0 0 8px rgba(249, 71, 53, 0.7);
    transform: scaleX(0);
    transform-origin: left;
}
.hiw-progress-seg.is-done::after { transform: scaleX(1); }
.hiw-progress-seg.is-active::after {
    animation: hiwFill var(--hiw-dur, 5s) linear forwards;
}
.hiw-card.hiw-paused .hiw-progress-seg.is-active::after {
    animation-play-state: paused;
}
@keyframes hiwFill {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.hiw-stage {
    position: relative;
    padding: 22px 26px 22px;
    perspective: 1400px;
}
.hiw-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.22, 0.9, 0.25, 1);
    touch-action: pan-y;
}
.hiw-slide {
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    transition: opacity 0.35s ease, filter 0.35s ease;
}
.hiw-slide:not(.is-current) { opacity: 0.3; filter: blur(1.5px); }

.hiw-imgwrap {
    position: relative;
    width: 100%;
    aspect-ratio: var(--hiw-frame-ratio);
    border-radius: 18px;
    overflow: hidden;
    background: #e8e9ea;
    transform-style: preserve-3d;
    transition: transform 0.28s cubic-bezier(0.22, 0.9, 0.25, 1), box-shadow 0.28s ease;
    box-shadow:
        0 2px 0 rgba(255, 255, 255, 0.5),
        0 30px 60px -20px rgba(0, 0, 0, 0.6),
        0 10px 24px -8px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(0, 0, 0, 0.06);
}
.hiw-imgwrap::before {
    /* cursor-follow glare */
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--hiw-mx, 50%) var(--hiw-my, 20%), rgba(255, 255, 255, 0.35), transparent 42%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
    z-index: 3;
    mix-blend-mode: overlay;
}
.hiw-imgwrap:hover::before { opacity: 1; }
.hiw-imgwrap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.hiw-imgwrap img.is-loaded { opacity: 1; }

.hiw-badge {
    position: absolute;
    top: 14px;
    right: 16px;
    z-index: 4;
    min-width: 42px;
    height: 25px;
    padding: 0 10px;
    border-radius: 13px;
    background: rgba(10, 11, 12, 0.8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    font-weight: 700;
    font-size: 11.5px;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
}

.hiw-caption {
    padding: 24px 30px 4px;
}
.hiw-kicker {
    display: block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.6px;
    background: linear-gradient(90deg, var(--hiw-accent), var(--hiw-accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-transform: uppercase;
    margin-bottom: 9px;
}
.hiw-caption h3 {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 800;
    color: #f5f6f7;
    letter-spacing: -0.4px;
}
.hiw-caption p {
    margin: 0;
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--hiw-gray);
    min-height: 44px;
}

.hiw-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 24px 30px;
}
.hiw-navbtn {
    border: 1px solid var(--hiw-panel-line);
    background: rgba(255, 255, 255, 0.05);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f5f6f7;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
    flex-shrink: 0;
}
.hiw-navbtn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.22); }
.hiw-navbtn:active:not(:disabled) { transform: scale(0.92); }
.hiw-navbtn:disabled { opacity: 0.3; cursor: default; }

.hiw-dots {
    display: flex;
    gap: 7px;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}
.hiw-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--hiw-panel-line);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.hiw-dot.is-active {
    background: var(--hiw-accent);
    transform: scale(1.4);
    box-shadow: 0 0 10px rgba(249, 71, 53, 0.8);
}

.hiw-cta-wrap {
    text-align: center;
    margin-top: 2.6rem;
}

@media (max-width: 600px) {
    .hiw-dots { display: none; }
    .hiw-caption h3 { font-size: 19px; }
    .hiw-stage { perspective: none; }
    .hiw-imgwrap { transform: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    .hiw-imgwrap, .hiw-slide { transition: none !important; animation: none !important; }
}
