html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: 'Nanum Gothic', sans-serif;
    background: #ffffff;
    color: #222;

}

.top-bar {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    height: 52px; /* 헤더+로고 높이 맞추기 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #fff;
    z-index: 100;
    border-bottom: 1px solid #e0e0e0;
}

.logo {
    font-size: 1.25em;
    margin: 0 0 11px 42px; /* 왼쪽 정렬, 아래 여백 */
    color: #222;
}

.logo a {
    text-decoration: none;
    color: #222;
}

.layout-wrapper {
    display: flex;
    flex-direction: row;
    max-width: 1800px;
    gap: 48px;
    box-sizing: border-box;
    padding: 25px;
    /* min-height, height, flex: 1 0 auto; 등 제거 */
}

.main-content {
    display: flex;
    flex-direction: row;
    justify-content: center;   /* 가로 중앙 정렬 */
    align-items: flex-start;       /* 세로 중앙 정렬 */
    width: 85.5vw;
    height: 85vh;
    gap: 20px;
    min-height: 60vh;
}

main {
    flex: 1 0 auto;
    margin-top: 54px; /* .top-bar 높이만큼 띄움 */
    padding-left: 230px; /* side-col의 width와 동일하게 */
}

.side-col {
    position: fixed;
    top: 52px; /* .top-bar의 높이와 맞춤 */
    left: 0px;
    width: 160px; /* 원하는 너비로 조정 */
    height: calc(100vh - 52px); /* 화면 전체 높이에서 top-bar 제외 */
    border-right: 1px solid #e0e0e0;
    padding: 0 20px;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    z-index: 99;
}

.nav {
    display: flex;
    margin-top: 5vh;
    flex-direction: column;
    align-items: flex-start;
    gap: 11px;
    width: 100%;
    
}

.nav-link {
    text-decoration: none;
    color: #222;
    font-size: 1em;
    font-weight: 400;
    padding: 2px 0 2px 0;
    transition: color 0.2s, font-weight 0.2s;
}

.nav-link.active {
    font-weight: 700;
}

.nav-link.submenu {
    padding-left: 24px;
    font-size: 0.9em;
    color: #444;
    position: relative;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 1.2; /* 줄간격도 살짝 줄임 */
}

.nav-link.submenu::before {
    content: "-";
    margin-right: 8px;
    color: #888;
    position: absolute;
    left: 8px;
}

.nav-link:hover {
    color: #888;
}

.nav a {
    text-decoration: none;
    color: #222;
    font-size: 1em;
    font-weight: 500;
    transition: color 0.2s;
}

.nav a:hover {
    color: #888;
}

.nav-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: left;
    position: relative;
}

.nav-group-btn {
    background: none;
    border: none;
    color: #222;
    font-size: 1em;
    font-weight: 500; /* 기존: 500, 더 얇게 하고 싶으면 normal 또는 400 */
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    margin-bottom: 0;
    width: 100%;
    text-align: center;
    outline: none;
    /* a 태그와 동일하게 */
    transition: color 0.2s;
}

.nav-group-btn:hover,
.nav-group.open > .nav-group-btn {
    color: #888;
    text-decoration: underline;
}

.nav-submenu {
    display: none;
    flex-direction: column;
    gap: 8px;
    margin: 4px 0 4px 16px;
    width: 100%;
}

.nav-group.open .nav-submenu {
    display: flex;
}

.nav-submenu a {
    color: #222;
    text-decoration: none;
    font-size: 0.98em;
    padding-left: 12px;
    position: relative;
}

.nav-submenu a::before {
    content: "-";
    margin-right: 6px;
    color: #888;
}

.article {
    min-width: 650px;        /* 너무 작아지지 않게 */
    max-width: 650px;        /* 최대 너비 제한 */
    padding: 25px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    word-break: keep-all;    /* 단어 단위 줄바꿈 */
    font-size: 0.98em;
    line-height: 1.5;
    margin-bottom: 16px;
    color: #222;
}

.main-article {
    min-width: 450px;        /* 너무 작아지지 않게 */
    max-width: 450px;        /* 최대 너비 제한 */
    padding: 5px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    word-break: keep-all;    /* 단어 단위 줄바꿈 */
    font-size: 0.98em;
    line-height: 1.2;
    margin-bottom: 16px;
    color: #222;
    align-self: flex-start;       
}

