/* ═══════════════════════════════════════════════════════
   Hitachi Products Showcase v2 — Frontend Styles
   Sidebar: plain list with active primary color highlight
   All categories scroll on main, sidebar sticks + spy
═══════════════════════════════════════════════════════ */

/* ── Design Tokens (overridden inline by PHP settings) ── */
:root {
    --hpsc-brand:        #e60012;
    --hpsc-brand-rgb:    230,0,18;
    --hpsc-text:         #1c1c1e;
    --hpsc-text-muted:   #545454;
    --hpsc-text-light:   #8a8a8e;
    --hpsc-bg:           #ffffff;
    --hpsc-border:       #e8e8e8;
    --hpsc-sidebar-w:    220px;
    --hpsc-radius:       10px;
    --hpsc-shadow:       0 2px 16px rgba(0,0,0,.08);
    --hpsc-shadow-lg:    0 6px 32px rgba(0,0,0,.13);
    --hpsc-font:         'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    --hpsc-transition:   .2s cubic-bezier(.4,0,.2,1);
    --hpsc-sticky-top:   80px;
}

/* ── Reset ── */
.hpsc-wrapper *,
.hpsc-wrapper *::before,
.hpsc-wrapper *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.hpsc-no-content {
    padding: 2rem;
    color: var(--hpsc-text-muted);
    font-family: var(--hpsc-font);
}

/* ════════════════════════════════
   LAYOUT WRAPPER
════════════════════════════════ */
.hpsc-wrapper {
    display: flex;
    align-items: flex-start;
    font-family: var(--hpsc-font);
    color: var(--hpsc-text);
    background: transparent;           /* ← no section background */
    position: relative;
}

/* ════════════════════════════════
   SIDEBAR — plain list, sticky
════════════════════════════════ */
.hpsc-sidebar {
    width: var(--hpsc-sidebar-w);
    min-width: var(--hpsc-sidebar-w);
    flex-shrink: 0;
    position: sticky;
    top: var(--hpsc-sticky-top);
    align-self: flex-start;
    max-height: calc(100vh - var(--hpsc-sticky-top) - 20px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--hpsc-brand-rgb),.25) transparent;
    padding-right: 8px;
    padding-top: 2px;
}

.hpsc-sidebar::-webkit-scrollbar { width: 4px; }
.hpsc-sidebar::-webkit-scrollbar-thumb { background: rgba(var(--hpsc-brand-rgb),.25); border-radius: 4px; }

/* Nav */
.hpsc-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Each nav link — mimics the screenshot style */
.hpsc-nav__item {
    display: block;
    font-family: var(--hpsc-font);
    font-size: .93rem;
    font-weight: 400;
    color: var(--hpsc-text);
    text-decoration: none;
    padding: 12px 4px 12px 0;
    border-bottom: 1px solid var(--hpsc-border);
    line-height: 1.3;
    transition: color var(--hpsc-transition);
    cursor: pointer;
    background: transparent;
    outline-offset: 3px;
}

.hpsc-nav__item:last-child {
    border-bottom: none;
}

.hpsc-nav__item:hover {
    color: var(--hpsc-brand);
}

/* Active state — primary color text, bold, no background */
.hpsc-nav__item.is-active {
    color: var(--hpsc-brand);
    font-weight: 700;
}

/* ════════════════════════════════
   MAIN CONTENT — all categories scroll
════════════════════════════════ */
.hpsc-main {
    flex: 1;
    min-width: 0;
    padding-left: 44px;
    background: transparent;           /* ← no background */
}

/* ── Each Category Section ── */
.hpsc-cat-section {
    padding: 0 0 56px 0;
    border-bottom: 1px solid var(--hpsc-border);
    scroll-margin-top: calc(var(--hpsc-sticky-top) + 20px);
}

.hpsc-cat-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.hpsc-cat-section + .hpsc-cat-section {
    padding-top: 48px;
}

/* ── Category Header Grid ── */
.hpsc-cat-header {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 40px;
    align-items: flex-start;
}

.hpsc-cat-header__left {}

/* ── Category Title ── */
.hpsc-cat-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--hpsc-brand);
    margin-bottom: 8px;
    line-height: 1.2;
}

.hpsc-cat-title a {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: opacity var(--hpsc-transition);
}

.hpsc-cat-title a:hover { opacity: .8; }

.hpsc-arrow {
    display: inline-block;
    font-size: 1.1rem;
    transition: transform var(--hpsc-transition);
}

.hpsc-cat-title a:hover .hpsc-arrow { transform: translateX(4px); }

/* ── Category Description ── */
.hpsc-cat-desc {
    font-size: .875rem;
    color: var(--hpsc-text-muted);
    margin-bottom: 24px;
    line-height: 1.6;
    max-width: 500px;
}

/* ════════════════════════════════
   PRODUCT CARDS GRID
════════════════════════════════ */
.hpsc-product-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.hpsc-product-card {
    border-bottom: 1px solid var(--hpsc-border);
}

