/*
Theme Name: 애드센스 블로그 (adsense-blog)
Author: 인포블로그
Description: 애드센스 최적화 경량 단일 컬럼 블로그 테마. 레퍼런스 톤(라이트) — 코랄 #ff4848 + 라벤더-그레이. 광고 4슬롯 + 신뢰 페이지 푸터 링크 내장.
Version: 1.1.0
Requires at least: 6.0
Requires PHP: 8.0
License: GNU General Public License v2 or later
Text Domain: adsense-blog
*/

/* ===== 디자인 토큰 (레퍼런스 톤 · 라이트 전용) ===== */
:root {
  --ground:#f2f2f6; --surface:#ffffff; --surface-2:#f4f4f8; --surface-3:#ebebf3;
  --text:#2f2f37; --body:#333333; --muted:#595967; --faint:#9a9aab;
  --border:#e9e9f1; --border-strong:#dcdce6;
  --accent:#ff4848; --accent-deep:#e03a3a; --accent-ink:#fff; --accent-soft:#fff0ef;
  --blue:#3d8bd4; --panel:#33343f;
  --shadow-sm:0 1px 2px rgba(40,40,70,.05);
  --shadow:0 1px 3px rgba(40,40,70,.06), 0 8px 22px rgba(40,40,70,.06);
  --maxw:880px;
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI","Apple SD Gothic Neo","Pretendard","Fira Sans",Roboto,"Malgun Gothic",sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--ground); color: var(--body);
  font-family: var(--font); font-size: 17px; line-height: 1.8;
  letter-spacing: -0.003em; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-deep); text-underline-offset: 2px; }
img { max-width: 100%; height: auto; }

/* ===== 헤더 ===== */
header.site { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.86); -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.bar { max-width: 920px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 20px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 18.5px; letter-spacing: -.02em; color: var(--text); text-decoration: none; }
.brand .dot { width: 12px; height: 12px; border-radius: 4px; background: var(--accent); display: inline-block; }
nav.top ul.menu { list-style: none; margin: 0; padding: 0; display: flex; gap: 22px; }
nav.top a { color: var(--muted); text-decoration: none; font-size: 14.5px; font-weight: 600; position: relative; transition: color .18s; }
nav.top a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: -6px; height: 2px; background: var(--accent); border-radius: 2px; transition: right .22s ease; }
nav.top a:hover, nav.top .current-menu-item > a { color: var(--text); }
nav.top a:hover::after, nav.top .current-menu-item > a::after { right: 0; }

