/*
 Theme Name:   GeneratePress Child
 Theme URI:    https://generatepress.com
 Description:  Default GeneratePress child theme
 Author:       Tom Usborne
 Author URI:   https://tomusborne.com
 Template:     generatepress
 Version:      0.1
*/

/* =====================================================
   데스크톱 스타일 (1025px 이상)
===================================================== */
@media (min-width: 1025px) {
  /* 전체 컨테이너 너비 확장 */
  .container.grid-container {
    max-width: 1260px !important;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
  }
  
  /* 본문 + 사이드바 2단 grid 레이아웃 */
  .generate-columns-container {
    display: grid !important;
    grid-template-columns: 1000px 260px !important;
    column-gap: 0 !important;
    box-sizing: border-box;
  }
  
  /* 본문 wrapper */
  #primary.content-area {
    width: 1000px !important;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
  }
  
  /* 아티클 내부 전체 */
  .inside-article {
    width: 100%;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
  }
  
  /* 본문 내용: 900px 고정, 가운데 정렬 */
  .entry-content {
    width: 900px !important;
    margin-left: 0px !important;
    margin-right: 0px !important;
    box-sizing: border-box;
  }
  
  /* 내부 요소들 */
  .entry-content > * {
    max-width: 100% !important;
    box-sizing: border-box;
  }
  
  /* 사이드바 */
  #right-sidebar {
    width: 360px !important;
    box-sizing: border-box;
  }
}

/* =====================================================
   모바일/태블릿 공통 스타일 (1024px 이하)
===================================================== */
@media (max-width: 1024px) {
  /* 전체 컨테이너 */
  .container.grid-container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 15px !important;
    margin: 0 auto !important;
    box-sizing: border-box;
  }
  
  /* 본문 + 사이드바 1단 레이아웃 */
  .generate-columns-container {
    display: block !important;
    grid-template-columns: none !important;
    width: 100% !important;
  }
  
  /* 본문 영역 */
  #primary.content-area {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  /* 아티클 내부 */
  .inside-article {
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  /* 본문 내용 */
  .entry-content {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0 !important;
  }
  
  /* 본문 내부 모든 요소 */
  .entry-content > * {
    max-width: 100% !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }
  
  /* 사이드바 */
  #right-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 30px !important;
    padding: 0 !important;
  }
  
  /* ★★★ 메인 페이지 글 목록 (custom-post-box) 모바일 최적화 ★★★ */
  .custom-post-box {
    display: block !important; /* flex → block으로 변경 */
    gap: 0 !important;
    margin-bottom: 30px !important;
    padding: 15px !important;
    border: 1px solid #e9e9e9 !important;
    border-radius: 10px !important;
    background: #fff !important;
  }
  
  /* 썸네일 영역 */
  .custom-post-box .custom-thumb {
    flex-shrink: 1 !important;
    width: 100% !important;
    margin-bottom: 15px !important;
  }
  
  .custom-post-box .custom-thumb img {
    width: 100% !important;
    height: auto !important;
    display: block !important;
    border-radius: 8px !important;
  }
  
  /* 제목/요약 영역 */
  .custom-post-box .custom-summary {
    width: 100% !important;
  }
  
  .custom-post-box .custom-summary h3 {
    font-size: 16px !important;
    line-height: 1.4 !important;
    margin: 0 0 10px 0 !important;
  }
  
  .custom-post-box .custom-summary .excerpt {
    font-size: 14px !important;
    line-height: 1.5 !important;
  }
  
  /* 이미지 반응형 */
  img {
    max-width: 100% !important;
    height: auto !important;
  }
  
  /* 표(table) 반응형 */
  table {
    width: 100% !important;
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  /* pre, code 블록 반응형 */
  pre {
    max-width: 100% !important;
    overflow-x: auto !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
  }
}

/* =====================================================
   모바일 전용 (768px 이하)
===================================================== */
@media (max-width: 768px) {
  .container.grid-container {
    padding: 0 10px !important;
  }
  
  .custom-post-box {
    padding: 10px !important;
    margin-bottom: 20px !important;
  }
  
  .custom-post-box .custom-summary h3 {
    font-size: 15px !important;
  }
  
  .custom-post-box .custom-summary .excerpt {
    font-size: 13px !important;
  }
  
  /* 관련글 카드 모바일 최적화 */
  .related-posts a {
    display: block !important;
    flex-direction: column !important;
    padding: 15px !important;
  }
  
  .related-posts a > div:first-child {
    width: 100% !important;
    height: auto !important;
    margin-right: 0 !important;
    margin-bottom: 15px !important;
  }
  
  .related-posts a img {
    width: 100% !important;
    height: auto !important;
  }
  
  .related-posts h3 {
    font-size: 16px !important;
  }
  
  .related-posts p {
    font-size: 13px !important;
  }
  
  /* 검색창 */
  .widget_search input[type="search"] {
    width: 100% !important;
    font-size: 14px !important;
  }
  
  .widget_search button {
    width: 100% !important;
    margin-top: 10px !important;
    font-size: 14px !important;
  }
  
  /* 헤딩 크기 */
  h1 {
    font-size: 22px !important;
  }
  
  h2 {
    font-size: 18px !important;
  }
  
  h3 {
    font-size: 16px !important;
  }
  
  /* code 태그 */
  code {
    font-size: 12px !important;
    word-break: break-all !important;
  }
}

/* =====================================================
   공통 스타일 (모든 화면 크기)
===================================================== */

/* 검색 입력창 */
.widget_search input[type="search"] {
  height: 32px !important;
  padding: 4px 8px !important;
  font-size: 15px !important;
  line-height: 1.4 !important;
  box-sizing: border-box;
}

/* 검색 버튼 */
.widget_search button {
  height: 32px !important;
  padding: 0 12px !important;
  font-size: 15px !important;
  line-height: 1.4 !important;
  white-space: nowrap !important;
  box-sizing: border-box;
  font-family: "Noto Sans KR", sans-serif;
}

/* 링크 밑줄 */
a {
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* 헤딩 크기 (데스크톱 기본) */
h1 {
  font-size: 28px;
  line-height: 1.4;
  margin-bottom: 1em;
}

h2 {
  font-size: 22px;
  line-height: 1.4;
  margin-bottom: 1em;
}

h3 {
  font-size: 18px;
  line-height: 1.4;
  margin-bottom: 0.8em;
}

/* code 태그 스타일 */
code {
  font-family: 'Courier New', Courier, monospace;
  background-color: #f4f4f4;
  padding: 2px 4px;
  font-size: 14px;
  color: #c7254e;
  border-radius: 4px;
}

/* 관련글 박스 */
.related-posts {
  border: 2px solid #e9e9e9;
  border-radius: 20px;
  padding: 20px;
}