/*
Theme Name: Blocksy Child (Kaicore AEO)
Template: blocksy
Author: Kaicore
Description: Blocksy 자식 테마 — 인블로그 수준 읽기 본문 와꾸(읽기 폭/타이포/TOC/FAQ/관련글). 커스텀 CSS는 이 파일에서 관리(DISALLOW_FILE_EDIT=true라 admin 코드편집 불가).
Version: 0.1.0
Text Domain: blocksy-child
*/

/* ============================================================
   읽기 본문 와꾸 (인블로그 레퍼런스)
   - 본문 폭 720px (700~800 범위)
   - 좌측 정렬, 넉넉한 행간(1.8), 17px
   ============================================================ */

:root {
  --kc-read-width: 720px;
  --kc-read-line: 1.8;
  --kc-read-size: 1.0625rem; /* 17px */
  --kc-font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    system-ui, "Segoe UI", Roboto, "Helvetica Neue", "Apple SD Gothic Neo",
    "Noto Sans KR", sans-serif;
}

/* Pretendard 전역 적용 (제목/본문/버튼/메뉴 등 테마 전반) */
body,
button,
input,
select,
optgroup,
textarea,
.entry-content,
h1, h2, h3, h4, h5, h6 {
  font-family: var(--kc-font);
}

/* 전체 배경 화이트 (Blocksy 기본 팔레트 회색 → 흰색) */
body { background-color: #ffffff !important; }

/* 단일 글/페이지 본문 컨테이너 폭 */
.single .entry-content,
.page .entry-content,
.single .ct-post-summary,
.post-type-archive .entry-content {
  max-width: var(--kc-read-width);
  margin-left: auto;
  margin-right: auto;
}

/* 본문 타이포 — 좌측 정렬, 행간/크기 + AEO 가독성(빌더 미리보기 == 발행본)
   ※ aeo 레포 frontend globals.css `.aeo-content` 규칙과 1:1 동일, 스코프만 .entry-content.
     전부 표준 마크다운 요소만 타겟 → 기존 발행글에도 즉시 적용(raw HTML 불필요). */
.entry-content {
  counter-reset: aeo-h2;       /* h2 자동 번호 배지 카운터 */
  font-size: var(--kc-read-size);
  line-height: var(--kc-read-line);
  font-weight: 360;            /* Pretendard Variable 가변웨이트 — airy하게(헤딩/strong 미영향) */
  color: #3a4f66;              /* 본문 텍스트 톤 */
  text-align: left;
  word-break: keep-all;        /* 한국어 단어 단위 줄바꿈 */
  overflow-wrap: break-word;
}

.entry-content p { margin: 0 0 1.05em; }

/* 본문 콘텐츠 H1 톤다운 — 번호배지 H2(24px)와 위계 정리.
   ※ 포스트 제목은 Blocksy가 .entry-content 밖 아티클 헤더에 별도 렌더 → 여기 미해당. */
.entry-content h1 {
  font-size: 28px;
  line-height: 1.35;
  font-weight: 800;
  color: #1a1f27;
  margin: 1.4em 0 0.5em;
}

/* 섹션 제목 H2 — 24px + 자동 번호 배지(CSS counter, 마크업 0) */
.entry-content h2 {
  font-size: 24px;
  line-height: 1.4;
  font-weight: 800;
  color: #1a1f27;
  margin: 2.2em 0 0.5em;
  scroll-margin-top: 90px;     /* TOC 앵커 점프 위치 유지 */
  display: flex;
  align-items: baseline;
  gap: 0.5em;
}
.entry-content h2::before {
  counter-increment: aeo-h2;
  content: counter(aeo-h2);
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7em;
  height: 1.7em;
  padding: 0 0.45em;
  border-radius: 0.45em;
  background: #eef3ff;
  color: #2f6bff;
  font-size: 0.6em;
  font-weight: 800;
  transform: translateY(-0.1em);
}

/* 소제목 H3 — 19px */
.entry-content h3 {
  font-size: 19px;
  line-height: 1.45;
  font-weight: 700;
  color: #33465c;
  margin: 1.8em 0 0.5em;
  scroll-margin-top: 90px;
}

.entry-content ul, .entry-content ol { margin: 0 0 1.4em; padding-left: 1.4em; }
.entry-content li { margin: 0.4em 0; }
.entry-content img { border-radius: 10px; }

/* 핵심 용어 밑줄 강조 (**볼드**) */
.entry-content strong {
  font-weight: 700;
  color: #1a1f27;
  text-decoration: underline;
  text-decoration-color: #bcd0ff;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* 콜아웃 카드 — blockquote(마크다운 >)를 자동 카드화 (요약/결론/주의).
   .kc-callout 블록 패턴과 accent 팔레트 통일(#2f6bff). raw HTML 없이 > 인용만으로 카드. */
.entry-content blockquote {
  background: #f4f7fb;
  border: 0;
  border-left: 4px solid #2f6bff;
  border-radius: 10px;
  margin: 1.6em 0;
  padding: 16px 20px;
  color: #33465c;
}
.entry-content blockquote p { margin: 0.4em 0; }
.entry-content blockquote ul { margin: 0.3em 0; }
.entry-content blockquote strong { text-decoration: none; }

/* 비교표 — zebra 스트라이프 + 다크 헤더 */
.entry-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 15px;
  border: 1px solid #e6eaf0;
  border-radius: 10px;
  overflow: hidden;
}
.entry-content th,
.entry-content td {
  padding: 12px 14px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #eef1f5;
}
.entry-content thead th { background: #2b3648; color: #fff; font-weight: 700; }
.entry-content tbody tr:nth-child(even) { background: #f6f8fb; }
.entry-content td:first-child { font-weight: 700; color: #1a1f27; }

/* 본문 링크 — 밑줄 제거(파란색 유지), hover 시에만 밑줄 */
.entry-content a { color: #2f6bff; text-decoration: none; }
.entry-content a:hover { text-decoration: underline; }
.entry-content hr { border: 0; border-top: 1px solid #e6eaf0; margin: 2.4em 0; }

/* 모바일 — 본문/제목 축소 (AEO 640px 브레이크포인트) */
@media (max-width: 640px) {
  .entry-content h2 { font-size: 21px; }
  .entry-content h3 { font-size: 18px; }
}

/* 대표 이미지 라운드 */
.ct-featured-image img { border-radius: 12px; }

/* ============================================================
   TL;DR / 요약 콜아웃 (블록 패턴 .kc-callout)
   ============================================================ */
.kc-callout {
  border: 0;
  border-left: 4px solid #2f6bff;   /* blockquote 카드와 accent 통일 */
  background: #f4f7fb;
  border-radius: 10px;
  padding: 1.1em 1.3em;
  margin: 0 auto 1.8em;
  max-width: var(--kc-read-width);
}
.kc-callout > *:first-child { margin-top: 0; }
.kc-callout > *:last-child { margin-bottom: 0; }
.kc-callout strong { text-decoration: none; }   /* 카드 내부는 밑줄 강조 제외 */
.kc-callout .kc-callout__label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #2f6bff;
  margin-bottom: 0.4em;
}

/* ============================================================
   본문 내 FAQ (블록 패턴 .kc-faq, <details>)
   ============================================================ */
.kc-faq {
  max-width: var(--kc-read-width);
  margin: 1.8em auto;
}
.kc-faq__item {
  border-bottom: 1px solid #e6e8eb;
  padding: 0.2em 0;
}
.kc-faq__q {
  cursor: pointer;
  font-weight: 600;
  padding: 0.85em 0;
  list-style: none;
}
.kc-faq__q::-webkit-details-marker { display: none; }
.kc-faq__q::after { content: "+"; float: right; color: #888; }
details[open] .kc-faq__q::after { content: "−"; }
.kc-faq__a { padding: 0 0 0.9em; color: #333; line-height: 1.75; }

/* ============================================================
   목차(TOC) — 커스텀 (assets/toc.js 생성)
   모바일: 본문 상단 접이식 박스 / 데스크톱(>=1280px): 본문 왼쪽 sticky
   ============================================================ */
.kc-toc {
  border: 1px solid #e6e8eb;
  border-radius: 10px;
  background: #fafbfc;
  padding: 0.5em 1.1em 0.8em;
  margin: 0 auto 1.8em;
  max-width: var(--kc-read-width);
  font-size: 0.92rem;
}
.kc-toc__title {
  cursor: pointer;
  font-weight: 700;
  padding: 0.5em 0;
  list-style: none;
  color: #1a1a1a;
}
.kc-toc__title::-webkit-details-marker { display: none; }
.kc-toc__title::after { content: " ▾"; color: #999; font-size: 0.85em; }
.kc-toc[open] .kc-toc__title::after { content: " ▴"; }
.kc-toc__list { list-style: none; margin: 0.4em 0 0; padding: 0; }
.kc-toc__item { margin: 0; line-height: 1.4; }
.kc-toc__h3 { padding-left: 0.9em; }
.kc-toc a {
  color: #9aa0a8;
  text-decoration: none;
  display: block;
  padding: 0.32em 0;
  font-size: 0.9rem;
  transition: color 0.12s;
}
.kc-toc__h3 a { font-size: 0.86rem; }
.kc-toc a:hover { color: #1a1a1a; }
.kc-toc a.is-active { color: #1a1a1a; font-weight: 600; }

/* 데스크톱: 본문 좌측 여백에 고정(따라붙음) — 본문과 넉넉히 간격 */
@media (min-width: 1300px) {
  .kc-toc {
    position: fixed;
    top: 104px;
    left: calc(50% - 660px);
    width: 210px;
    max-width: 210px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    margin: 0;
    background: transparent;
    border: none;
    padding: 0;
  }
  .kc-toc__title { cursor: default; pointer-events: none; font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: #b0b6bd; }
  .kc-toc__title::after { display: none; }
  /* 활성 항목 왼쪽 얇은 바 (읽기 진행 느낌) */
  .kc-toc__list { border-left: 1px solid #ececf0; padding-left: 0.9em; }
  .kc-toc a { margin-left: -0.9em; padding-left: 0.9em; border-left: 2px solid transparent; }
  .kc-toc a.is-active { border-left-color: #1a1a1a; }
}

/* ============================================================
   헤더 — 로고 있으면 로고만 (사이트명 텍스트 숨김, pickle 스타일),
   로고 없으면 텍스트 워드마크(옵션 kaicore_header_wordmark, functions.php가
   content 값을 인라인 출력). 홈 링크가 항상 좌상단에 존재하도록.
   ============================================================ */
.kc-has-logo .site-title-container,
.kc-has-logo .ct-header .site-title { display: none !important; }
body:not(.kc-has-logo) .ct-header .site-title { margin: 0; }
body:not(.kc-has-logo) .ct-header .site-title a {
  display: inline-flex;
  align-items: center;
  font-size: 0; /* 원 사이트명 텍스트 숨김(스크린리더는 읽음) — ::after가 워드마크 표시 */
  line-height: 1;
  text-decoration: none;
}
body:not(.kc-has-logo) .ct-header .site-title a::after {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1a1a1a;
  white-space: nowrap;
}
.site-logo-container img,
.site-logo-container .ct-image-default,
.site-logo-container .default-logo img {
  max-height: 34px !important;
  width: auto !important;
}
/* 헤더 두께 축소 — Blocksy --height 변수(기본 120px) 강제 축소 */
#header [data-row="middle"] {
  --height: 58px !important;
  --header-height: 58px !important;
  min-height: 58px !important;
  align-items: center !important;
}
#header [data-row="middle"] > .ct-container { padding-top: 4px !important; padding-bottom: 4px !important; align-items: center; }
/* 로고 수직 중앙 (위로 쏠림 방지) */
.site-logo-container { display: flex; align-items: center; align-self: center; height: 100%; }
.site-logo-container img { display: block; }

/* ============================================================
   푸터 — 깔끔한 좌(브랜드)/우(링크) 한 줄
   ============================================================ */
.ct-footer,
.ct-footer [data-row],
.ct-footer [data-column] { background-color: #fff !important; }
.ct-footer-copyright { width: 100%; }
.kc-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5em;
  width: 100%;
  font-size: 0.9rem;
  color: #8a9099;
}
.kc-footer a { color: #8a9099; text-decoration: none; }
.kc-footer a:hover { color: #1a1a1a; }
.kc-footer__sep { margin: 0 0.55em; color: #ccc; }

/* 모바일: 본문 폭 자동 + 패딩 */
@media (max-width: 800px) {
  :root { --kc-read-size: 1rem; }
  .entry-content, .kc-callout, .kc-faq { max-width: 100%; }
  .kc-footer { justify-content: center; text-align: center; }
}

/* ============================================================
   홈 (front-page.php) — 카테고리 탭 + 히어로(1/2/2) + 3열 그리드
   ============================================================ */
.kc-home { max-width: 1180px; margin: 0 auto; padding: 26px 20px 64px; }

/* 홈/아카이브 히어로 — 풀폭 배너 (graphic 그라데이션 / photo 사진) */
.kc-page-hero {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  min-height: 430px;
  padding: 80px 20px;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.kc-page-hero__inner { max-width: 1180px; margin: 0 auto; width: 100%; position: relative; z-index: 2; }
.kc-page-hero__eyebrow { font-size: 0.82rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; margin: 0 0 1.1em; color: #fff; opacity: 0.92; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.22); }
.kc-page-hero__title { font-size: 3rem; font-weight: 600; letter-spacing: -0.025em; margin: 0; line-height: 1.14; color: #fff; text-shadow: 0 1px 16px rgba(0, 0, 0, 0.22); }
.kc-page-hero__sub { font-size: 1.02rem; font-weight: 400; margin: 0.9em 0 0; line-height: 1.65; color: #fff; opacity: 0.9; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.22); }

/* graphic — 카이코어 프리미엄 메시 그라데이션 배너 */
.kc-page-hero--graphic {
  color: #fff;
  background:
    radial-gradient(85% 130% at 10% 0%, rgba(104, 142, 255, 0.45), transparent 55%),
    radial-gradient(75% 120% at 92% 100%, rgba(58, 96, 220, 0.5), transparent 60%),
    radial-gradient(60% 90% at 60% 20%, rgba(150, 120, 255, 0.28), transparent 60%),
    linear-gradient(135deg, #0c1330 0%, #1a2a6e 50%, #2743a8 100%);
}
.kc-page-hero--graphic::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(120% 120% at 50% 120%, rgba(0, 0, 0, 0.22), transparent 55%);
}
/* AI 노드 네트워크 배경 (그래픽 히어로 canvas, 인터랙티브) */
.kc-hero-net { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; display: block; }

/* photo — 사진 배너 + 강한 어두운 오버레이(밝은 사진에도 흰 글씨 가독) */
.kc-page-hero--photo { background-size: cover; background-position: center; color: #fff; }
.kc-page-hero--photo::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.32) 52%, rgba(0, 0, 0, 0.18) 100%);
}

/* flat — 이미 대비가 잡힌 디자인 배경: 가독성 오버레이 없이 원본 그대로 */
.kc-page-hero--flat::before { display: none; }

/* 히어로 우상단 브랜드 로고 — 콘텐츠 폭(1180) 우측 끝에 맞추고, 좁아지면 최소 여백 20px */
.kc-page-hero__logo {
  position: absolute;
  top: 44px;
  right: max(20px, calc((100% - 1180px) / 2));
  height: 43px;
  width: auto;
  z-index: 3;
}

@media (max-width: 700px) {
  .kc-page-hero { min-height: 220px; padding: 46px 18px; }
  .kc-page-hero__title { font-size: 1.8rem; }
  .kc-page-hero__logo { top: 18px; height: 26px; }
}

/* 카테고리 탭 */
.kc-tabs { display: flex; flex-wrap: wrap; gap: 0.35em; margin: 6px 0 30px; align-items: center; }
.kc-tab {
  font-size: 0.95rem; color: #6b7280; text-decoration: none;
  padding: 0.45em 0.95em; border-radius: 999px; font-weight: 500;
  transition: color 0.12s, background 0.12s;
}
.kc-tab:hover { color: #1a1a1a; background: #f2f3f5; }
.kc-tab.is-active { color: #1a1a1a; background: #f2f3f5; font-weight: 700; }

/* 카드 — 박스/테두리 없는 흰색 */
.kc-card__link { display: block; text-decoration: none; color: inherit; }
.kc-card__media {
  width: 100%; aspect-ratio: 16 / 10; background-size: cover; background-position: center;
  background-color: #eef1f4; border-radius: 14px;
}
.kc-card__media.is-empty { background-image: linear-gradient(135deg, #e9edf2, #f6f8fa); }
.kc-card__body { padding: 0.9em 0.15em 0; }
.kc-card__cat { display: inline-block; font-size: 0.78rem; color: #8a9099; margin-bottom: 0.35em; }
.kc-card__title { font-size: 1.02rem; font-weight: 700; line-height: 1.42; margin: 0 0 0.35em; color: #16181d; }
.kc-card__link:hover .kc-card__title { color: #2b6cb0; }
.kc-card__excerpt { font-size: 0.92rem; color: #5a6470; line-height: 1.6; margin: 0.3em 0 0.5em; word-break: keep-all; }
.kc-card__meta { font-size: 0.82rem; color: #9aa0a8; }

/* 히어로 — 1(대형) / 2 / 2 */
.kc-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 32px 28px; margin-bottom: 50px; }
.kc-hero__lead { grid-column: 1 / -1; }
.kc-hero__lead .kc-card__link { display: grid; grid-template-columns: 1.25fr 1fr; gap: 30px; align-items: center; }
.kc-hero__lead .kc-card__media { aspect-ratio: 16 / 9; }
.kc-hero__lead .kc-card__title { font-size: 1.7rem; line-height: 1.3; }
.kc-hero__lead .kc-card__body { padding-top: 0; }

/* 그리드 — 3열 무한스크롤 */
.kc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px 28px; }
.kc-loading { text-align: center; color: #9aa0a8; padding: 26px 0; font-size: 0.9rem; }

@media (max-width: 960px) {
  .kc-hero { grid-template-columns: 1fr 1fr; }
  .kc-hero__lead .kc-card__link { grid-template-columns: 1fr; }
  .kc-hero__lead .kc-card__title { font-size: 1.35rem; }
  .kc-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .kc-hero, .kc-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   브레드크럼 (단일 글 본문 상단)
   ============================================================ */
.kc-breadcrumb {
  max-width: var(--kc-read-width);
  margin: 0 auto 1.5em;
  font-size: 0.85rem;
  color: #9aa0a8;
  display: flex; flex-wrap: wrap; align-items: center;
  word-break: keep-all;
}
.kc-breadcrumb a { color: #9aa0a8; text-decoration: none; }
.kc-breadcrumb a:hover { color: #2b6cb0; }
.kc-bc-sep { margin: 0 0.45em; color: #cdd2d8; }
.kc-bc-current { color: #5a6470; }

/* ============================================================
   공유 버튼 (단일 글, 본문 끝)
   ============================================================ */
.kc-share { max-width: var(--kc-read-width); margin: 2.8em auto 0; }
.kc-share__label { display: block; font-size: 1.05rem; font-weight: 700; margin-bottom: 0.75em; color: #16181d; }
.kc-share__btns { display: flex; gap: 0.5em; }
.kc-share__btn {
  width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #6b7280; background: transparent; border: none; cursor: pointer;
  text-decoration: none; transition: color 0.12s, background 0.12s;
}
.kc-share__btn:hover { color: #16181d; background: #f2f3f5; text-decoration: none; }
.kc-share__copy.is-copied { color: #2b9d5f; }

/* ============================================================
   관련 글 (단일 글 끝)
   ============================================================ */
.kc-related {
  max-width: var(--kc-read-width);
  margin: 3.2em auto 1em;
  border-top: 1px solid #eceef1;
  padding-top: 2em;
}
.kc-related__title { font-size: 1.2rem; font-weight: 700; margin: 0 0 1.1em; }
.kc-related__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.kc-related__item .kc-card__media { aspect-ratio: 16 / 10; border-radius: 10px; }
.kc-related__item .kc-card__body { padding-top: 0.7em; }
.kc-related__item .kc-card__title { font-size: 0.92rem; }
.kc-related__item .kc-card__cat { font-size: 0.72rem; }
@media (max-width: 600px) {
  .kc-related__grid { grid-template-columns: 1fr; }
}
