/**
 * 와이드 스크린 및 전체 화면 대응 스타일
 */

/* ===================================
   Wide Screen Support (1920px+)
   =================================== */

/* 최대 너비 제한 및 중앙 정렬 */
body {
  min-width: 320px;
  max-width: 100vw;
  overflow-x: hidden;
}

/* 메인 컨테이너 너비 제한 */
.section-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 3rem 2rem;
  width: 100%;
  box-sizing: border-box;
}

/* 전체 화면에서도 안정적인 레이아웃 */
@media (min-width: 1920px) {
  .section-container {
    max-width: 1600px;
    padding: 4rem 3rem;
  }
  
  /* 입력 폼 중앙 정렬 및 크기 제한 */
  #saju-form {
    max-width: 800px;
    margin: 0 auto;
  }
  
  /* 결과 섹션 최대 너비 */
  #results-section .section-container {
    max-width: 1400px;
  }
  
  /* 사주 테이블 크기 조정 */
  .saju-table {
    max-width: 900px;
    margin: 2rem auto;
    display: flex;
    justify-content: center;
    gap: 2rem;
  }
  
  .pillar {
    flex: 0 1 200px;
    max-width: 200px;
  }
  
  /* 해석 카드 그리드 개선 - 전체화면 최적화 */
  .interpretation {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
  }
  
  .interpretation-card {
    max-width: none;
    width: 100%;
    min-height: 250px;
  }
  
  /* 십성 그리드 최적화 */
  .ten-gods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    max-width: 1200px;
    margin: 0 auto;
    gap: 2rem;
  }
  
  /* 대운 타임라인 중앙 정렬 */
  .major-fortune-timeline {
    max-width: 1000px;
    margin: 2rem auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
  }
  
  /* 차트 컨테이너 크기 제한 */
  .chart-container {
    max-width: 500px;
    height: 400px;
    margin: 0 auto;
  }
  
  #fortune-chart {
    max-width: 900px;
    margin: 0 auto;
    height: 400px;
  }
  
  /* 오행 분석 섹션 */
  .elements-analysis {
    max-width: 800px;
    margin: 2rem auto;
  }
  
  /* 균형 분석 */
  .balance-analysis {
    max-width: 700px;
    margin: 2rem auto;
  }
  
  /* 정보 그리드 */
  .info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    max-width: 1200px;
    margin: 0 auto;
    gap: 2rem;
  }
}

/* ===================================
   Ultra Wide Screen (2560px+)
   =================================== */

@media (min-width: 2560px) {
  .section-container {
    max-width: 1800px;
    padding: 5rem 4rem;
  }
  
  /* 폰트 크기 약간 증가 */
  body {
    font-size: 18px;
  }
  
  .section-title {
    font-size: 3rem;
  }
  
  .interpretation-card h3 {
    font-size: 1.8rem;
  }
  
  /* 더 큰 화면에서 3열 레이아웃 */
  .interpretation {
    grid-template-columns: repeat(3, 1fr);
    max-width: 1800px;
    gap: 2.5rem;
  }
  
  .interpretation-card {
    max-width: none;
  }
  
  .ten-gods-grid {
    grid-template-columns: repeat(4, 1fr);
    max-width: 1600px;
  }
}

/* ===================================
   Container Queries (모던 브라우저)
   =================================== */

@container (min-width: 1400px) {
  .interpretation-card {
    padding: 2.5rem;
  }
  
  .ten-god-item {
    padding: 2rem;
  }
}

/* ===================================
   Flexbox 대체 레이아웃
   =================================== */

/* 플렉스박스로 중앙 정렬 보장 */
#results-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

#results-section > * {
  width: 100%;
  max-width: 1600px;
}

/* ===================================
   레이아웃 안정성 개선
   =================================== */

/* 고정 비율 유지 */
.pillar {
  aspect-ratio: 1 / 1.5;
  min-height: 150px;
}