.main-article p{
    margin: 15px ; 
}


.main-image {
    display: flex;
    align-self: flex-start;   
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    max-width: 2160px;      /* 원하는 최대 너비 */
    min-width: 480px;
    margin: 0 auto;
    position: relative;
}

.main-image video {
    width: 100%;
    height: 100%;
    object-fit: cover;     /* 프레임에 꽉 채움, 잘릴 수 있음 */
    box-shadow: 0 6px 32px rgba(0,0,0,0.12);
    display: block;
}


.about-content {
    display: flex;
    flex-direction: row;
    justify-content: center;   /* 가로 중앙 정렬 */
    align-items: flex-start;       /* 세로 중앙 정렬 */
    width: 85.5vw;
    height: 85vh;
    gap: 20px;
    min-height: 60vh;
    max-width: 1200px;
}

.about-image {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    max-width: 520px;      /* 원하는 최대 너비 */
    min-width: 500px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

.footer {
    text-align: center;
    color: #888;
    padding: 3px 0;
    font-size: 0.7em;

    margin-top: auto; /* footer를 항상 아래로 밀어줌 */
    width: 100%;
}

.gallery {
    position: relative;
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
}

.gallery-grid {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 16px;
    height: 100%;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    cursor: pointer;
    /* 테두리 제거 */
    /* 사진 축소 */
    transform: scale(0.96);
    transition: filter 0.3s, transform 0.3s;
    filter: brightness(0.8); /* 불투명 필터 */
}

.gallery-item:hover {
    filter: none;
    transform: scale(0.96); /* 마우스 오버시 애니메이션 없음 */
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}



.ad-gallery-grid {
    display: flex !important;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    /* grid 관련 속성 오버라이드 */
}

/* 광고/미디어 갤러리: 데스크탑에서도 iframe이 컨테이너에 꽉 차도록 강제 */
.ad-gallery-grid .gallery-item,
.gallery-grid.ad-gallery-grid .gallery-item {
    width: 100%;
    max-width: 100%;
    padding: 0;
    box-sizing: border-box;
}

.ad-gallery-grid .gallery-item iframe,
.gallery-grid.ad-gallery-grid iframe,
.gallery-grid .gallery-item iframe {
    display: block;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16/9; /* 필요시 변경 가능 */
    max-width: 100% !important;
}

.caption {
    position: absolute;

    padding: 4px 10px;
    font-size: 1em;
    text-align: left;
    background: rgba(0, 0, 0, 0.553);
    color: #ffffff;
    border: none;
    line-height: 1;

    width: 100%;
}

/* 상세창 오버레이 */
.gallery-detail {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.851);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    box-sizing: border-box;
}

.gallery-detail img,
#detail-media img,
.gallery-detail iframe,
#detail-media iframe,
.gallery-detail video,
#detail-media video {
    max-width: 60vw;      /* 더 크게 */
    max-height: 80vh;
    object-fit: contain;
    background: #fff;
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    display: block;
}

#detail-media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 80vh;
    margin-bottom: 0; /* 기존 하단 캡션을 오버레이로 바꾸므로 간격 제거 */
}

/* 상세 모달에서 이미지 위 좌상단 캡션(썸네일과 동일 위치/스타일) */
.detail-caption-overlay {
    position: absolute;
    top: 18px;
    left: 18px;
    transform: none;
    background: rgba(0,0,0,0.56);
    color: #fff;
    padding: 6px 10px;

    font-size: 0.95em;
    line-height: 1.2;
    text-align: left;
    max-width: calc(100% - 36px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.28);
    white-space: normal;
    pointer-events: none; /* 클릭 통과 */
    z-index: 20;
}

/* 상세창의 설명(하단 중앙) — 좌우 길이 넉넉하게, 화면 폭에 맞춰 제한 */
.detail-desc-overlay {
    position: absolute;
    right: 18px;
    bottom: 18px;
    transform: none;
    display: inline-block;                /* 텍스트 길이에 맞게 */
    background: rgba(0, 0, 0, 0.775);
    color: #fff;
    padding: 4px 6px;
    font-size: 0.8em;
    line-height: 1.2;
    text-align: right;                    /* 텍스트 우측 정렬 */
    max-width: calc(100% - 36px);         /* 이미지 내부 여유 확보 */
    width: auto;                          /* 내용 길이에 맞춤 */
    box-shadow: 0 6px 20px rgba(0,0,0,0.28);
    white-space: normal;
    pointer-events: none;                 /* 클릭 통과 */
    z-index: 20;
}



