/*
Theme Name: Writing Kurashi
Theme URI: https://example.com
Author: You
Description: ライティング日和・暮らし日和用の軽量テーマ初期実装（整理版・現行デザイン維持）
Version: 0.1.2-clean
Text Domain: writingkurashi
*/

/* ===== Reset / Stability ===== */
html, body {
	margin:0;
	padding:0;
}
html {
	scrollbar-gutter: stable;
}
@supports not (scrollbar-gutter: stable) {
	html {
		overflow-y: scroll;
	}
}

/* ===== Palette / Base ===== */
:root{
	--bg:#fafafa;
	--text:#111;
	--muted:#666;
	--border:#e5e5e5; /* ナチュラル系の枠色 */
	--brand:#c27a33; /* 基調色 */
	--brand-weak:#f3e6d8; /* 薄い背景 */
	--brand-hover:#a86629; /* hover */

	/* Cards */
	--card-h-pc: 420px; /* PCのカード高さ */
	--card-h-sp: 420px; /* SPのカード高さ */
	--card-w-pc: 440px; /* PCのカード横幅 */
	--card-w-sp: 350px; /* SPのカード横幅 */
}

body{
	background:var(--bg);
	color:var(--text);
	font-size:16px;
	line-height:1.7;
}
.container{
	margin:0 auto;
	padding:0 16px;
}

/* ===== Header ===== */
.site-header{
	position: static;
	top: auto;
	z-index: 50;
	background:#fff;
	border-bottom:1px solid var(--border);
	background-size:cover;
	background-position:center;
	background-repeat:no-repeat;
}
.site-header .inner{
	min-height:168px;
	display:flex;
	align-items:center;
	justify-content:center;
	text-align:center;
}
.has-header-image .site-header{
	border-bottom:none;
}

/* ブランドリンク（黒・下線無し・太字＋白い“ぼかし縁”） */
.brand a{
	color:#111;
	text-decoration:none;
	font-weight:800;
	font-size:20px;
	line-height:1.2;
	text-shadow:0 0 4px rgba(255,255,255,.9), 0 0 10px rgba(255,255,255,.7), 0 0 18px rgba(255,255,255,.55);
	padding:6px 10px;
	border-radius:8px;
}
.brand a:hover,.brand a:focus{
	opacity:.9;
}

/* ===== Filter Bar ===== */
.filter-bar{
	position: sticky;
	top:0;
	z-index:40;
	backdrop-filter: blur(8px);
	background: rgba(255,255,255,.9);
	border-bottom: 1px solid var(--border);
}
/* SP：縦並び */
.filter-bar form{
	display:flex;
	flex-direction:column;
	gap:8px;
	padding:8px 0;
}
.filter-bar .select, .filter-bar .search-field, .filter-bar .btn{
	width:100%;
}
.select, .search-field{
	border:1px solid var(--border);
	border-radius:10px;
	padding:8px 10px;
	background:#fff;
}
.btn{
	background:var(--brand);
	color:#fff;
	padding:8px 12px;
	border-radius:10px;
	border:none;
	cursor:pointer;
	font-weight:700;
}
.btn:hover,.btn:focus{
	background:var(--brand-hover);
}
/* PC：横一列 */
@media (min-width:768px){
	.filter-bar form{
		flex-direction:row;
		align-items:center;
		gap:10px;
	}
	.filter-bar .select{
		width:240px;
	}
	.filter-bar .search-field{
		flex:1 1 auto;
		width:auto;
		max-width:none;
	}
	.filter-bar .btn{
		width:auto;
		min-width:120px;
	}
	.brand a{
		font-size:20px;
	}
}

/* ===== Active filter chips ===== */
.filter-ctx{
	display:flex;
	flex-wrap:wrap;
	gap:8px;
	align-items:center;
	margin:8px 0;
}
@media (min-width:768px){
	.filter-ctx{
		max-width:960px;
	}
}
.chip{
	display:inline-flex;
	align-items:center;
	gap:6px;
	font-size:13px;
	line-height:1;
	color:#5b3a18;
	background:#f3e6d8;
	border:1px solid #e8d7c4;
	border-radius:999px;
	padding:8px 12px;
	text-decoration:none;
}
.chip--clear{
	background:#fff;
	color:#333;
	border:1px dashed var(--border);
}

