/* /main 공통 반응형 — 1200px 미만 */

@media (max-width: 1439px) {
    .w-default {
        width: 100% !important;
        max-width: 1440px;
        padding-left: 1rem;
        padding-right: 1rem;
        box-sizing: border-box;
    }
}

/* 햄버거·서랍: PC에서는 숨김 */
.ilj-hamburger,
.ilj-drawer-overlay,
.ilj-drawer {
    display: none;
}

body.ilj-drawer-lock {
    overflow: hidden;
}

/* 명품관·명작관 카드: PC에서 높이 고정 */
.ilj-yard-card {
    height: 245px;
}

@media (max-width: 1199px) {
    .w-default {
        padding-left: 0;
        padding-right: 0;
    }

    /* 헤더: 로고 + 햄버거 */
    .ilj-header-bar {
        height: auto !important;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .ilj-header-brand {
        flex: 1 1 auto;
        min-width: 0;
    }

    .ilj-header-brand .bg-headerLogo {
        width: 10rem;
        height: 3.5rem;
        flex-shrink: 0;
    }

    .ilj-header-channels,
    .ilj-header-auth,
    .ilj-pc-nav {
        display: none !important;
    }

    .ilj-hamburger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        width: 2.75rem;
        height: 2.75rem;
        padding: 0;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        background: #fff;
        cursor: pointer;
        flex-shrink: 0;
        z-index: 60;
    }

    .ilj-hamburger span {
        display: block;
        width: 1.15rem;
        height: 2px;
        background: #111827;
        border-radius: 2px;
        transition: transform 0.2s, opacity 0.2s;
    }

    header.is-drawer-open .ilj-hamburger span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    header.is-drawer-open .ilj-hamburger span:nth-child(2) {
        opacity: 0;
    }

    header.is-drawer-open .ilj-hamburger span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .ilj-drawer-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 80;
        background: rgba(15, 23, 42, 0.45);
    }

    .ilj-drawer-overlay[hidden] {
        display: none !important;
    }

    .ilj-drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        z-index: 90;
        width: min(22.5rem, 92vw);
        height: 100%;
        background: #fff;
        box-shadow: -8px 0 24px rgba(15, 23, 42, 0.18);
        overflow: hidden;
    }

    .ilj-drawer[hidden] {
        display: none !important;
    }

    .ilj-drawer-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
        padding: 1rem 1.1rem 0.75rem;
        border-bottom: 1px solid #e5e7eb;
        position: sticky;
        top: 0;
        background: #fff;
        z-index: 1;
    }

    .ilj-drawer-title,
    .ilj-drawer-head .ilj-drawer-nick {
        font-size: 1.05rem;
        font-weight: 700;
        margin: 0;
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ilj-drawer-close {
        width: 2.25rem;
        height: 2.25rem;
        border: 0;
        background: transparent;
        font-size: 1.75rem;
        line-height: 1;
        color: #374151;
        cursor: pointer;
    }

    .ilj-drawer-label {
        margin: 0;
        padding: 0.85rem 1.1rem 0.35rem;
        font-size: 0.75rem;
        font-weight: 700;
        color: #64748b;
        letter-spacing: 0.04em;
        flex-shrink: 0;
    }

    .ilj-drawer-channels {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        gap: 0;
        padding: 0.7rem 0.55rem 0.6rem;
        border-bottom: 1px solid #f1f5f9;
        flex-shrink: 0;
    }

    .ilj-drawer-channels a {
        flex: 1 1 0;
        min-width: 0;
        display: block;
        padding: 0.3rem 0.12rem;
        font-size: 0.7rem;
        font-weight: 700;
        text-align: center;
        white-space: nowrap;
        letter-spacing: -0.03em;
    }

    .ilj-drawer-nav {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0.25rem 0 0.75rem;
    }

    .ilj-drawer-foot {
        display: flex;
        flex-shrink: 0;
        align-items: stretch;
        justify-content: space-around;
        gap: 0.25rem;
        padding: 0.55rem 0.4rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid #e5e7eb;
        background: #fff;
    }

    .ilj-drawer-foot a {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        padding: 0.35rem 0.2rem;
        color: #374151;
        font-size: 0.7rem;
        font-weight: 600;
        text-align: center;
    }

    .ilj-drawer-foot svg {
        width: 1.4rem;
        height: 1.4rem;
        display: block;
    }

    .ilj-drawer-item {
        border-bottom: 1px solid #f1f5f9;
    }

    .ilj-drawer-row {
        display: flex;
        align-items: stretch;
    }

    .ilj-drawer-row > a {
        flex: 1;
        padding: 0.8rem 1.1rem;
        font-size: 0.98rem;
        font-weight: 600;
        color: #111827;
    }

    .ilj-drawer-acc {
        width: 2.75rem;
        border: 0;
        background: #fff;
        font-size: 1.25rem;
        color: #64748b;
        cursor: pointer;
    }

    .ilj-drawer-sub {
        display: none;
        background: #f8fafc;
        padding: 0.25rem 0 0.5rem;
    }

    .ilj-drawer-item.is-open .ilj-drawer-sub {
        display: block;
    }

    .ilj-drawer-sub a {
        display: block;
        padding: 0.55rem 1.1rem 0.55rem 1.6rem;
        font-size: 0.9rem;
        color: #334155;
    }

    /* 광고·아웃로그인 숨기고 본문 1열 */
    .ilj-side-ad,
    .grid-cols-\[1fr_auto_1fr\] > .justify-self-end,
    .grid-cols-\[1fr_auto_1fr\] > .justify-self-start,
    .grid-cols-\[1fr_auto_1fr\] .w-92\.5 {
        display: none !important;
    }

    .grid-cols-\[1fr_auto_1fr\] {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .grid-cols-\[1fr_auto_1fr\] > .w-default {
        flex-direction: column;
        width: 100% !important;
        max-width: 1440px;
        margin-left: auto;
        margin-right: auto;
    }

    .grid-cols-\[1fr_auto_1fr\] .max-w-260 {
        max-width: 100%;
        width: 100%;
        min-width: 0;
    }

    .max-w-default.py-10 {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }

    .ilj-yard-card {
        height: auto;
    }

    /* 마당 제목+메뉴를 열 단위로 묶은 그리드: 모바일에서 1열 */
    .ilj-yard-grid {
        grid-template-columns: 1fr !important;
        gap: 2.5rem !important;
        padding-left: 1rem;
        padding-right: 1rem;
        margin-top: 1.5rem;
    }

    /* 마당 그리드(.ilj-yard-grid)는 위 패딩 규칙을 유지 */
    .max-w-default > .grid.grid-cols-2:not(.ilj-yard-grid) {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
        padding-left: 0;
        padding-right: 0;
    }

    .max-w-default > .grid.grid-cols-2:not(.ilj-yard-grid).mt-10 {
        margin-top: 1.5rem;
    }

    .max-w-default > .grid.grid-cols-2 .text-xl {
        font-size: 1.05rem;
    }

    .max-w-default > .w-full.grid.grid-cols-2 {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .max-w-default a.h-12\.5 {
        height: auto;
        min-height: 3.125rem;
        padding: 0.5rem 0.4rem;
        font-size: 0.9rem;
        line-height: 1.3;
        text-align: center;
    }

    .max-w-default .group span.whitespace-nowrap {
        white-space: normal;
        max-width: min(18rem, 80vw);
        left: 50%;
        transform: translateX(-50%);
    }
}

@media (max-width: 639px) {
    .max-w-default .grid.grid-cols-2.gap-3 {
        grid-template-columns: 1fr !important;
    }

    .max-w-default .grid.grid-cols-2.gap-4 {
        grid-template-columns: 1fr !important;
    }

}