/* 미니맵을 갤러리의 오른쪽에 "고정" */
.gallery-minimap {
    min-width: 80px;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    margin-right: 20px;
    position: relative;
    z-index: 2;
}



/* 미니맵 내부 */
.minimap-overview {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
    width: 96px;
    padding: 8px 0;
}

.minimap-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 3px;
    width: 96px;
    height: 72px;
    padding: 2px;
    box-sizing: border-box;
    opacity: 0.5;
    transition: border 0.2s, opacity 0.2s;

}

.minimap-page.active {
    border: 2px solid #282828;
    opacity: 1;
}

.minimap-thumb {
    width: 100%;
    height: 30.5px;
    object-fit: cover;
    background: #eee;
}



.ad-minimap-overview {
    /* 광고 미니맵 전용 스타일 */
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
    width: 96px;
    padding: 8px 0;
}

.ad-minimap-page {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 72px;
    padding: 2px;
    box-sizing: border-box;
    opacity: 1;
    transition: border 0.2s, opacity 0.2s;
}

.ad-minimap-page.active {
    border: 2px solid #000000;
    opacity: 1;
}

.ad-minimap-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    background: #eee;
    display: block;
}

.slideshow {
  position: relative;
  width: 100%;
  max-width: 1080px;
  height: auto;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: #000;
}
.slideshow .slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1s ease;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.slideshow .slide.active {
  opacity: 1;
  z-index: 2;
  pointer-events: auto;
}
.slideshow img,
.slideshow video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

/* 클릭해서 음소거 해제 안내 아이콘 */
.slideshow .vol-indicator {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: rgba(0,0,0,0.45);
  color: #fff;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 3;
  cursor: pointer;
  user-select: none;
  display: none;
}
.slideshow .slide.video .vol-indicator {
  display: block;
}
.slideshow .vol-indicator.muted::after { content: "Muted"; }
.slideshow .vol-indicator.unmuted::after { content: "Sound"; }

/* responsive menu button + overlay */
.menu-button {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);

  display: none;              /* 기본 숨김 */
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 6px;
  box-sizing: border-box;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 120;
  line-height: 0;
  border-radius: 6px;

  /* 강제 레이아웃(하지만 display은 미디어쿼리에서 켬) */
  flex-direction: column;
  gap: 4px;
}

/* 각 막대 스타일 (오타 제거) */
.menu-button .bar {
  display: block;
  width: 22px;
  height: 1.5px;
  background: #222;
  border-radius: 1px;
  margin: 0;
  box-shadow: none;
  transform: none;
  opacity: 1;
  transition: background .16s ease;
}

/* 화면이 작을 때만 보이게 */
@media (max-width: 1024px) {
  .menu-button { display: flex !important; }
}

/* overlay behind nav when open */
.nav-overlay {
    display: none;
}

/* show button on small screens and allow side-col to slide in when body.nav-open */
@media (max-width: 1024px) {
    .menu-button { display: flex; }

    /* default: hide side-col (keeps existing behavior) but prepare for transform */
    .side-col {
        display: none;
        transform: translateX(-100%);
        transition: transform .28s ease;
    }

    /* when nav opened, show side-col as an overlay panel */
    body.nav-open .side-col {
        display: flex;
        transform: translateX(0);
        position: fixed;
        top: 52px;
        left: 0;
        height: calc(100vh - 52px);
        width: 240px; /* 너비 조정 가능 */
        padding: 12px 16px;
        background: #fff;
        border-right: 1px solid rgba(0,0,0,0.08);
        z-index: 130;
        box-shadow: 2px 8px 30px rgba(0,0,0,0.12);
    }

    /* show overlay to dim page; clicks on overlay close menu */
    .nav-overlay {
        display: none;
        position: fixed;
        inset: 52px 0 0 0; /* top-bar 아래부터 */
        background: rgba(0,0,0,0.36);
        z-index: 125;
    }
    body.nav-open .nav-overlay {
        display: block;
    }

    /* when nav open, prevent page scroll */
    body.nav-open {
        overflow: hidden;
    }
}