/* ===== Cards / Grid ===== */
/* グリッド：SPは1列、PCは固定幅カードの自動段組＋中央寄せ */
.grid{
	display:grid;
	grid-template-columns:1fr;
	gap:16px;
	justify-items:stretch;
}
@media (min-width:768px){
	.grid{
		grid-template-columns: repeat(
			auto-fit,
			minmax(min(100%, var(--card-w-pc)), var(--card-w-pc))
		);
		justify-content:center;
		gap:20px;
	}
}
.container .grid .cards{
	margin:0 auto;
	padding:0;
}

/* カード本体（縦積み） */
.card{
	background:#fff;
	border:1px solid var(--border);
	border-radius:16px;
	padding:14px;
	display:flex;
	flex-direction:column;
	gap:8px;
	height:var(--card-h-sp);
	width:var(--card-w-sp);
	transition: box-shadow .2s ease, transform .2s ease;
}
@media (min-width:768px){
	.card{
		height:var(--card-h-pc);
	}
}
.card:hover{
	box-shadow:0 6px 24px rgba(0,0,0,.06);
	transform:translateY(-1px);
}

/* サムネ（16:9固定） */
.thumb{
	width:100%;
	height:auto;
	aspect-ratio:16/9;
	background:#f4f4f5;
	border-radius:10px;
	overflow:hidden;
	flex:0 0 auto;
}
@supports not (aspect-ratio:1/1){
	.thumb{
		position:relative;
		padding-top:56.25%;
	}
	.thumb img{
		position:absolute;
		inset:0;
		width:100%;
		height:100%;
		object-fit:cover;
	}
}

/* テキスト部分（※行数省略はPHPで制御） */
.card-content{
	display:flex;
	flex-direction:column;
	gap:8px;
	min-height:0;
	overflow:hidden;
	padding:0;
}
.card h2{
	font-size:18px;
	margin:2px 0;
}
.card-link{
	color:#111;
	text-decoration:none;
}

/* 抜粋はPHPで文字数トリム。CSSは通常の折り返しのみ */
.card-content p{
	margin:0;
	color:#52525b;
}

/* メタ */
.meta{
	font-size:12px;
	color:#6b7280;
	white-space:nowrap;
	overflow:hidden;
	text-overflow:ellipsis;
}

/* ===== Pagination ===== */
.pagination .page-numbers {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 30px 0;
	list-style: none;
	padding: 0;
}

.pagination .page-numbers a, .pagination .page-numbers span {
	display: inline-block;
	padding: 8px 10px;
	background: var(--brand-weak);
	color: #3c2c18;
	border: 1px solid var(--border);
	border-radius: 6px;
	text-decoration: none;
	font-size: 14px;
	transition: all 0.2s ease;
	text-align: center;
	min-width: 30px;
}

.pagination .page-numbers a:hover, .pagination .page-numbers a:focus-visible {
	background: var(--brand);
	color: #fff;
	border-color: var(--brand);
}

.pagination .page-numbers .current {
	background: var(--brand);
	color: #fff;
	border-color: var(--brand);
	font-weight: bold;
}

/* ===== Footer ===== */
.footer{
	margin:24px 0;
	padding-top:12px;
	border-top:1px solid var(--border);
	color:#6b7280;
	font-size:13px;
}

/* ===== a11y Focus ===== */
:focus-visible{
	outline:2px solid var(--brand);
	outline-offset:2px;
}
.brand a:focus-visible,.btn:focus-visible,.select:focus-visible,.search-field:focus-visible{
	box-shadow:0 0 0 3px rgba(194,122,51,.25);
}


/* === Single Post Layout === */
.post-card{
	background:#fff;
	border:1px solid var(--border);
	border-radius:16px;
	padding:16px;
	box-shadow: 0 2px 10px rgba(0,0,0,.02);
}
@media (min-width:768px){
	.post-card{
		max-width: 840px; /* 既存レイアウトに馴染む幅 */
		margin-left: auto;
		margin-right: auto;
	}
}

