/* ==========================================================================
   layout.css — 공통 레이아웃
   페이지 구조, 컨테이너, 섹션 간격 등 기본 레이아웃 규칙
   UPDATED: 2026/04/09 — 반응형 추가, .wrap→.page-wrap, section 태그셀렉터 제거
   ========================================================================== */

/* ------------------------------------------------------------------
   기본 글로벌 스타일
   ------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--wyd-font-body);
  color: var(--wyd-text);
  background-color: var(--wyd-bg);
  line-height: var(--wyd-lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  letter-spacing: var(--wyd-ls-normal);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--wyd-font-heading);
  font-weight: var(--wyd-fw-bold);
  line-height: var(--wyd-lh-tight);
  color: var(--wyd-text);
}

/* ------------------------------------------------------------------
   .page-wrap — 전체 페이지 래퍼
   주의: 레거시 .wrap과 충돌 방지를 위해 .page-wrap 사용
   ------------------------------------------------------------------ */
.page-wrap {
  position: relative;
  min-height: 100vh;
  padding-top: var(--wyd-header-height);
}

@media (max-width: 767.98px) {
  .page-wrap {
    padding-top: var(--wyd-header-height-mobile);
  }
}

/* ------------------------------------------------------------------
   .contents — 메인 콘텐츠 영역
   ------------------------------------------------------------------ */
.contents {
  width: 100%;
  max-width: var(--wyd-max-width);
  margin: 0 auto;
  padding: var(--wyd-space-xl) var(--wyd-space-md);
}

@media (max-width: 767.98px) {
  .contents {
    padding: var(--wyd-space-md) var(--wyd-space-sm);
  }
}

/* ------------------------------------------------------------------
   .inner — 내부 콘텐츠 래퍼
   ------------------------------------------------------------------ */
.inner {
  width: 100%;
  max-width: var(--wyd-max-width);
  margin: 0 auto;
  padding: 0 var(--wyd-space-md);
}

/* ------------------------------------------------------------------
   컨테이너 변형
   ------------------------------------------------------------------ */
.container-narrow {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--wyd-space-md);
}

/* ------------------------------------------------------------------
   섹션 간격 — 클래스 기반 (.wyd-section)
   태그 셀렉터(section) 대신 클래스 사용으로 레거시 충돌 방지
   ------------------------------------------------------------------ */
.wyd-section {
  padding: var(--wyd-space-3xl) 0;
}

@media (max-width: 767.98px) {
  .wyd-section {
    padding: var(--wyd-space-xl) 0;
  }
}

/* 섹션 제목 */
.section-title {
  font-family: var(--wyd-font-heading);
  font-size: clamp(1.25rem, 3vw, var(--wyd-fs-2xl));
  font-weight: var(--wyd-fw-bold);
  color: var(--wyd-text);
  margin-bottom: var(--wyd-space-sm);
}

.section-subtitle {
  font-size: var(--wyd-fs-md);
  color: var(--wyd-text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* ------------------------------------------------------------------
   그리드 레이아웃 헬퍼 (Bootstrap 보완)
   반응형 내장
   ------------------------------------------------------------------ */
.grid {
  display: grid;
  gap: var(--wyd-space-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--wyd-space-lg);
}

@media (max-width: 767.98px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 768px) and (max-width: 1023.98px) {
  .grid-3, .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ------------------------------------------------------------------
   구분선
   ------------------------------------------------------------------ */
.divider {
  border: none;
  border-top: 1px solid var(--wyd-border-light);
  margin: var(--wyd-space-xl) 0;
}

/* ------------------------------------------------------------------
   페이지 제목 영역 (.page-header)
   ------------------------------------------------------------------ */
.page-header {
  background-color: var(--wyd-primary);
  color: var(--wyd-text-inverse);
  padding: var(--wyd-space-3xl) 0;
  text-align: center;
}

.page-header h1 {
  font-size: clamp(1.5rem, 4vw, var(--wyd-fs-3xl));
  color: var(--wyd-text-inverse);
  margin-bottom: var(--wyd-space-sm);
}

.page-header p {
  font-size: var(--wyd-fs-md);
  opacity: 0.85;
}

/* ------------------------------------------------------------------
   푸터 기본 레이아웃 (.footer)
   ------------------------------------------------------------------ */
.footer {
  background-color: var(--wyd-text);
  color: var(--wyd-text-inverse);
  padding: var(--wyd-space-3xl) 0 var(--wyd-space-xl);
  margin-top: auto;
}

.footer a {
  color: var(--wyd-accent);
  text-decoration: none;
  transition: opacity var(--wyd-transition-base);
}

.footer a:hover {
  opacity: 0.8;
}

/* ------------------------------------------------------------------
   WYD 주제 타이포그래피
   ------------------------------------------------------------------ */
.wyd-theme-verse {
  font-family: 'Pretendard', sans-serif;
  font-weight: 100;
  letter-spacing: var(--wyd-ls-tight);
  line-height: 1.1;
}
.wyd-theme-citation {
  font-family: 'Pretendard', sans-serif;
  font-weight: 300;
  font-size: 0.5em;
  letter-spacing: var(--wyd-ls-normal);
}