/* 데스크톱 전용 인라인 검색창 (브랜드와 메뉴 사이) — 절제된 회색 알약 */
.hdr-search-inline { display: flex; align-items: center; gap: 2px; margin-right: auto; height: 34px; padding: 0 4px 0 13px; background: #f2f2f5; border: 1px solid transparent; border-radius: 999px; transition: background .15s, border-color .15s; }
.hdr-search-inline:focus-within { background: #fff; border-color: var(--accent); }
.hdr-search-inline input { width: 116px; border: 0; background: transparent; outline: none; font-family: inherit; font-size: 13.5px; color: var(--text); }
.hdr-search-inline input::placeholder { color: var(--muted); }
.hdr-search-inline button { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; transition: color .15s; }
.hdr-search-inline button:hover, .hdr-search-inline:focus-within button { color: var(--accent); }

/* 모바일 헤더 아이콘/아코디언 (데스크톱에선 숨김) */
.hdr-toggle { display: none; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hdr-panel { display: none; }

/* ===== 본문 래퍼 ===== */
main { max-width: var(--maxw); margin: 26px auto; padding: 0 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: clamp(24px, 5vw, 44px); display: flex; flex-direction: column; gap: 24px; }

.eyebrow { align-self: flex-start; color: var(--accent-deep); background: var(--accent-soft); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 5px 11px; border-radius: 999px; }
.eyebrow a { color: inherit; text-decoration: none; }
h1.title { font-size: clamp(1.7rem, 5vw, 2.15rem); line-height: 1.27; letter-spacing: -.025em; margin: 0; font-weight: 850; color: var(--text); text-wrap: balance; }
h1.title a { color: inherit; text-decoration: none; }

.meta { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; color: var(--muted); font-size: 13.5px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; overflow: hidden; }
/* 업로드한 프로필 사진: 동그라미에 꽉 차게 (첫 글자 폴백 시엔 적용 안 됨) */
.avatar img.avatar-photo { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: none; display: block; }
.meta .who { font-weight: 700; color: var(--text); }
.meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }

/* 대표 이미지 */
.featured-img { width: 100%; height: auto; border-radius: 14px; display: block; border: 1px solid var(--border); }

/* 본문 타이포 */
.entry { display: flex; flex-direction: column; gap: 17px; font-size: 17px; color: var(--body); }
.entry > * { margin: 0; }
.entry h2 { font-size: 1.4rem; line-height: 1.35; margin: 16px 0 2px; font-weight: 800; letter-spacing: -.02em; color: var(--text); padding-left: 14px; border-left: 4px solid var(--accent); }
.entry h3 { font-size: 1.12rem; margin: 8px 0 0; font-weight: 700; color: var(--text); }
.entry ul, .entry ol { padding-left: 4px; display: flex; flex-direction: column; gap: 9px; list-style: none; }
.entry ul li, .entry ol li { position: relative; padding-left: 28px; }
.entry ul li::before { content: ""; position: absolute; left: 6px; top: .62em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.entry ol { counter-reset: li; }
.entry ol li { counter-increment: li; }
.entry ol li::before { content: counter(li); position: absolute; left: 0; top: .05em; width: 21px; height: 21px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-deep); font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.entry img { border-radius: 10px; }
.entry a { color: var(--accent-deep); }
.entry blockquote { margin: 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--border-strong); color: var(--muted); }
strong { font-weight: 700; color: var(--text); }

.section { display: flex; flex-direction: column; gap: 13px; }

/* ===== 광고 슬롯 ===== */
.ad-slot { margin: 2px 0; text-align: center; }
.ad-slot ins { display: block; }
.ad-ph { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1.5px dashed var(--border-strong); background: var(--surface-2); border-radius: 12px; color: var(--muted); text-align: center; padding: 16px; min-height: 116px; }
.ad-ph .ad-chip { position: absolute; top: -10px; left: 16px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .07em; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; }
.ad-ph.rect { width: 300px; max-width: 100%; height: 250px; margin: 6px auto; min-height: 0; }

/* ===== 목록(홈/아카이브) 카드 그리드 ===== */
.list-head { margin: 2px 0 2px; }
.list-head h1 { font-size: 1.4rem; font-weight: 800; margin: 0; letter-spacing: -.02em; color: var(--text); }
.post-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.card2 { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; transition: transform .18s, box-shadow .2s; }
.card2:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card2 a.thumb { display: block; aspect-ratio: 1/1; position: relative; overflow: hidden; background: linear-gradient(135deg, #e9eaf1, #f2f2f6); }
.card2 a.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card2 .ph { position: absolute; inset: 0; }
.card2 .ph::after { content: ""; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; transform: translate(-50%,-50%); border-radius: 10px; background: #fff; border: 2px solid #dfe0ea; }
.card2 .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; }
.card2 .cat { color: var(--accent-deep); font-size: 11.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; text-decoration: none; }
.card2 h2 { font-size: 1.05rem; line-height: 1.42; margin: 0; font-weight: 800; letter-spacing: -.01em; }
.card2 h2 a { color: var(--text); text-decoration: none; }
.card2 h2 a:hover { color: var(--accent-deep); }
.card2 .excerpt { color: var(--muted); font-size: 13.5px; line-height: 1.6; margin: 0; }
@media (max-width: 640px) { .post-grid { grid-template-columns: 1fr; } }

/* 페이지네이션 */
.pager { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.pager .page-numbers { padding: 9px 14px; border: 1px solid var(--border); border-radius: 9px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 14px; background: var(--surface); }
.pager .page-numbers.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.pager a.page-numbers:hover { border-color: var(--accent); color: var(--accent-deep); }

/* 무한스크롤 상태/스피너 */
.infinite-status { display: flex; justify-content: center; align-items: center; min-height: 0; color: var(--muted); font-size: 14px; }
.infinite-status:not(:empty) { padding: 24px 0; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
.infinite-end { color: var(--faint); font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ===== Q&A ===== */
.qa { display: flex; flex-direction: column; gap: 11px; }
.qa .qitem { border: 1px solid var(--border); border-radius: 12px; padding: 15px 17px; background: var(--surface-2); }
.qa .q { font-weight: 700; margin: 0 0 5px; color: var(--text); }
.qa .a { margin: 0; color: var(--muted); font-size: 15px; }

/* ===== 태그 ===== */
.tags { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 22px; border-top: 1px solid var(--border); }
.tags a { font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; background: var(--surface-2); border: 1px solid var(--border); padding: 6px 13px; border-radius: 999px; transition: all .16s; }
.tags a::before { content: "#"; color: var(--faint); margin-right: 2px; }
.tags a:hover { color: #fff; background: var(--accent); border-color: var(--accent); }

/* ===== 복사 / 공유 ===== */
.share-row { display: flex; gap: 12px; }
.sbtn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 15px 16px; font-size: 15px; font-weight: 800; color: #fff; cursor: pointer; font-family: inherit; text-decoration: none; transition: transform .14s, box-shadow .2s, filter .15s; }
.sbtn.copy { background: var(--blue); }
.sbtn.share { background: var(--accent); }
.sbtn.small { flex: 0 0 auto; padding: 11px 20px; font-size: 14px; }
.sbtn:hover { transform: translateY(-2px); box-shadow: var(--shadow); filter: brightness(1.03); }
.sbtn:active { transform: translateY(0); }

/* ===== 인기/관련 글 그리드 ===== */
.popular { display: flex; flex-direction: column; gap: 15px; }
.popular h2 { border: 0; padding: 0; margin: 6px 0 0; font-size: 1.22rem; display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.popular h2::before { content: "🔥"; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); font-size: 14px; }
.pop-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 17px; }
.pcard { text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 10px; }
.pthumb { aspect-ratio: 1/1; border-radius: 12px; position: relative; overflow: hidden; background: linear-gradient(135deg, #e9eaf1, #f2f2f6); border: 1px solid var(--border); transition: transform .2s, box-shadow .2s; }
.pthumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pthumb.empty::after { content: ""; position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; transform: translate(-50%,-50%); border-radius: 9px; background: #fff; border: 2px solid #dfe0ea; }
.pcard:hover .pthumb { transform: translateY(-3px); box-shadow: var(--shadow); }
.ptitle { font-size: 13.5px; font-weight: 700; line-height: 1.5; color: var(--text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; transition: color .16s; }
.pcard:hover .ptitle { color: var(--accent-deep); }
/* PC: 2줄 4칸(8개) · 모바일: 2줄 2칸(4개, 5~8번째 숨김) */
@media (max-width: 700px) {
  .pop-grid { grid-template-columns: repeat(2, 1fr); }
  .pop-grid .pcard:nth-child(n+5) { display: none; }
}

/* ===== 이전 / 다음 ===== */
.postnav { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.pn { text-decoration: none; color: #fff; border-radius: 14px; padding: 17px 19px; display: flex; flex-direction: column; gap: 6px; min-height: 86px; justify-content: center; transition: transform .16s, box-shadow .2s, filter .15s; }
.pn-prev { background: #4a86c8; align-items: flex-start; }
.pn-next { background: var(--accent); align-items: flex-end; text-align: right; }
.pn-label { font-size: 11.5px; font-weight: 700; opacity: .92; letter-spacing: .04em; text-transform: uppercase; }
.pn-title { font-size: 14.5px; font-weight: 800; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pn:hover { transform: translateY(-2px); box-shadow: var(--shadow); filter: brightness(1.03); }
@media (max-width: 480px) { .postnav { grid-template-columns: 1fr; } }

/* ===== 작성자 박스 (다크 패널) ===== */
.authorbox { display: flex; gap: 15px; align-items: center; background: var(--panel); color: #fff; border-radius: 14px; padding: 20px 22px; }
.authorbox .avatar { width: 52px; height: 52px; font-size: 20px; background: rgba(255,255,255,.14); }
.authorbox .aname { font-weight: 800; font-size: 15.5px; }
.authorbox .aname .accent { color: #ff8a7a; }
.authorbox .abio { color: rgba(255,255,255,.72); font-size: 13px; margin-top: 3px; }

/* ===== 댓글 ===== */
.comments { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.comments .cbar { background: var(--panel); color: #fff; font-weight: 800; font-size: 14px; padding: 13px 19px; }
.comments .cbody { padding: 18px 19px; }
.comments ol.comment-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.comments .comment-body { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.comments input[type=text], .comments input[type=email], .comments input[type=url], .comments input[type=password], .comments textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--body); font-family: inherit; font-size: 14px; margin-top: 3px;
}
.comments textarea { min-height: 92px; resize: vertical; }
.comments .form-submit input, .comments .submit { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 11px 24px; font-weight: 800; cursor: pointer; font-size: 14px; }

/* 댓글 폼 레이아웃: 댓글(전폭) → 이름 → 안내문 → 등록 */
.comment-respond .comment-reply-title { font-weight: 800; font-size: 15px; margin: 0 0 12px; color: var(--text); }
.comment-respond form { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
.comment-respond p { margin: 0; }
.comment-form-comment { flex: 1 1 100%; }
.comment-form-author { flex: 1 1 100%; }
.comment-respond label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.comment-approval-note { flex: 1 1 100%; font-size: 12.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; }
.comment-approval-note::before { content: "ℹ️ "; }
.comment-respond .form-submit { flex: 1 1 100%; }

/* ===== 푸터 ===== */
footer.site { max-width: var(--maxw); margin: 10px auto 60px; padding: 24px 20px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; display: flex; flex-direction: column; gap: 13px; text-align: center; }
footer.site nav { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center; }
footer.site nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
footer.site nav a:hover { color: var(--accent-deep); }
.req { color: var(--accent-deep); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; font-weight: 800; }

/* 접근성 */
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap; }
.alignwide { width: 100%; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }

/* 모바일: 단일 글/페이지 박스 레이아웃 해제 → 전체 너비 + 흰 배경 (박스는 PC 전용) */
@media (max-width: 700px) {
  body { background: #fff; }
  .single main, .page main, .error404 main { margin: 0 auto; padding: 0; }
  .single .card, .page .card, .error404 .card { border: 0; border-radius: 0; box-shadow: none; padding: 26px 18px 36px; }
  /* 모바일 푸터: 회색 섹션 + 진한 링크로 또렷하게 */
  footer.site { max-width: none; margin: 0; background: var(--surface-2); padding: 30px 20px 42px; }
  footer.site nav { gap: 12px 20px; }
  footer.site nav a { font-size: 14.5px; font-weight: 700; color: var(--text); }
}

/* 모바일 상단탭: 다크 바 + 햄버거/검색 아이콘 + 아코디언 패널 */
@media (max-width: 700px) {
  header.site { background: #1a1a21; border-bottom: 1px solid #2b2c38; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .bar { position: relative; max-width: none; margin: 0; padding: 0 6px; gap: 0; min-height: 54px; }
  .hdr-toggle { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 54px; color: #fff; }
  .hdr-toggle:active { color: var(--accent); }
  .brand { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #fff; font-size: 18px; gap: 0; white-space: nowrap; }
  .brand .dot { display: none; }
  nav.top { display: none; }
  .hdr-search-inline { display: none; } /* 모바일은 별도 검색 사용 */

  .hdr-panel { display: block; overflow: hidden; max-height: 0; transition: max-height .28s ease; background: #23242d; }
  .hdr-panel.open { max-height: 60vh; }
  .hdr-menu ul.menu { list-style: none; margin: 0; padding: 4px 0; display: block; }
  .hdr-menu ul.menu li { display: block; }
  .hdr-menu ul.menu a { display: block; padding: 14px 22px; color: #eaeaf1; text-decoration: none; font-weight: 600; font-size: 15px; border-top: 1px solid rgba(255,255,255,.07); }
  .hdr-menu ul.menu li:first-child a { border-top: 0; }
  .hdr-menu ul.menu a:active, .hdr-menu ul.menu .current-menu-item > a { color: var(--accent); }

  .hdr-search form { display: flex; gap: 8px; padding: 12px 16px; }
  .hdr-search input { flex: 1; min-width: 0; padding: 12px 14px; border: 0; border-radius: 9px; background: #fff; color: #23232b; font-size: 15px; font-family: inherit; }
  .hdr-search button { flex: none; padding: 0 18px; border: 0; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; cursor: pointer; }
}

@media (max-width: 480px) { body { font-size: 16px; } nav.top ul.menu { gap: 15px; } }
@media (prefers-reduced-motion: no-preference) {
  .card { animation: rise .5s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
}