.post-thumb{
	margin:12px 0;
}
.post-thumb img{
	width:100%;
	height:auto;
	display:block;
	border-radius:10px;
}

/* Ensure in-content images/iframes never overflow */
.entry-content img,.entry-content figure,.entry-content iframe{
	max-width:100%;
	height:auto;
}
.entry-content figure{
	margin:1.2em 0;
}

/* Comfortable reading: slightly wider line-height for p */
.entry-content p{
	line-height:2;
	margin:1em 0;
}

/* Headings with subtle color differentiation */
.entry-content h2{
	color:#5b3a18;
	margin: 2em 0 1em;
}
.entry-content h3{
	color:#7a5a2e;
	margin: 1.8em 0 0.8em;
}

/* Prev/Next navigation styled as buttons */
.post-nav{
	margin-top:20px;
	display:flex;
	justify-content:space-between;
	gap:12px;
}
.post-nav .btn-nav{
	display:inline-block;
	padding:10px 14px;
	border-radius:10px;
	text-decoration:none;
	font-weight:700;
}
.post-nav .btn-nav.btn-outline{
	background:#fff;
	color:#5b3a18;
	border:1px solid var(--border);
}

/* ===== Table of Contents (TOC) unify ===== */
/* できるだけ広くマッチ（#toc_container / .toc_container / idがtocで始まる要素） */
#toc_container, .toc_container,
[id^="toc_container"] {
	/* カード風（サイトの配色に寄せる） */
	background: var(--brand-weak);
	border: 1px solid var(--border);
	border-radius: 14px;
	color: #3c2c18; /* 落ち着いたブラウン系文字色 */
	padding: 16px 18px;
	margin: 20px 0;
	display: block !important; /* 同上 */
	box-shadow: 0 2px 10px rgba(0,0,0,.03);
}

/* タイトル行（左端にアイコンっぽいバー） */
#toc_container .toc_title, .toc_container .toc_title {
	font-weight: 800;
	font-size: 16px;
	margin: 0 0 10px;
	display: flex; align-items: center; gap: 10px;
	color: #5b3a18;
}
#toc_container .toc_title::before, .toc_container .toc_title::before {
	content: "";
	width: 6px; height: 18px;
	border-radius: 3px;
	background: var(--brand);
	display: inline-block;
}

/* 目次リスト共通（箇条書き記号は消して、行間と余白だけ整える） */
#toc_container .toc_list, .toc_container .toc_list, #toc_container ul, .toc_container ul {
	list-style: none;
	margin: 0; padding: 0;
}
#toc_container .toc_list li, .toc_container .toc_list li, #toc_container ul li, .toc_container ul li {
	margin: 4px 0;
	line-height: 1.7;
}

/* 階層のインデントをやわらかく */
#toc_container ul ul, .toc_container ul ul {
	margin-left: 14px;
	border-left: 2px solid rgba(0,0,0,.06);
	padding-left: 10px;
}

/* リンク色・ホバー・フォーカス */
#toc_container a, .toc_container a {
	color: #3c2c18;
	text-decoration: none;
	border-bottom: 1px dashed transparent;
	padding: 2px 0;
}
#toc_container a:hover, .toc_container a:hover, #toc_container a:focus-visible, .toc_container a:focus-visible {
	color: var(--brand-hover);
	border-bottom-color: var(--brand-hover);
	outline: none;
}

/* スマホの可読性（左右にすこし余白） */
@media (max-width: 767px) {
	#toc_container, .toc_container, [id^="toc_container"] {
		padding: 14px 14px;
	}
}

/* ===== Contact (CF7) minimal additions ===== */
.contact-card .page-title{
	margin: 0 0 12px;
	font-size: 22px;
	font-weight: 800;
	text-align: center;
}
.cf-note{
	font-size: 13px;
	color: #6b7280;
	margin-top: 10px;
	margin-bottom: 40px;
	text-align: center;
}

.form-group{
	margin: 25px 0 30px;
}
.form-label{
	display: flex; align-items: center; gap: 8px;
	font-weight: 700; margin-bottom: 6px;
}

