/*
Theme Name: 주식계산기 테마
Description: 주식 계산기 사이트용 가벼운 테마. 광고 위젯 자리(본문 위·중간·아래, 사이드바), 빠른 로딩, 모바일 우선 레이아웃. "주식 계산기 모음" 플러그인과 함께 쓰세요.
Version: 1.1.0
Requires at least: 5.8
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: stockcalc-theme
*/

:root {
	--c-text: #1a1d23;
	--c-muted: #6b7280;
	--c-line: #e8ebef;
	--c-bg: #ffffff;
	--c-soft: #f6f7f9;
	--c-accent: #2b59ff;
	--c-accent-soft: #f0f3ff;
	--w-content: 720px;
	--w-wide: 1120px;
	--font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--c-bg);
	color: var(--c-text);
	font-family: var(--font);
	font-size: 17px;
	line-height: 1.75;
	word-break: keep-all;
	overflow-wrap: break-word;
	-webkit-font-smoothing: antialiased;
}
img, video, iframe { max-width: 100%; height: auto; }
a { color: var(--c-accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

.screen-reader-text, .skip-link:not(:focus) {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 8px 14px; background: #000; color: #fff; border-radius: 6px; }

.wrap { width: 100%; max-width: var(--w-wide); margin: 0 auto; padding: 0 16px; }

/* ---------- 헤더 ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .94); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--c-line); }
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 0; position: relative; } }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }
.site-title { margin: 0; font-size: 1.15rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.site-title a { color: var(--c-text); text-decoration: none; }
.custom-logo { display: block; max-height: 36px; width: auto; }

.primary-menu { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; }
.primary-menu li { margin: 0; flex: none; }
.primary-menu a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--c-muted); font-size: .95rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.primary-menu a:hover { color: var(--c-text); background: var(--c-soft); }
.primary-menu .current-menu-item > a, .primary-menu .current_page_item > a { color: var(--c-accent); background: var(--c-accent-soft); }
.primary-menu .sub-menu { display: none; }

/* 모바일: 메뉴를 로고 아래 한 줄로, 옆으로 밀어서 보기 */
@media (max-width: 860px) {
	.site-header .wrap { flex-wrap: wrap; gap: 0; padding-top: 10px; }
	.site-header .wrap > .site-title, .site-header .wrap > .custom-logo-link { padding: 4px 0 6px; }
	.main-navigation { width: calc(100% + 32px); margin: 0 -16px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; border-top: 1px solid var(--c-line); }
	.main-navigation::-webkit-scrollbar { display: none; }
	.primary-menu { padding: 6px 12px; }
	.primary-menu a { padding: 8px 10px; font-size: .92rem; }
}

/* ---------- 레이아웃 ---------- */
.site-main { padding: 28px 0 56px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; }
@media (min-width: 1024px) {
	.layout.has-sidebar { grid-template-columns: minmax(0, 1fr) 300px; }
}
.content-area { min-width: 0; }
.layout:not(.has-sidebar) .content-area { max-width: var(--w-content); margin: 0 auto; width: 100%; }
.page-full .content-area { max-width: 760px; }

.breadcrumb { margin: 0 0 12px; font-size: .85rem; color: var(--c-muted); }
.breadcrumb a { color: var(--c-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--c-accent); }

/* ---------- 글 ---------- */
.entry-header { margin-bottom: 20px; }
.entry-title { margin: 0 0 8px; font-size: clamp(1.6rem, 4vw, 2.1rem); line-height: 1.3; letter-spacing: -.025em; font-weight: 800; }
.entry-meta { font-size: .88rem; color: var(--c-muted); }
.entry-content > * { margin-top: 0; margin-bottom: 1.25em; }
.entry-content h2 { margin: 2.2em 0 .7em; font-size: 1.45rem; line-height: 1.4; letter-spacing: -.02em; font-weight: 800; padding-bottom: .4em; border-bottom: 2px solid var(--c-text); }
.entry-content h3 { margin: 1.8em 0 .6em; font-size: 1.2rem; line-height: 1.45; font-weight: 700; }
.entry-content ul, .entry-content ol { padding-left: 1.3em; }
.entry-content li { margin-bottom: .4em; }
.entry-content blockquote, .entry-content .is-style-note { margin-left: 0; margin-right: 0; padding: 16px 20px; background: var(--c-soft); border-left: 4px solid var(--c-accent); border-radius: 0 10px 10px 0; }
.entry-content blockquote p:last-child { margin-bottom: 0; }
.entry-content table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.entry-content .wp-block-table { overflow-x: auto; }
.entry-content th, .entry-content td { padding: 10px 12px; border: 1px solid var(--c-line); text-align: left; }
.entry-content th { background: var(--c-soft); font-weight: 700; }
.entry-content code { padding: 2px 6px; background: var(--c-soft); border-radius: 5px; font-size: .9em; }
.entry-content .wp-block-details { padding: 14px 18px; border: 1px solid var(--c-line); border-radius: 12px; margin-bottom: 10px; }
.entry-content .wp-block-details summary { font-weight: 700; cursor: pointer; }
.entry-content .wp-block-details[open] summary { margin-bottom: 8px; }
.entry-content .wp-block-details > *:last-child { margin-bottom: 0; }

/* 계산기 아래 설명 글이 계산기와 붙어 보이지 않게 */
.entry-content .apc-root { margin-bottom: 2.5em; }

/* ---------- 첫 화면 ---------- */
.hero { padding: 36px 0 8px; text-align: center; }
.hero h1 { margin: 0 0 10px; font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.25; letter-spacing: -.03em; font-weight: 800; }
.hero p { margin: 0 auto; max-width: 560px; color: var(--c-muted); font-size: 1.05rem; }

/* ---------- 목록 ---------- */
.post-list { display: grid; gap: 16px; }
.post-card { padding: 20px; border: 1px solid var(--c-line); border-radius: 14px; }
.post-card h2 { margin: 0 0 6px; font-size: 1.2rem; line-height: 1.4; }
.post-card h2 a { color: var(--c-text); text-decoration: none; }
.post-card h2 a:hover { color: var(--c-accent); }
.post-card p { margin: 0; color: var(--c-muted); font-size: .95rem; }
.archive-title { margin: 0 0 20px; font-size: 1.6rem; }
.pagination { margin-top: 28px; display: flex; gap: 6px; flex-wrap: wrap; }
.pagination .page-numbers { display: inline-block; min-width: 40px; padding: 8px 12px; border: 1px solid var(--c-line); border-radius: 8px; text-align: center; text-decoration: none; color: var(--c-text); }
.pagination .current { background: var(--c-text); border-color: var(--c-text); color: #fff; }

/* ---------- 광고 자리 ---------- */
.ad-slot { margin: 28px 0; text-align: center; min-height: 100px; clear: both; }
.ad-slot--ad-top { margin-top: 0; }
.ad-slot .widget-title { display: none; }

/* ---------- 사이드바 ---------- */
.sidebar .widget { margin-bottom: 28px; font-size: .95rem; }
.sidebar .widget-title { margin: 0 0 10px; font-size: 1rem; font-weight: 700; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { padding: 8px 0; border-bottom: 1px solid var(--c-line); }
.sidebar li a { color: var(--c-text); text-decoration: none; }
.sidebar li a:hover { color: var(--c-accent); }
@media (min-width: 1024px) { .sidebar-inner { position: sticky; top: 84px; } }

/* ---------- 댓글 ---------- */
.comments-area { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--c-line); }
.comment-list { list-style: none; padding: 0; }
.comments-area textarea, .comments-area input[type="text"], .comments-area input[type="email"], .comments-area input[type="url"] { display: block; width: 100%; max-width: 100%; padding: 10px 12px; border: 1px solid var(--c-line); border-radius: 10px; font: inherit; }
.comments-area .submit { padding: 10px 18px; border: 0; border-radius: 10px; background: var(--c-text); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }

/* ---------- 푸터 ---------- */
.site-footer { padding: 28px 0 36px; background: var(--c-soft); border-top: 1px solid var(--c-line); font-size: .88rem; color: var(--c-muted); }
.footer-menu { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 0 0 12px; padding: 0; }
.footer-menu a { color: var(--c-text); text-decoration: none; font-weight: 600; }
.footer-menu a:hover { color: var(--c-accent); }
.site-footer p { margin: 4px 0; }

/* ---------- 404 / 검색 ---------- */
.search-form { display: flex; gap: 8px; max-width: 480px; }
.search-form label { flex: 1; }
.search-field { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--c-line); border-radius: 10px; font: inherit; }
.search-submit { min-height: 44px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--c-text); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }

/* 워드프레스 기본 정렬 */
.alignleft { float: left; margin: 0 1.5em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1.5em; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.wp-caption-text, figcaption { font-size: .85rem; color: var(--c-muted); text-align: center; }

/* ---------- 블로그 ---------- */
.blog-head { margin-bottom: 20px; }
.blog-head .archive-title { margin-bottom: 6px; }
.blog-head p { margin: 0; color: var(--c-muted); }
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 16px 0 24px; padding: 0; }
.cat-chips li { margin: 0; }
.cat-chips a { display: block; padding: 6px 14px; border: 1px solid var(--c-line); border-radius: 999px; color: var(--c-text); font-size: .9rem; font-weight: 600; text-decoration: none; }
.cat-chips a:hover, .cat-chips .is-active a { border-color: var(--c-accent); color: var(--c-accent); background: var(--c-accent-soft); }
.post-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.post-card.has-thumb { grid-template-columns: minmax(0, 1fr) 140px; }
.post-card__thumb img { display: block; width: 140px; height: 96px; object-fit: cover; border-radius: 10px; }
.post-card__meta { margin-bottom: 4px; font-size: .82rem; color: var(--c-muted); }
.post-card__meta a { color: var(--c-accent); text-decoration: none; font-weight: 600; }
@media (max-width: 520px) {
	.post-card.has-thumb { grid-template-columns: minmax(0, 1fr) 96px; }
	.post-card__thumb img { width: 96px; height: 72px; }
}
.post-calcs { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--c-line); }
.post-calcs h2 { margin: 0; font-size: 1.15rem; }
.entry-thumb { margin: 0 0 24px; }
.entry-thumb img { display: block; width: 100%; border-radius: 14px; }
.empty-posts { padding: 40px 20px; text-align: center; border: 1px dashed var(--c-line); border-radius: 14px; color: var(--c-muted); }
.post-navigation .nav-links { display: flex; justify-content: space-between; gap: 16px; margin-top: 32px; font-size: .92rem; }
.post-navigation a { color: var(--c-text); text-decoration: none; font-weight: 600; }
.post-navigation a:hover { color: var(--c-accent); }
.comment-form p { margin: 0 0 14px; }
.comment-form label { display: block; margin-bottom: 4px; font-size: .88rem; font-weight: 600; }
@media (max-width: 860px) {
	.site-main { padding-top: 16px; }
	.hero { padding-top: 12px; }
}
.comments-title, .comment-reply-title { font-size: 1.15rem; margin: 0 0 14px; }
.comment-list .comment { padding: 14px 0; border-bottom: 1px solid var(--c-line); }
.comment-list .avatar { border-radius: 50%; vertical-align: middle; margin-right: 6px; }
.comment-notes, .logged-in-as { font-size: .85rem; color: var(--c-muted); }
/* 사이드바 블록 위젯 정리 */
.sidebar h2, .sidebar .wp-block-heading { margin: 0 0 10px; font-size: 1rem; font-weight: 700; }
.sidebar .wp-block-search__label { display: block; margin-bottom: 6px; font-size: .9rem; font-weight: 700; }
.sidebar .wp-block-search__inside-wrapper { display: flex; gap: 6px; }
.sidebar .wp-block-search__input { flex: 1; min-width: 0; min-height: 42px; padding: 8px 12px; border: 1px solid var(--c-line); border-radius: 10px; font: inherit; }
.sidebar .wp-block-search__button { min-height: 42px; margin: 0; padding: 0 14px; border: 0; border-radius: 10px; background: var(--c-text); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.sidebar .wp-block-latest-comments { padding: 0; }
@media (max-width: 1023px) { .sidebar { padding-top: 24px; border-top: 1px solid var(--c-line); } }