/* 카드 고정 비율 유지 */
.interpretation-card {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.interpretation-card h3 {
  flex-shrink: 0;
}

.interpretation-card > div,
.interpretation-card > p {
  flex-grow: 1;
}

/* ===================================
   반응형 텍스트 크기
   =================================== */

/* 뷰포트 기반 폰트 크기 (최소/최대값 설정) */
.hero-title .brush-stroke {
  font-size: clamp(2rem, 5vw, 4rem);
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
}

.interpretation-card h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
}

/* ===================================
   스크롤바 스타일링
   =================================== */

/* 와이드 스크린에서 스크롤바 개선 */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #d4a574;
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: #b8935f;
}

/* ===================================
   그리드 갭 조정
   =================================== */

@media (min-width: 1440px) {
  .ten-gods-grid {
    gap: 2.5rem;
  }
  
  .major-fortune-timeline {
    gap: 3rem;
  }
  
  .interpretation {
    gap: 2.5rem;
  }
}

/* ===================================
   헤더/푸터 전체 화면 대응
   =================================== */

#site-header {
  width: 100%;
  max-width: 100vw;
}

.header-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1rem 2rem;
}

#site-footer {
  width: 100%;
  max-width: 100vw;
}

.footer-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 2rem;
}

/* ===================================
   히어로 섹션 전체 화면 대응
   =================================== */

#hero-section {
  width: 100%;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-content {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
  text-align: center;
}

/* 나침반 크기 제한 */
.bagua-compass {
  max-width: 400px;
  max-height: 400px;
  margin: 2rem auto;
}

@media (min-width: 1920px) {
  .bagua-compass {
    max-width: 500px;
    max-height: 500px;
  }
}
/* 사주 테이블 전체 화면 최적화 */

.saju-table {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  margin: 2rem auto;
  max-width: 800px;
  width: 100%;
  flex-wrap: wrap;
}

.pillar {
  flex: 0 1 160px;
  min-width: 120px;
  max-width: 180px;
  padding: 1.5rem 1rem;
  background: linear-gradient(135deg, #fff9f5 0%, #fef5ee 100%);
  border: 2px solid var(--primary-color, #8b4513);
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pillar:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.pillar-title {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.5rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.heavenly-stem {
  font-size: 2rem;
  font-weight: bold;
  color: var(--primary-color, #8b4513);
  margin: 0.5rem 0;
  font-family: 'Nanum Myeongjo', serif;
}

.earthly-branch {
  font-size: 2rem;
  font-weight: bold;
  color: var(--secondary-color, #d4a574);
  margin: 0.5rem 0;
  font-family: 'Nanum Myeongjo', serif;
}

/* 전체 화면에서 사주 테이블 레이아웃 */
@media (min-width: 1920px) {
  .saju-table {
    max-width: 900px;
    gap: 2rem;
  }
  
  .pillar {
    flex: 0 1 180px;
    max-width: 200px;
    padding: 2rem 1.5rem;
  }
  
  .heavenly-stem,
  .earthly-branch {
    font-size: 2.5rem;
  }
}

/* 초대형 화면 (2560px+) */
@media (min-width: 2560px) {
  .saju-table {
    max-width: 1000px;
    gap: 2.5rem;
  }
  
  .pillar {
    flex: 0 1 200px;
    max-width: 220px;
  }
}

/* 모바일에서 2x2 그리드 */
@media (max-width: 640px) {
  .saju-table {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    max-width: 400px;
  }
  
  .pillar {
    min-width: unset;
    max-width: unset;
  }
}

/* 다크 모드 대응 */
@media (prefers-color-scheme: dark) {
  .pillar {
    background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 100%);
    border-color: #d4a574;
  }
  
  .pillar-title {
    color: #aaa;
  }
  
  .heavenly-stem {
    color: #e6c598;
  }
  
  .earthly-branch {
    color: #d4a574;
  }
}