/* 必須/任意バッジ（色だけ追加。形はチップとトーンを合わせる） */
.badge{
	display: inline-flex; align-items: center;
	font-size: 12px; line-height: 1;
	border-radius: 999px; padding: 6px 8px;
	border: 1px solid var(--border);
}
.badge-required{
	background: #fce8e6;
	color: #b02a1a;
	border-color: #f3c5be;
} /* 赤系（優しめ） */
.badge-optional{
	background: #e5e7eb;
	color: #374151;
	border-color: #d1d5db;
}	/* 濃いグレー系 */

/* テキストエリアは少し背を高く */
.textarea-tall{
	min-height: 180px;
}

/* 送信ボタン：既存 .btn を流用しつつ、横幅を絞って縦を広げる */
.form-actions{
	display: flex;
	justify-content: center;
	margin-top: 8px;
}
.btn-submit{
	min-width: 200px; /* 横幅は“やや狭め” */
	padding: 12px 18px; /* 縦に少し厚み */
	font-weight: 700;
}

/* SP時：入力枠の左右余白の“見え方”を均一に（枠自体を100%に） */
.contact-card .search-field,.contact-card .textarea-tall{
	display: block;
	width: 100%;
	box-sizing: border-box;
}

/* プライバシーポリシー同意行の整列（他の入力枠と左端を揃える） */
.wpcf7 form .wpcf7-acceptance{
	display: block;
	margin: 12px 0 16px;
}
.wpcf7 form .wpcf7-acceptance .wpcf7-list-item{
	margin: 0; /* 右寄りに見える余計な余白を除去 */
}
.wpcf7 form .wpcf7-acceptance input[type="checkbox"]{
	margin-right: 8px;
	vertical-align: middle;
}
.wpcf7 form .form-actions .btn-submit{
	min-width: 220px;
	padding: 14px 18px;
	display: flex;
	justify-content: center;
}

/* 同意未チェック時の無効化スタイル（JSで付与） */
.btn.is-disabled{
	opacity: .5;
	cursor: not-allowed;
	pointer-events: none;
}

/* ===== CF7: response message (サイトのカード調に統一) ===== */
.wpcf7 form .wpcf7-response-output{
	margin: 14px 0 0;
	padding: 12px 14px;
	border-radius: 10px;
	border: 1px solid var(--border);
	background: var(--brand-weak);
	color: #3c2c18;
	font-size: 14px;
	line-height: 1.6;
	box-shadow: 0 2px 10px rgba(0,0,0,.03);
}

/* 送信成功（新/旧どちらのクラスにも対応） */
.wpcf7 form.sent .wpcf7-response-output, .wpcf7-mail-sent-ok {
	max-width: 840px;
	margin-left: auto;
	margin-right: auto;
	background: #eef7ee;
	border-color: #b7e2b7;
	color: #1d5f2a;
}

/* 送信失敗（サーバーエラー等） */
.wpcf7 form.failed .wpcf7-response-output, .wpcf7 form.aborted .wpcf7-response-output, .wpcf7-spam-blocked {
	max-width: 840px;
	margin-left: auto;
	margin-right: auto;
	background: #fdecec;
	border-color: #f5b7b7;
	color: #8e1b1b;
}

/* 入力不備（バリデーションエラー） */
.wpcf7 form.invalid .wpcf7-response-output, .wpcf7-validation-errors {
	max-width: 840px;
	margin-left: auto;
	margin-right: auto;
	background: #fff7e6;
	border-color: #f3d8a6;
	color: #7a4a00;
}

/* フィールド単位のエラー表示もトーンを統一 */
.wpcf7-not-valid-tip{
	margin-top: 6px;
	font-size: 12px;
	color: #8e1b1b;
}
.wpcf7 form .wpcf7-form-control.wpcf7-not-valid{
	border-color: #f3b4b4 !important;
	box-shadow: 0 0 0 3px rgba(243, 180, 180, .25);
}

/* メッセージをボタンの直下で中央寄せっぽく見せる（カード内で） */
.contact-card .wpcf7-response-output{
	text-align: center;
}

/* 送信中スピナーの位置調整（ボタン右に寄せる） */
.contact-card .form-actions .wpcf7-spinner{
	margin-left: 8px;
}
