/* Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-inline: var(--container-px);
}

/* Main content */
.main-content {
  padding-block: clamp(20px, 4vw, 48px);
  min-height: calc(100vh - 240px);
  /* body가 아닌 main에 overflow-x를 둠 — 가로 스크롤 차단하면서도 site-header의 sticky 유지 */
  overflow-x: clip;
}
@supports not (overflow-x: clip) {
  .main-content { overflow-x: hidden; }
}

/* Page header */
.page-header {
  text-align: center;
  margin-bottom: clamp(24px, 4vw, 48px);
}

.page-header h1 {
  font-size: var(--t-largeTitle-size);
  font-weight: var(--t-largeTitle-weight);
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.page-header .subtitle {
  font-size: var(--t-body-size);
  color: var(--secondary-label);
  font-weight: 400;
  line-height: 1.5;
  max-width: 60ch;
  margin: 0 auto;
}

/* Breadcrumb */
.breadcrumb {
  font-size: var(--t-footnote-size);
  color: var(--secondary-label);
  margin-bottom: 20px;
  word-break: keep-all;
}
.breadcrumb a {
  color: var(--ios-blue);
}
.breadcrumb a:hover {
  text-decoration: underline;
}

/* Section title */
.section-title {
  font-size: var(--t-title-size);
  font-weight: var(--t-title-weight);
  margin-block: 24px 16px;
}

/* Fair grid — responsive */
.fair-grid {
  display: grid;
  gap: clamp(12px, 2vw, 24px);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}

/* === Breakpoints ===
   < 480px : mobile 1col
   480-767 : large mobile 2col (auto-fill handles)
   768-1023: tablet 2-3col (auto-fill handles)
   ≥ 1024  : desktop 4col (auto-fill handles)
*/

/* Quick links */
.quick-links {
  margin-bottom: clamp(20px, 3vw, 40px);
}
.link-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

/* Region filters */
.region-filters {
  margin-bottom: clamp(24px, 4vw, 40px);
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.region-filters h2 {
  font-size: var(--t-headline-size);
  margin-bottom: 16px;
  font-weight: 600;
}
.filter-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

/* Footer */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--separator);
  margin-top: 60px;
  padding: clamp(24px, 4vw, 40px) 0;
  overflow-x: clip;
}
@supports not (overflow-x: clip) {
  .site-footer { overflow-x: hidden; }
}
.footer-content {
  text-align: center;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(12px, 2vw, 20px);
  justify-content: center;
  margin-bottom: 12px;
}
.footer-links a {
  color: var(--secondary-label);
  font-size: var(--t-footnote-size);
}
.footer-links a:hover {
  color: var(--ios-blue);
}
.copyright {
  color: var(--tertiary-label);
  font-size: var(--t-caption-size);
}

/* Post (info article) layout */
.post-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 1024px) {
  .post-container {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
}

/* Empty / loading / error */
.loading, .empty-message, .error-message {
  text-align: center;
  padding: 60px 20px;
  color: var(--secondary-label);
  font-size: var(--t-body-size);
  grid-column: 1 / -1;
}

/* Mobile: hide desktop nav, show menu button */
@media (max-width: 767px) {
  .nav-menu {
    display: flex;
    position: fixed;
    inset: 0 0 0 auto;
    width: min(85vw, 360px);
    height: 100vh;
    background: var(--bg-secondary);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 0 16px 24px;             /* 상단 padding 0 — menu-header가 차지 */
    transform: translateX(100%);
    transition: transform var(--transition-default), visibility 0s linear var(--transition-default);
    z-index: 999;
    /* 닫힌 상태: 보이지 않고 키보드/스크린리더 접근 차단 */
    visibility: hidden;
    pointer-events: none;
  }
  .nav-menu.active {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    /* 열릴 때는 transition delay 없이 즉시 표시 */
    transition: transform var(--transition-default), visibility 0s linear 0s;
  }
  /* 메뉴 상단 헤더 — JS가 동적 삽입 */
  .nav-menu .menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 4px 12px;
    border-bottom: 1px solid var(--separator);
    margin-bottom: 8px;
    margin-inline: -4px;
  }
  .nav-menu .menu-title {
    font-size: var(--t-headline-size);
    font-weight: 700;
    color: var(--label);
  }
  .nav-menu .menu-close {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--label);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
  }
  .nav-menu .menu-close:active { transform: scale(0.95); background: var(--separator); }

  .nav-menu li a {
    display: block;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    min-height: var(--touch-target);
  }
  .mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--touch-target);
    height: var(--touch-target);
    border-radius: var(--radius-md);
    color: var(--label);
  }
}

@media (min-width: 768px) {
  .mobile-menu-toggle {
    display: none;
  }
  .nav-menu {
    display: flex;
    gap: 2px;
    align-items: center;
  }
  /* PC에서는 menu-header(타이틀+닫기 버튼) 숨김 */
  .nav-menu .menu-header { display: none; }
}
