/* ============================================================
   Stokaro — Hero product-demo animation
   ============================================================ */

.hero-demo {
    --demo-panel-w: 520px;
    position: relative;
    width: 100%;
    max-width: var(--demo-panel-w);
    margin: 0 auto;
    perspective: 1000px;
    isolation: isolate;
    z-index: 1;
}

.hero-demo__glow {
    position: absolute;
    inset: -18%;
    background:
        radial-gradient(
            circle at 55% 45%,
            rgba(127, 189, 35, 0.18),
            transparent 55%
        );
    filter: blur(44px);
    pointer-events: none;
    z-index: -1;
}

.hero-demo__panel {
    position: relative;
    width: 100%;
    max-width: var(--demo-panel-w);
    margin: 0 auto;
    aspect-ratio: 16 / 10;
    min-height: 220px;
    display: flex;
    background: var(--stk-surface, #ffffff);
    border: 1px solid var(--stk-border, #dfe6dc);
    border-radius: 20px;
    box-shadow: var(--stk-shadow-lg, 0 30px 80px rgba(25, 55, 25, 0.12));
    overflow: hidden;
    transform-style: preserve-3d;
    will-change: transform, opacity;
}

/* Sidebar */
.hero-demo__sidebar {
    width: 48px;
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    background: var(--stk-page-soft, #f7f9f5);
    border-right: 1px solid var(--stk-border, #dfe6dc);
}

.hero-demo__logo {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--stk-brand, #7fbd23);
    color: #ffffff;
    font-weight: 800;
    font-size: 13px;
}

.hero-demo__nav-item {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: var(--stk-muted, #5f6b76);
    font-size: 14px;
}

.hero-demo__nav-item.active {
    background: var(--stk-brand-soft, #eef7df);
    color: var(--stk-brand-dark, #5f9216);
}

/* Main area */
.hero-demo__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.hero-demo__topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--stk-border, #dfe6dc);
}

.hero-demo__title {
    font-size: 10px;
    font-weight: 800;
    color: var(--stk-muted, #5f6b76);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-demo__avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8bc53f, #5a9216);
}

/* KPIs */
.hero-demo__kpis {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
}

.hero-demo__kpi {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    background: var(--stk-page-soft, #f7f9f5);
    border: 1px solid var(--stk-border, #dfe6dc);
    border-radius: 10px;
}

.hero-demo__kpi i {
    color: var(--stk-brand-dark, #5f9216);
    font-size: 14px;
    flex: none;
}

.hero-demo__kpi--warning i,
.hero-demo__kpi--warning .hero-demo__kpi-value {
    color: #dc2626;
}

.hero-demo__kpi-value {
    font-size: 15px;
    font-weight: 800;
    color: var(--stk-heading, #101820);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.hero-demo__kpi-label {
    font-size: 9px;
    color: var(--stk-muted, #5f6b76);
    line-height: 1.2;
}

/* Table */
.hero-demo__table {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 14px 12px;
    overflow: hidden;
}

.hero-demo__thead {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--stk-muted, #5f6b76);
    font-weight: 800;
    text-transform: uppercase;
    padding: 6px 0;
}

.hero-demo__rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    justify-content: center;
}

.hero-demo__row {
    display: grid;
    grid-template-columns: 1fr 34px;
    align-items: center;
    gap: 3px 8px;
    padding: 5px 8px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
}

.hero-demo__name {
    grid-column: 1;
    font-size: 11px;
    font-weight: 600;
    color: var(--stk-text, #17212b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-demo__bar {
    grid-column: 1;
    height: 5px;
    background: var(--stk-page-soft, #f7f9f5);
    border-radius: 999px;
    overflow: hidden;
}

.hero-demo__bar-fill {
    width: 100%;
    height: 100%;
    background: var(--stk-brand, #7fbd23);
    border-radius: 999px;
    transform-origin: left;
    transform: scaleX(var(--bar-ratio, 0));
}

.hero-demo__stock-value {
    grid-column: 2;
    grid-row: 1 / span 2;
    font-size: 12px;
    font-weight: 800;
    color: var(--stk-heading, #101820);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Row feedback states */
.hero-demo__row--incoming {
    background: rgba(127, 189, 35, 0.10);
    border-color: rgba(127, 189, 35, 0.25);
}

.hero-demo__row--outgoing {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.20);
}

.hero-demo__row--critical .hero-demo__bar-fill {
    background: #f59e0b;
}

/* Floating notification cards */
.hero-demo__event {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: 12px;
    background: var(--stk-surface, #ffffff);
    border: 1px solid var(--stk-border, #dfe6dc);
    box-shadow: var(--stk-shadow-sm, 0 10px 30px rgba(25, 55, 25, 0.07));
    font-size: 12px;
    font-weight: 700;
    color: var(--stk-text, #17212b);
    max-width: 190px;
    white-space: nowrap;
    pointer-events: none;
}

.hero-demo__event i {
    font-size: 14px;
}

.hero-demo__event--critical {
    left: -52px;
    top: 26%;
    color: #b45309;
    border-color: rgba(220, 38, 38, 0.25);
}

.hero-demo__event--critical i {
    color: #dc2626;
}

.hero-demo__event--reminder {
    right: -40px;
    bottom: 18%;
    color: var(--stk-brand-dark, #5f9216);
    border-color: rgba(127, 189, 35, 0.25);
}

.hero-demo__event--reminder i {
    color: var(--stk-brand, #7fbd23);
}

.hero-demo__event strong {
    font-variant-numeric: tabular-nums;
}

/* Stock-change chip */
.hero-demo__stock-change {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    visibility: hidden;
    z-index: 3;
    pointer-events: none;
}

.hero-demo__chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    border-radius: 999px;
    background: var(--stk-brand-soft, #eef7df);
    color: var(--stk-brand-dark, #5f9216);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(127, 189, 35, 0.18);
}

.hero-demo__chip--out {
    background: rgba(220, 38, 38, 0.10);
    color: #dc2626;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.12);
}

/* JS-animated: hide until timeline reveals (GSAP overrides inline) */
.hero-demo--js .hero-demo__panel,
.hero-demo--js .hero-demo__kpi,
.hero-demo--js .hero-demo__row,
.hero-demo--js .hero-demo__event {
    opacity: 0;
    visibility: hidden;
}

.hero-demo--js .hero-demo__bar-fill {
    transform: scaleX(0);
}

/* Static / reduced-motion final state */
.hero-demo--static .hero-demo__panel,
.hero-demo--static .hero-demo__kpi,
.hero-demo--static .hero-demo__row,
.hero-demo--static .hero-demo__event {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.hero-demo--static .hero-demo__stock-change {
    display: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .hero-demo--js .hero-demo__panel,
    .hero-demo--js .hero-demo__kpi,
    .hero-demo--js .hero-demo__row,
    .hero-demo--js .hero-demo__event,
    .hero-demo--js .hero-demo__stock-change,
    .hero-demo--js .hero-demo__bar-fill {
        transition: none !important;
        animation: none !important;
    }
}

/* Desktop pointer parallax enable */
@media (hover: hover) and (pointer: fine) {
    .hero-demo__panel {
        transition: transform 0.35s ease;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .cinematic-hero__visual {
        display: block;
    }

    .hero-demo {
        max-width: 100%;
    }

    .hero-demo__panel {
        max-width: none;
        aspect-ratio: 16 / 11;
        min-height: 220px;
        border-radius: 16px;
    }

    .hero-demo__glow {
        filter: blur(34px);
    }

    .hero-demo__sidebar {
        width: 38px;
        padding: 12px 0;
        gap: 12px;
    }

    .hero-demo__logo {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .hero-demo__nav-item {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .hero-demo__topbar {
        padding: 8px 12px;
    }

    .hero-demo__kpis {
        gap: 6px;
        padding: 8px 12px;
    }

    .hero-demo__kpi {
        padding: 6px;
        gap: 4px;
        border-radius: 8px;
    }

    .hero-demo__kpi i {
        font-size: 12px;
    }

    .hero-demo__kpi-value {
        font-size: 13px;
    }

    .hero-demo__kpi-label {
        font-size: 8px;
    }

    .hero-demo__table {
        padding: 0 12px 10px;
    }

    .hero-demo__row {
        padding: 4px 6px;
        gap: 2px 6px;
    }

    .hero-demo__name {
        font-size: 10px;
    }

    .hero-demo__bar {
        height: 4px;
    }

    .hero-demo__stock-value {
        font-size: 11px;
    }

    .hero-demo__event {
        max-width: calc(100% - 24px);
        padding: 6px 10px;
        font-size: 11px;
    }

    .hero-demo__event--critical {
        left: 8px;
        top: 38%;
    }

    .hero-demo__event--reminder {
        right: 8px;
        bottom: 8%;
    }

    .hero-demo__stock-change {
        top: -10px;
    }

    .hero-demo__chip {
        font-size: 10px;
        padding: 4px 9px;
    }
}

@media (max-width: 390px) {
    .hero-demo {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 8px;
    }

    .hero-demo__panel {
        width: 100%;
        flex: 0 0 100%;
    }

    .hero-demo__event {
        position: static;
        flex: 0 0 calc(50% - 4px);
        max-width: none;
        padding: 6px 8px;
        font-size: 10px;
        border-radius: 10px;
        justify-content: center;
        transform: none !important;
    }

    .hero-demo__event--critical,
    .hero-demo__event--reminder {
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;
    }

    .hero-demo__event i {
        font-size: 12px;
    }

    .hero-demo__stock-change {
        top: -10px;
        flex: none;
    }
}
