/**
 * Seven Menu — Type A: Sidebar
 *
 * Slide-in sidebar with subcategory panels positioned beside it.
 * Supports left/right opening via data-position attribute.
 */

/* ── Reset ────────────────────────────────────────────────────────────── */

.sevn-menu--sidebar,
.sevn-menu--sidebar *,
.sevn-menu--sidebar *::before,
.sevn-menu--sidebar *::after {
    box-sizing: border-box;
}

/* ── CSS Variables ────────────────────────────────────────────────────── */

.sevn-menu--sidebar {
    --sevn-sidebar-width: 420px;
    --sevn-panel-max-width: 1000px;
    --sevn-header-height: 0px;
    --sevn-accent-color: #2271b1;
    --sevn-overlay-color: rgba( 0, 0, 0, 0.5 );
}

/* ── Backdrop ─────────────────────────────────────────────────────────── */

.sevn-menu__backdrop {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: var( --sevn-overlay-color );
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sevn-menu--sidebar.is-open .sevn-menu__backdrop {
    opacity: 1;
    visibility: visible;
}

/* ── Sidebar Panel — Right (default) ──────────────────────────────────── */

.sevn-menu__sidebar {
    position: fixed;
    top: var( --sevn-header-height, 0px );
    right: calc( -1 * var( --sevn-sidebar-width ) );
    z-index: 99999;
    width: var( --sevn-sidebar-width );
    max-width: 90vw;
    height: calc( 100vh - var( --sevn-header-height, 0px ) );
    height: calc( 100dvh - var( --sevn-header-height, 0px ) );
    background: var( --sevn-desktop-bg, #fff );
    color: var( --sevn-desktop-color, #1a1a2e );
    transition: right 0.35s cubic-bezier( 0.4, 0, 0.2, 1 );
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: -4px 0 24px rgba( 0, 0, 0, 0.15 );
}

.sevn-menu--sidebar.is-open .sevn-menu__sidebar {
    right: 0;
}

/* ── Sidebar Panel — Left variant ─────────────────────────────────────── */

.sevn-menu--sidebar[data-position="left"] .sevn-menu__sidebar {
    right: auto;
    left: calc( -1 * var( --sevn-sidebar-width ) );
    box-shadow: 4px 0 24px rgba( 0, 0, 0, 0.15 );
    transition: left 0.35s cubic-bezier( 0.4, 0, 0.2, 1 );
}

.sevn-menu--sidebar[data-position="left"].is-open .sevn-menu__sidebar {
    left: 0;
}

/* ── Header ───────────────────────────────────────────────────────────── */

.sevn-menu__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba( 0, 0, 0, 0.08 );
    background: rgba( 0, 0, 0, 0.02 );
    flex-shrink: 0;
    gap: 16px;
}

.sevn-menu__brand {
    min-width: 0;
    display: flex;
    align-items: center;
}

.sevn-menu__brand .custom-logo-link {
    display: inline-flex;
    align-items: center;
}

.sevn-menu__brand img {
    display: block;
    max-width: 100%;
    max-height: 42px;
    width: auto;
    height: auto;
}

.sevn-menu__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-left: auto;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid rgba( 0, 0, 0, 0.12 );
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    border-radius: 6px;
    transition: background-color 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.sevn-menu__close:hover {
    background-color: rgba( 0, 0, 0, 0.06 );
}

.sevn-menu__close:focus-visible {
    outline: 2px solid var( --sevn-accent-color );
    outline-offset: 2px;
}

/* ── Content (scrollable) ─────────────────────────────────────────────── */

.sevn-menu__content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

/* ── Zones (top / center / bottom) ────────────────────────────────────── */

.sevn-menu__zone {
    flex-shrink: 0;
}

.sevn-menu__zone--center {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.sevn-menu__zone--bottom {
    margin-top: auto;
    border-top: 1px solid rgba( 0, 0, 0, 0.06 );
}

.sevn-menu__zone--center::-webkit-scrollbar {
    width: 6px;
}

.sevn-menu__zone--center::-webkit-scrollbar-track {
    background: transparent;
}

.sevn-menu__zone--center::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* ── Sections ─────────────────────────────────────────────────────────── */

.sevn-section {
    padding: 0;
}

.sevn-section + .sevn-section {
    border-top: 1px solid rgba( 0, 0, 0, 0.06 );
}

.sevn-section--no-border + .sevn-section,
.sevn-section + .sevn-section--no-border {
    border-top: none;
}

.sevn-section__title {
    margin: 0;
    padding: 16px 20px 8px;
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
    color: #888;
    border-bottom: 1px solid rgba( 0, 0, 0, 0.06 );
}

.sevn-section__title--no-border {
    border-bottom: none;
}

/* ── Section Columns (top/bottom zones) ──────────────────────────────── */

.sevn-section__columns {
    display: grid;
    gap: 16px;
}

.sevn-section__column {
    min-width: 0;
}

/* ── Service Box (Plaisio-style) ─────────────────────────────────────── */

.sevn-service-box {
    list-style: none;
}

.sevn-service-box__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    color: inherit;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.sevn-service-box__link:hover {
    transform: translateY(-2px);
}

.sevn-service-box__visual {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 85px;
    height: 85px;
    border-radius: 12px;
    overflow: hidden;
    background-color: #f0f0f0;
}

.sevn-service-box__image {
    display: block;
    width: 85px;
    height: 85px;
    object-fit: contain;
}

.sevn-service-box__icon {
    font-size: 32px;
    line-height: 1;
}

.sevn-service-box__label {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    color: #333;
    max-width: 100px;
}

/* ── Display Type: List ───────────────────────────────────────────────── */

.sevn-list {
    list-style: none;
    margin: 0;
    padding: 0 0 20px;
    display: flex;
    flex-direction: column;
    gap: var( --sevn-item-gap, 2px );
}

.sevn-list__item {
    margin: 0;
    padding: 0;
    position: relative;
}

.sevn-list__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: var( --sevn-item-padding, 8px 16px );
    min-height: var( --sevn-item-min-h, auto );
    background-color: var( --sevn-item-bg, transparent );
    filter: var( --sevn-item-filter, none );
    border-radius: var( --sevn-item-radius, 0px );
    color: inherit;
    text-decoration: none;
    font-size: var( --sevn-item-font-size, 13px );
    text-align: var( --sevn-item-text-align, left );
    font-weight: 500;
    transition: background-color 0.15s ease, filter 0.15s ease;
    border-right: var( --sevn-item-active-border-width, 0px ) solid transparent;
}

.sevn-list__link:hover {
    background-color: var( --sevn-item-hover-bg, var( --sevn-item-bg, transparent ) );
    filter: var( --sevn-item-hover-filter, var( --sevn-item-filter, none ) );
}

.sevn-list__item.is-active .sevn-list__link {
    background-color: var( --sevn-item-active-bg, var( --sevn-item-hover-bg, rgba( 0, 0, 0, 0.04 ) ) );
    filter: var( --sevn-item-active-filter, var( --sevn-item-hover-filter, var( --sevn-item-filter, none ) ) );
    border-right-color: var( --sevn-item-active-border-color, transparent );
    text-decoration: none;
}

.sevn-list__link:focus-visible {
    outline: 2px solid var( --sevn-accent-color );
    outline-offset: -2px;
}

/* Left-side variant: border on left instead of right */
.sevn-menu--sidebar[data-position="left"] .sevn-list__link {
    border-right: none;
    border-left: var( --sevn-item-active-border-width, 0px ) solid transparent;
}

.sevn-menu--sidebar[data-position="left"] .sevn-list__link:hover,
.sevn-menu--sidebar[data-position="left"] .sevn-list__item.is-active .sevn-list__link {
    border-left-color: var( --sevn-item-active-border-color, transparent );
}

/* ── Category Image / Icon ────────────────────────────────────────────── */

.sevn-list__image {
    width: var( --sevn-item-img-size, 36px );
    height: var( --sevn-item-img-size, 36px );
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 6px;
    order: var( --sevn-item-image-order, 1 );
}

.sevn-list__icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    border-radius: 6px;
    order: var( --sevn-item-image-order, 1 );
}

.sevn-list__name {
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.3;
    order: var( --sevn-item-text-order, 2 );
    text-align: var( --sevn-item-text-align, inherit );
}

/* ── Arrow Indicator ──────────────────────────────────────────────────── */

.sevn-list__arrow {
    flex-shrink: 0;
    display: var( --sevn-item-arrow-display, flex );
    align-items: center;
    order: var( --sevn-item-arrow-order, 3 );
    color: #999;
    transition: color 0.15s ease;
}

.sevn-list__item.is-active .sevn-list__arrow {
    color: var( --sevn-accent-color );
}

/* ── Image Position: Right ───────────────────────────────────────────── */


/* ── Subcategory Panel — Right sidebar: panel to the LEFT ─────────────── */

.sevn-subcategory {
    position: fixed;
    top: var( --sevn-header-height, 0px );
    right: var( --sevn-sidebar-width );
    z-index: 99999;
    width: calc( 100vw - var( --sevn-sidebar-width ) );
    max-width: var( --sevn-panel-max-width );
    height: calc( 100vh - var( --sevn-header-height, 0px ) );
    height: calc( 100dvh - var( --sevn-header-height, 0px ) );
    background: var( --sevn-desktop-bg, #fff );
    color: var( --sevn-desktop-color, #1a1a2e );
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 30px;
    box-shadow: -4px 0 24px rgba( 0, 0, 0, 0.08 );
    pointer-events: none;
}

.sevn-list__item.is-active .sevn-subcategory {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ── Subcategory Panel — Left sidebar: panel to the RIGHT ─────────────── */

.sevn-menu--sidebar[data-position="left"] .sevn-subcategory {
    right: auto;
    left: var( --sevn-sidebar-width );
    box-shadow: 4px 0 24px rgba( 0, 0, 0, 0.08 );
}

/* ── Category Image (parent thumbnail above columns) ─────────────────── */

.sevn-subcategory__category-image {
    flex: 0 0 auto;
    text-align: center;
    margin-bottom: 1.25rem;
}

.sevn-subcategory__cat-img {
    display: block;
    max-width: 180px;
    max-height: 160px;
    object-fit: contain;
    border-radius: 6px;
}

/* ── Subcategory Columns ──────────────────────────────────────────────── */

.sevn-subcategory__columns {
    display: grid;
    min-height: 0;
    /* grid-template-columns + gap set inline from PHP */
}

.sevn-subcategory__column {
    min-width: 0;
    height: 100%;
}

/* ── Banner Column ────────────────────────────────────────────────────── */

.sevn-subcategory__column--banner {
    align-self: stretch;
}

.sevn-banner__image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    object-fit: cover;
}

.sevn-banner__link {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    transition: opacity 0.15s ease;
}

.sevn-banner__link:hover {
    opacity: 0.9;
}

.sevn-banner__link:focus-visible {
    outline: 2px solid var( --sevn-accent-color );
    outline-offset: 2px;
}

.sevn-subcategory__group {
    margin: 0 0 10px;
    padding: 0;
    font-size: 14px;
    line-height: 1.1;
    font-weight: 700;
}

.sevn-subcategory__group a {
    color: inherit;
    text-decoration: none;
}

.sevn-subcategory__group a:hover {
    color: var( --sevn-accent-color );
}

.sevn-subcategory__group a:focus-visible {
    outline: 2px solid var( --sevn-accent-color );
    outline-offset: 2px;
}

.sevn-subcategory__links {
    list-style: none;
    margin: 0 0 1.5625rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4375rem;
    line-height: 1.2;
}

.sevn-subcategory__links li {
    margin: 0;
    padding: 0;
}

.sevn-subcategory__links a {
    display: block;
    padding: 0;
    color: #555;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.4;
    transition: color 0.15s ease;
}

.sevn-subcategory__links a:hover {
    color: var( --sevn-accent-color );
    text-decoration: none;
}

.sevn-subcategory__links a:focus-visible {
    outline: 2px solid var( --sevn-accent-color );
    outline-offset: 2px;
}

/* ── See All Link ────────────────────────────────────────────────────── */

.sevn-see-all a {
    display: block;
    padding: 0;
    font-size: 12px;
    font-weight: 600;
    color: var( --sevn-accent-color );
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.sevn-see-all a:hover {
    text-decoration: underline;
}

.sevn-see-all a:focus-visible {
    outline: 2px solid var( --sevn-accent-color );
    outline-offset: 2px;
}

/* ── Display Type: Grid ───────────────────────────────────────────────── */

.sevn-grid {
    display: grid;
    grid-template-columns: repeat( auto-fill, minmax( 120px, 1fr ) );
    gap: 0.75rem;
    padding: 0.5rem 1rem;
}

.sevn-grid__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    padding: 0.75rem 0.5rem;
    text-align: center;
    color: inherit;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}

.sevn-grid__item:hover {
    background-color: rgba( 0, 0, 0, 0.04 );
}

.sevn-grid__item:focus-visible {
    outline: 2px solid var( --sevn-accent-color );
    outline-offset: 2px;
}

.sevn-grid__image {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 4px;
}

.sevn-grid__label {
    font-size: 0.8125rem;
    line-height: 1.3;
}

/* ── Display Type: Icons ──────────────────────────────────────────────── */

.sevn-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
}

.sevn-icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    min-width: 64px;
    text-align: center;
    color: inherit;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}

.sevn-icon-item:hover {
    background-color: rgba( 0, 0, 0, 0.04 );
}

.sevn-icon-item:focus-visible {
    outline: 2px solid var( --sevn-accent-color );
    outline-offset: 2px;
}

.sevn-icon-item__icon {
    font-size: 1.5rem;
    line-height: 1;
}

.sevn-icon-item__label {
    font-size: 0.75rem;
    line-height: 1.3;
}

/* ── Display Type: Cards ──────────────────────────────────────────────── */

.sevn-cards {
    display: grid;
    grid-template-columns: repeat( auto-fill, minmax( 140px, 1fr ) );
    gap: 0.75rem;
    padding: 0.5rem 1rem;
}

.sevn-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid rgba( 0, 0, 0, 0.08 );
    transition: box-shadow 0.15s ease;
}

.sevn-card:hover {
    box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.1 );
}

.sevn-card:focus-visible {
    outline: 2px solid var( --sevn-accent-color );
    outline-offset: 2px;
}

.sevn-card__image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.sevn-card__title {
    display: block;
    padding: 0.5rem 0.625rem;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.3;
}

.sevn-card__description {
    display: block;
    padding: 0 0.625rem 0.5rem;
    font-size: 0.75rem;
    opacity: 0.7;
    line-height: 1.3;
}

/* ── Screen Reader Text ───────────────────────────────────────────────── */

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect( 0, 0, 0, 0 );
    white-space: nowrap;
    border: 0;
}

/* ── Body Lock ────────────────────────────────────────────────────────── */

body.sevn-body-locked {
    overflow: hidden;
}

/* ── Reduced Motion ───────────────────────────────────────────────────── */

@media ( prefers-reduced-motion: reduce ) {
    .sevn-menu__backdrop,
    .sevn-menu__sidebar,
    .sevn-subcategory,
    .sevn-list__link,
    .sevn-grid__item,
    .sevn-icon-item,
    .sevn-card,
    .sevn-subcategory__links a,
    .sevn-see-all a {
        transition: none;
    }
}