.hpsc-product-card:first-child {
    border-top: 1px solid var(--hpsc-border);
}

.hpsc-product-card__inner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 0;
}

/* Optional thumbnail */
.hpsc-product-card__thumb {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
}

.hpsc-product-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hpsc-product-card__body {
    flex: 1;
    min-width: 0;
}

/* Product Title */
.hpsc-product-card__title {
    font-size: .93rem;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.3;
}

.hpsc-product-card__title a {
    color: var(--hpsc-text);
    text-decoration: none;
    transition: color var(--hpsc-transition);
}

.hpsc-product-card__title a:hover {
    color: var(--hpsc-brand);
}

/* Tags */
.hpsc-product-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 6px;
}

.hpsc-tag {
    display: inline-block;
    background: rgba(var(--hpsc-brand-rgb),.08);
    color: var(--hpsc-brand);
    border: 1px solid rgba(var(--hpsc-brand-rgb),.18);
    font-size: .68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

/* Product short description */
.hpsc-product-card__desc {
    font-size: .83rem;
    color: var(--hpsc-text-muted);
    line-height: 1.55;
    margin-bottom: 8px;
}

/* Know More link — primary color */
.hpsc-know-more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--hpsc-brand);
    font-size: .82rem;
    font-weight: 600;
    text-decoration: none;
    transition: gap var(--hpsc-transition), opacity var(--hpsc-transition);
}

.hpsc-know-more:hover {
    opacity: .8;
    gap: 7px;
}

/* ════════════════════════════════
   CATEGORY CARD (right panel)
════════════════════════════════ */
.hpsc-cat-card {
    border-radius: var(--hpsc-radius);
    overflow: hidden;
    box-shadow: var(--hpsc-shadow);
    background: #fff;
    border: 1px solid var(--hpsc-border);
    align-self: flex-start;
    position: sticky;
    top: calc(var(--hpsc-sticky-top) + 16px);
    transition: box-shadow var(--hpsc-transition);
}

.hpsc-cat-card:hover {
    box-shadow: var(--hpsc-shadow-lg);
}

.hpsc-cat-card__img {
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #e9e9eb;
}

.hpsc-cat-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .45s ease;
}

.hpsc-cat-card:hover .hpsc-cat-card__img img {
    transform: scale(1.04);
}

.hpsc-cat-card__body {
    padding: 16px 18px 20px;
}

.hpsc-cat-card__title {
    font-size: .86rem;
    font-weight: 700;
    color: var(--hpsc-text);
    margin-bottom: 12px;
    line-height: 1.35;
}

.hpsc-cat-card__link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--hpsc-brand);
    font-weight: 700;
    font-size: .86rem;
    text-decoration: none;
    transition: gap var(--hpsc-transition), opacity var(--hpsc-transition);
}

.hpsc-cat-card__link:hover {
    opacity: .8;
    gap: 9px;
}

/* ════════════════════════════════
   MOBILE  ≤ 768px
════════════════════════════════ */
@media (max-width: 768px) {

    .hpsc-wrapper {
        flex-direction: column;
        gap: 0;
    }

    /* ── Sidebar → horizontal scrollable tab bar ── */
    .hpsc-sidebar {
        width: 100%;
        min-width: 0;
        position: sticky;
        top: 0;
        max-height: none;
        overflow-y: visible;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0;
        background: #fff;
        border-bottom: 2px solid var(--hpsc-brand);
        box-shadow: 0 2px 10px rgba(0,0,0,.07);
        z-index: 200;
        scrollbar-width: none;
    }

    .hpsc-sidebar::-webkit-scrollbar { display: none; }

    .hpsc-nav {
        flex-direction: row;
        gap: 0;
    }

    .hpsc-nav__item {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 13px 18px;
        border-bottom: none;
        border-right: 1px solid var(--hpsc-border);
        font-size: .82rem;
    }

    .hpsc-nav__item:last-child { border-right: none; }

    .hpsc-nav__item.is-active {
        border-bottom: 3px solid var(--hpsc-brand);
        background: rgba(var(--hpsc-brand-rgb),.04);
    }

    /* ── Main ── */
    .hpsc-main {
        padding-left: 0;
        padding-top: 20px;
    }

    .hpsc-cat-section {
        padding: 0 0 40px 0;
        scroll-margin-top: 60px;
    }

    .hpsc-cat-section + .hpsc-cat-section { padding-top: 36px; }

    /* Stack header vertically */
    .hpsc-cat-header {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .hpsc-cat-card {
        position: static;
        max-width: 100%;
    }

    .hpsc-cat-title { font-size: 1.18rem; }
}

/* ════════════════════════════════
   TABLET  769–1024px
════════════════════════════════ */
@media (min-width: 769px) and (max-width: 1024px) {
    :root { --hpsc-sidebar-w: 185px; }

    .hpsc-main { padding-left: 28px; }

    .hpsc-cat-header {
        grid-template-columns: 1fr 230px;
        gap: 24px;
    }
}