/* small visual tweak: transform bars when open (JS will toggle .open on button) */
.menu-button.open .bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-button.open .bar:nth-child(2) { opacity: 0; }
.menu-button.open .bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Responsive: tablet / small desktop */
@media (max-width: 1024px) {
  .layout-wrapper { padding: 18px; gap: 20px; max-width: 100%; }
  main { padding-left: 0; margin-top: 54px; }
  .side-col { display: none; } /* 사이드 메뉴 숨김(모바일에서는 상단/햄버거로 대체 권장) */
  .main-content, .about-content { width: 100%; height: auto; gap: 20px; justify-content: center; }
  .main-content { max-width: 980px; }
  .article, .main-article { max-width: 100%; min-width: 0; padding: 18px; }
  .about-image { max-width: 420px; min-width: 0; padding: 12px; }
  .main-image { min-width: 0; max-width: 100%; padding: 12px; }
  .slideshow { max-width: 100%; aspect-ratio: 16/9; }
}

/* Mobile: narrow phones */
@media (max-width: 768px) {
  html, body { font-size: 17px; }
  .layout-wrapper { flex-direction: column; padding: 14px; gap: 12px; }
  main { margin-top: 52px; padding-left: 0; }
  .main-content, .about-content { flex-direction: column; align-items: center; gap: 12px; padding: 0; }
  .article, .main-article { padding: 12px; width: 100%; box-sizing: border-box; }
  .about-image { padding: 8px; width: 100%; max-width: 520px; }
  .main-image { width: 100%; min-width: 0; }
  .gallery-grid { grid-template-columns: 1fr; grid-template-rows: auto; gap: 10px; }
  .gallery-item { transform: none; height: auto; }
  .gallery-item img { height: auto; max-height: 48vh; }
  .gallery-minimap, .minimap-overview { display: none; } /* 작은 화면에서 미니맵 숨김 */
  .slideshow { aspect-ratio: 16/9; height: auto; }
  .ad-gallery-grid .gallery-item iframe { width: 100%; height: auto; }
  .caption { font-size: 0.95em; padding: 6px 10px; }
  .detail-caption-overlay { top: 12px; left: 12px; font-size: 0.9em; padding: 6px 8px; }
  .detail-desc-overlay { right: 12px; bottom: 12px; font-size: 0.88em; padding: 6px 8px; max-width: 92vw; }
  .nav {
    margin-top: 8px; /* 기존 2vh보다 작게 */
    gap: 6px;        /* 항목 간 세로 간격 축소 */
    font-size: 1.3em;
  }
  .nav-link,
  .nav-submenu a,
  .nav-group-btn {
    line-height: 0.8;
  }
  .nav-group { gap: 2px; }
}


/* Very small (phones) */
@media (max-width: 480px) {
  body { font-size: 12px; }
  .logo { margin-left: 24px; font-size: 1.6em; }
  .layout-wrapper { padding: 10px; gap: 8px; }
  .slideshow { aspect-ratio: 4/3; }
  .gallery-item img, .gallery-detail img { max-height: 40vh; }
  .article { padding: 10px; font-size: 0.95em; line-height: 1.35; }
  .caption { font-size: 0.92em; }
}

/* Accessibility / touch: make interactive targets larger on small screens */
@media (max-width: 768px) {
  .nav-link, .nav-group-btn { padding: 10px 6px; width: 100%; box-sizing: border-box; }
  .gallery-item { min-height: 110px; }
}

/* Optional: prevent overflow horizontal on tiny screens */
@media (max-width: 1024px) {
  html, body { overflow-x: hidden; }
}

/* 터치/모바일 장치에서는 :hover 기반의 축소/확대 효과 무시 */
@media (hover: none), (max-width: 768px) {
  .gallery-item:hover {
    transform: none !important;
  }
  /* 혹시 :active 상태도 스타일이 있다면 기본 상태 유지 */
  .gallery-item:active {
    transform: none !important;
  }
}

/* 모바일에서 갤러리 항목을 세로 1열로 강제하고 iframe/video를 가로로 꽉 채움 */
@media (max-width: 768px) {
  .gallery-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-auto-rows: auto;
    gap: 12px;
  }

  .gallery-grid .gallery-item {
    width: 100%;
    box-sizing: border-box;
    position: relative;
  }

  /* iframe / video를 컨테이너 폭에 맞춤 */
  .gallery-grid iframe,
  .gallery-grid video {
    width: 100% !important;
    height: auto !important;
    display: block;
  }
}

