/* ======================================
   Gallery Window – MOBILE FINAL
====================================== */

@media (max-width:768px){

/* =========================
   공통
========================= */

html, body{
  overflow-x:hidden;
}

main,
.site-header,
.exhibitions,
.main-links,
.bottom-area{
  padding-left:16px;
  padding-right:16px;
  box-sizing:border-box;
}

/* =========================
   HOME (대표화면)
========================= */

.exhibitions{
  display:grid;
  grid-template-columns:1fr;
  gap:40px;
}

.exhibition{
  width:100%;
  max-width:320px;
  margin:0 auto;
}

.exhibition img{
  width:100%;
  height:auto;
  display:block;
}

/* 클릭 방해 방지 */
.exhibition-badge{
  pointer-events:none;
}

/* =========================
   ARCHIVE
========================= */

.archive-grid{
  display:grid;
  gap:14px;
  width:100%;
  padding:0 12px;
  box-sizing:border-box;
}

/* 예정 전시 */
body.upcoming-page .archive-grid{
  grid-template-columns:repeat(3,1fr);
}

/* 지난 전시 */
body.archive-page:not(.upcoming-page) .archive-grid{
  grid-template-columns:repeat(4,1fr);
}

/* 카드 밀림 방지 */
.poster-item{
  width:100%;
  min-width:0;
}

.poster-item img{
  width:100%;
  height:auto;
  display:block;
}

.archive-grid .poster-item{
  min-width:0;
}

/* =========================
   HALL
========================= */

.hall-entry{
  display:flex;
  flex-direction:column;
  width:100%;
  padding:0 16px;
}

.hall-left,
.artist-note-area{
  width:100%;
  max-width:100%;
  margin:0 auto;
}

.hall-poster{
  width:100%;
  max-width:320px;
  margin:0 auto;
  display:block;
}

/* =========================
   EXHIBITION DETAIL
========================= */

/* 포스터 */
body.exhibition-detail figure.exhibition-poster img{
  width:90%;
  height:auto;
  display:block;
  margin:0 auto;
}

/* 텍스트 영역 */
body.exhibition-detail #note-profile{
  width:100%;
  max-width:100%;
  padding:0 10px;
  box-sizing:border-box;
}

body.exhibition-detail .exhibition-text{
  width:100%;
  max-width:100%;
  margin:0;
}

/* =========================
   버튼
========================= */

.main-links{
  margin:40px auto;
}

/* =========================
   안정화
========================= */

img{
  max-width:100%;
  height:auto;
}

*{
  box-sizing:border-box;
}

}

@media (max-width:768px){

  /* 🔥 archive 강제 적용 */
  body.archive-page .archive-grid{
    display:grid !important;
    grid-template-columns:repeat(3,1fr) !important;
    gap:12px !important;
    padding:0 12px !important;
    margin:0 auto !important;
  }

  body.archive-page:not(.upcoming-page) .archive-grid{
    grid-template-columns:repeat(4,1fr) !important;
  }

  /* 🔥 카드 밀림 차단 */
  body.archive-page .poster-item{
    width:100% !important;
    min-width:0 !important;
  }

  /* 🔥 상세 포스터 */
  body.exhibition-detail figure.exhibition-poster img{
    width:90% !important;
    margin:0 auto !important;
    display:block !important;
  }

  /* 🔥 텍스트 여백 */
  body.exhibition-detail #note-profile{
    padding:0 10px !important;
  }

}

@media (max-width:768px){

  /* 🔥 부모 컨테이너 강제 초기화 (핵심) */
  body.archive-page main,
  body.archive-page section{
    width:100% !important;
    max-width:100% !important;
    margin:0 auto !important;
    padding-left:0 !important;
    padding-right:0 !important;
  }

  /* 🔥 grid 정상화 */
  body.archive-page .archive-grid{
    display:grid !important;
    grid-template-columns:repeat(3,1fr) !important;
    gap:12px !important;
    width:100% !important;
    margin:0 auto !important;
  }

  /* 지난 전시 */
  body.archive-page:not(.upcoming-page) .archive-grid{
    grid-template-columns:repeat(4,1fr) !important;
  }

  /* 🔥 카드 밀림 차단 */
  body.archive-page .poster-item{
    min-width:0 !important;
  }

}

@media (max-width:768px){

  /* 🔥 진짜 대상: poster-grid */
  body.archive-page .poster-grid{
    display:grid !important;
    grid-template-columns:repeat(3,1fr) !important;
    gap:12px !important;
    width:100% !important;
    margin:0 auto !important;
    padding:0 12px !important;
  }

  /* 지난 전시 */
  body.archive-page:not(.upcoming-page) .poster-grid{
    grid-template-columns:repeat(4,1fr) !important;
  }

  /* 🔥 밀림 방지 핵심 */
  body.archive-page .poster-item{
    width:100% !important;
    min-width:0 !important;
  }

  /* 이미지 넘침 방지 */
  body.archive-page .poster-item img{
    width:100% !important;
    height:auto !important;
    display:block;
  }

}