@charset "utf-8";

/* ============================================================
   mall.css
   무한 스크롤 + AJAX 탭 전환 최종 조합
   ============================================================ */

/* ============================================================
   전체 페이지
   ============================================================ */
.mall-page {
    max-width: var(--wrap, 1200px);
    margin: 0 auto;
    padding: 20px 0 60px;
}

/* AJAX 로딩 중에는 상품 영역만 아주 약하게 흐리게 처리 */
.mall-page.mall-is-loading .mall-grid {
    opacity: 0.55;
    pointer-events: none;
}

/* 새로 교체된 영역의 짧고 부드러운 표시 */
.mall-page.mall-is-entering .mall-grid {
    opacity: 0;
}

.mall-grid {
    opacity: 1;
    transition: opacity 0.12s ease;
}

/* ============================================================
   히어로
   ============================================================ */
.mall-hero {
    max-width: 720px;
    margin: 0 auto 50px;
    text-align: center;
}

.mall-hero .sec_eyebrow {
    margin: 0 0 12px;
    color: var(--accent, var(--brand));
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.mall-hero h1 {
    margin: 14px 0 12px;
    color: var(--brand);
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 900;
    line-height: 1.3;
}

.mall-hero h1 em {
    color: var(--accent, var(--brand));
    font-style: normal;
}

.mall-hero p {
    margin: 0;
    color: var(--txt-s);
    font-size: 15px;
    line-height: 1.8;
}

.mall-hero-mobile-break {
    display: none;
}

/* ============================================================
   탭 메뉴
   ============================================================ */
/*
 * sticky는 탭 내부가 아니라 탭을 감싸는 section에 적용한다.
 * 내부 요소에만 sticky를 적용하면 부모 section의 높이를 벗어나는 순간
 * 고정이 풀리므로 긴 상품 목록을 스크롤할 때 탭이 사라질 수 있다.
 */
.mall-tabs-section {
    position: sticky;
    top: var(--mall-sticky-top, 71px);
    z-index: 9000;
    margin: 0;
    background: var(--white);
    isolation: isolate;
}

.mall-tabs {
    position: relative;
    z-index: 1;
    overflow-x: auto;
    margin-bottom: 10px;
    padding: 10px 4px 10px;
    background: var(--white);
    scrollbar-width: none;
    -ms-overflow-style: none;
    touch-action: pan-x;  /* ← 추가: 가로 스크롤만 허용한다고 명시 */
}

@media (min-width: 961px) {
    .mall-tabs-section {
        top: 71px;
    }
}

.mall-tabs::-webkit-scrollbar {
    display: none;
}

.mall-tab-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    min-width: max-content;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mall-tab-item {
    flex-shrink: 0;
}

.mall-tab-item a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border: 2px solid var(--border);
    border-radius: 50px;
    background-color: var(--white);
    color: var(--txt-s);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition:
        background-color 0.12s ease,
        border-color 0.12s ease,
        color 0.12s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mall-tab-item a i {
    font-size: 14px;
}

.mall-tab-item.active a {
    border-color: var(--brand);
    background-color: var(--brand);
    color: var(--white);
}

@media (hover: hover) {
    .mall-tab-item:not(.active) a:hover {
        border-color: var(--brand);
        background-color: var(--brand-light);
        color: var(--brand);
    }
}

.mall-tab-item a:active {
    transform: none;
}

.mall-tab-item a:focus {
    outline: none;
}

.mall-tab-item a:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 3px;
}

.mall-tab-item .count {
    padding: 1px 10px;
    border-radius: 50px;
    background: rgba(15, 23, 42, 0.07);
    font-size: 11px;
    line-height: 1.4;
}

.mall-tab-item.active .count {
    background: rgba(255, 255, 255, 0.25);
    color: var(--white);
}

/* ============================================================
   모바일 스와이프 힌트
   ============================================================ */
.mall-tabs .swipe-hint {
    position: absolute;
    bottom: 0;
    left: 50%;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.88);
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-50%);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.mall-tabs.scrollable .swipe-hint {
    animation: mallHintFade 1.8s ease forwards;
}

@keyframes mallHintFade {
    0%,
    50% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@media (min-width: 769px) {
    .mall-tabs .swipe-hint {
        display: none !important;
    }
}

/* ============================================================
   상품 그리드
   ============================================================ */
.mall-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    padding: 10px 0;
}

/* ============================================================
   상품 카드
   ============================================================ */
