@charset "utf-8";

/* 모든 메뉴 아이템 - 드롭다운의 기준점 */
.has-product-mega {
    position: static !important;
}

/* 제품 드롭다운 메가메뉴 */
.product-mega-dropdown {
    position: absolute;
    top: 100%; /* 헤더의 100% 아래에 자동 배치 */
    left: 0;
    right: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    /* 나타날 때는 빠르게, 사라질 때는 천천히 */
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    transition-delay: 0s, 0s, 0s;
    z-index: 9999; /* 헤더 내부에서 최상단 */
    pointer-events: none;
}

/* 네비게이션 메뉴에도 position relative 추가 */
.phantom-nav {
    position: relative;
}

/* 모든 메뉴에 hover 시 드롭다운 표시 */
.phantom-header-type01:has(.has-product-mega:hover) .product-mega-dropdown,
.has-product-mega.touch-active ~ .product-mega-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    /* 나타날 때는 지연 없이 즉시 */
    transition-delay: 0s, 0s, 0s;
}

/* 메가메뉴 자체에 hover할 때도 계속 표시 */
.product-mega-dropdown:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    /* 메가메뉴에 직접 hover 중일 때는 지연 없음 */
    transition-delay: 0s, 0s, 0s;
}

/* IE11 및 구형 브라우저를 위한 fallback (has 선택자 미지원) */
.phantom-header-type01:hover .product-mega-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    transition-delay: 0s, 0s, 0s;
}

/* 메뉴와 메가메뉴 사이의 간격을 커버하기 위한 hover 영역 확장 */
.phantom-header-type01::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 20px; /* 메뉴와 메가메뉴 사이 20px 간격도 hover 유지 */
    z-index: 999;
    pointer-events: none;
}

.phantom-header-type01:has(.has-product-mega:hover)::after {
    pointer-events: auto;
}

.product-mega-dropdown__container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 40px 50px;
}

.product-mega-dropdown__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 35px 25px;
    align-items: start;
}

.product-mega-dropdown__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.product-mega-dropdown__item:hover {
    transform: translateY(-4px);
}

.product-mega-dropdown__image {
    width: 100%;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.product-mega-dropdown__image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.product-mega-dropdown__label {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    text-align: center;
    line-height: 1.4;
    word-break: keep-all;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 모바일 제품 그리드: 기본값은 숨김 (PC에서는 안보임) */
.mobile-product-grid {
    display: none;
}

@media (max-width: 1024px) {
    .product-mega-dropdown__container {
        padding: 30px 24px 40px;
    }
    .product-mega-dropdown__grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 24px 16px;
    }
}

@media (max-width: 768px) {
    /* PC용 드롭다운 메가메뉴는 모바일에서 숨김 */
    .product-mega-dropdown {
        display: none !important;
    }
    
    /* 모바일 제품 그리드 표시 */
    .mobile-product-grid {
        display: block;
        padding: 12px 0 10px;
        background: #fff;
        position: sticky;
        top: 60px;
        z-index: 10;
        border-bottom: 1px solid #f1f3f5;
    }
    .mobile-product-grid__inner {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 12px 6px;
        padding: 0 14px;
    }
    .mobile-product-grid__item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: #222;
    }
    .mobile-product-grid__thumb {
        width: 46px;
        height: 46px;
        border-radius: 14px;
        border: 1px solid #e5e7eb;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #fff;
        margin-bottom: 4px;
    }
    .mobile-product-grid__thumb img {
        max-width: 34px;
        max-height: 34px;
        object-fit: contain;
    }
    .mobile-product-grid__label {
        font-size: 12px;
        text-align: center;
        line-height: 1.3;
        color: #111;
    }
    .mobile-product-grid__item:active .mobile-product-grid__thumb {
        border-color: #1cb561;
    }
    .mobile-product-grid__item:active .mobile-product-grid__label {
        color: #1cb561;
    }
}