.mall-card {
    display: block;
    overflow: hidden;
    min-width: 0;
    border: 1.5px solid var(--border);
    border-radius: 16px;
    background: var(--white);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

@media (hover: hover) {
    .mall-card:hover {
        border-color: var(--brand);
        box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
        transform: translateY(-5px);
    }
}

.mall-card-link {
    display: block;
    height: 100%;
    color: inherit;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.mall-card-link:focus {
    outline: none;
}

.mall-card-link:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

.mall-card-image {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding-bottom: 100%;
    background: var(--white);
}

.mall-card-image .image-wrapper {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mall-card-image .image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

@media (hover: hover) {
    .mall-card:hover .mall-card-image .image-wrapper img {
        transform: scale(1.025);
    }
}

.mall-card-badge {
    position: absolute;
    bottom: 14px;
    left: 14px;
    z-index: 5;
    overflow: hidden;
    max-width: calc(100% - 28px);
    padding: 4px 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.82);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
    color: var(--white);
    font-size: 12px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.mall-card-body {
    padding: 16px 18px 18px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.mall-card-title {
    display: -webkit-box;
    overflow: hidden;
    min-height: 28px;
    margin-bottom: 0px;
    color: var(--brand);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    word-break: keep-all;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.mall-card-price {
    color: var(--dark);
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.3px;
    text-align: right;
}

.mall-card-price .price-unit {
    margin-left: 3px;
    color: var(--txt-s);
    font-size: 13px;
    font-weight: 600;
}

.mall-card-price .price-inquiry {
    color: var(--slate);
    font-size: 14px;
    font-weight: 600;
}

/* ============================================================
   빈 목록
   ============================================================ */
.mall-empty {
    grid-column: 1 / -1;
    padding: 80px 20px;
    color: var(--txt-s);
    text-align: center;
}

.mall-empty .empty-icon {
    margin-bottom: 16px;
    font-size: 64px;
    opacity: 0.5;
}

.mall-empty .empty-text {
    margin: 0;
    font-size: 16px;
}

/* ============================================================
   무한 스크롤 트리거
   ============================================================ */
.mall-infinite-scroll-trigger {
    text-align: center;
    padding: 40px 0 10px;
}

.mall-infinite-scroll-trigger .spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: mallSpinnerSpin 0.8s linear infinite;
}

@keyframes mallSpinnerSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.mall-infinite-scroll-trigger .loading-text {
    margin: 12px 0 0;
    color: var(--txt-s);
    font-size: 14px;
}

.mall-infinite-scroll-trigger .done-text {
    margin: 0;
    color: var(--txt-s);
    font-size: 15px;
    font-weight: 500;
}

.mall-infinite-scroll-trigger.is-loading .spinner {
    display: inline-block;
}

/* ============================================================
   새 카드가 부드럽게 나타나는 애니메이션
   ============================================================ */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mall-card-entering {
    opacity: 0;
    transform: translateY(30px);
}

.mall-card-entering.visible {
    animation: fadeSlideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* ============================================================
   하단 CTA
   ============================================================ */
.mall-cta {
    margin-top: 40px;
    padding: 52px 40px;
    border-radius: 24px;
    background: linear-gradient(
        135deg,
        var(--brand),
        var(--brand-d)
    );
    color: var(--white);
    text-align: center;
}

.mall-cta h3 {
    margin: 0 0 12px;
    font-size: clamp(20px, 4vw, 26px);
    font-weight: 800;
}

.mall-cta h3 i {
    margin-right: 10px;
    color: var(--accent);
}

.mall-cta p {
    margin: 0 0 28px;
    font-size: 14.5px;
    opacity: 0.85;
}

.mall-cta a {
    display: inline-block;
    padding: 14px 40px;
    border-radius: 50px;
    background: var(--accent);
    color: var(--brand-d);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
    .mall-cta a:hover {
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
        transform: translateY(-2px);
    }
}

/* ============================================================
   태블릿
   ============================================================ */
@media (max-width: 1024px) {
    .mall-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
    }
}

/* ============================================================
   모바일
   ============================================================ */
@media (max-width: 768px) {
    .mall-page {
        padding: 12px 0 40px;
    }

    .mall-hero {
        margin: 0 auto 30px;
        padding: 0 14px;
    }

    .mall-hero .sec_eyebrow {
        margin-bottom: 10px;
        font-size: 11px;
    }

    .mall-hero h1 {
        font-size: clamp(22px, 5vw, 28px);
    }

    .mall-hero p {
        font-size: 14px;
    }

    .mall-hero-mobile-break {
        display: block;
    }

    .mall-tabs-section {
        top: var(--mall-sticky-top, 56px);
    }

    .mall-tabs {
        margin-bottom: 4px;
        padding: 8px 4px 8px;
    }

    .mall-tab-item a {
        padding: 8px 18px;
        font-size: 13px;
    }

    .mall-tab-item .count {
        padding: 0 8px;
        font-size: 10px;
    }

    .mall-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .mall-card {
        border-radius: 13px;
    }

    .mall-card-body {
        padding: 12px 12px 14px;
    }

    .mall-card-title {
        min-height: 28px;
        font-size: 14px;
    }

    .mall-card-price {
        font-size: 15px;
    }

    .mall-card-price .price-unit {
        font-size: 12px;
    }

    .mall-card-badge {
        bottom: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
        padding: 3px 10px;
        font-size: 11px;
    }

    .mall-cta {
        padding: 32px 20px;
        border-radius: 16px;
        margin-top: 30px;
    }

    .mall-cta h3 {
        font-size: 18px;
    }

    .mall-cta a {
        padding: 12px 28px;
        font-size: 13px;
    }

    .mall-infinite-scroll-trigger {
        padding: 30px 0 10px;
    }

    .mall-infinite-scroll-trigger .spinner {
        width: 32px;
        height: 32px;
        border-width: 3px;
    }
}

/* ============================================================
   작은 모바일
   ============================================================ */
@media (max-width: 480px) {
    .mall-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .mall-card-body {
        padding: 10px 9px 12px;
    }

    .mall-card-title {
        min-height: 28px;
        font-size: 13px;
        line-height: 1.38;
    }

    .mall-card-price {
        font-size: 14px;
    }

    .mall-card-price .price-unit {
        font-size: 11px;
    }

    .mall-card-price .price-inquiry {
        font-size: 12px;
    }
}

/* ============================================================
   애니메이션 최소화 설정
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .mall-grid,
    .mall-tab-item a,
    .mall-card,
    .mall-card-image .image-wrapper img,
    .mall-cta a,
    .mall-card-entering,
    .mall-card-entering.visible {
        transition: none !important;
        animation: none !important;
    }
}