/* ============================================================
   diary.css — Diary archive / single article styles

   静的プロトタイプ:
     - /diary.html     → .archive-* セレクタ (一覧 / hero / search / filter)
     - /article.html   → .article-* / .entry-content セレクタ (単記事)

   依存: tokens.css → base.css → header.css → footer.css → diary.css

   読み込み条件 (inc/enqueue.php):
     - is_home()         … Diary トップ (Settings → Reading → Posts page)
     - is_archive()      … category / tag / date / author archive
     - is_singular('post') … 単記事
     - is_search()       … 検索結果

   サイズ単位:
     stock.css と同様に rem を主体 (16px = 1rem)。
     ブレークポイントのみ px 維持 (540px / 768px)。

   フィルター UI:
     静的版は JS によるクライアント側フィルタだったが、WP では category 階層を
     使った URL ベース (?cat=... ではなく /category/{slug}/) に変更。
     親カテゴリーは常時表示、子カテゴリーは親カテゴリーアーカイブ中だけ表示する想定。
   ============================================================ */

/* ===== Page-level body rhythm (matches static diary.html) ===== */
body{
	line-height: 1.7;
	letter-spacing: 0.02em;
}

/* ============================================================
   Archive (一覧)
   ============================================================ */

/* ===== ① HERO — text only, like page.html ===== */
.archive-hero{
	padding: 10.625rem 1.625rem 2.75rem;
}
.archive-hero h1{
	margin: 0;
	font-family: var(--en);
	font-weight: 300;
	font-size: clamp(2.375rem, 11vw, 3.5rem);
	letter-spacing: 0.04em;
	line-height: 1.0;
	color: var(--ink);
}

/* ===== ② SEARCH — single-line, line-only, smaller ===== */
.archive-search{
	padding: 1.5rem 1.625rem 0;
}
.archive-search form{
	display: block;
	border-bottom: 1px solid rgba(10,10,10,0.10);
	padding: 0.375rem 0 0.5625rem;
	transition: border-color .3s ease;
}
.archive-search form:focus-within{
	border-bottom-color: rgba(10,10,10,0.40);
}
.archive-search input{
	width: 100%;
	appearance: none;
	border: 0;
	outline: 0;
	background: transparent;
	padding: 0.125rem 0;
	font-family: var(--jp);
	font-weight: 300;
	/* iOS Safari の自動ズーム回避のため 16px (1rem) 以上を維持 */
	font-size: 1rem;
	letter-spacing: 0.06em;
	color: var(--ink);
	line-height: 1.6;
}
.archive-search input::placeholder{
	color: rgba(10,10,10,0.30);
	font-weight: 300;
	letter-spacing: 0.06em;
	/* 視覚的には小さめに見せたいので placeholder は 13px */
	font-size: 0.8125rem;
}

/* ===== ②-B FILTERS — hierarchical, very quiet ===== */
.archive-filters{
	padding: 1.375rem 1.375rem 1.5rem;
}
.archive-filters .row{
	display: flex;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	white-space: nowrap;
}
.archive-filters .row::-webkit-scrollbar{ display: none; }

/* — 大分類 (parent) — 文字幅を動かさないため weight/size は固定 */
.archive-filters .row--parent{
	gap: 1.125rem;
	padding: 0.25rem 0.25rem;
}
.archive-filters .row--parent a,
.archive-filters .row--parent button{
	flex: 0 0 auto;
	display: inline-block;
	font-family: var(--jp);
	font-weight: 300;
	font-size: 0.71875rem;     /* 11.5px */
	letter-spacing: 0.14em;
	color: rgba(10,10,10,0.30);
	text-decoration: none;
	padding: 0.1875rem 0 0.3125rem;
	border-bottom: 1px solid transparent;
	transition: color .25s ease, border-color .25s ease;
}
.archive-filters .row--parent a:hover,
.archive-filters .row--parent button:hover{ color: rgba(10,10,10,0.65); }
.archive-filters .row--parent a.is-active,
.archive-filters .row--parent button.is-active{
	color: rgba(10,10,10,0.58);
	border-bottom-color: rgba(10,10,10,0.32);
}

/* — 小カテゴリー (sub) — 親カテゴリーアーカイブ中だけ表示 — */
.archive-filters .row--sub{
	gap: 1rem;
	padding: 0 0.25rem;
	overflow: hidden;
	max-height: 0;
	opacity: 0;
	transition: max-height .3s ease, opacity .3s ease, padding .3s ease, margin-top .3s ease;
}
.archive-filters .row--sub.is-open{
	max-height: 2.75rem;
	opacity: 1;
	padding: 0.5rem 0.25rem 0;
	margin-top: 0.125rem;
}
.archive-filters .row--sub a,
.archive-filters .row--sub button{
	flex: 0 0 auto;
	display: inline-block;
	font-family: var(--jp);
	font-weight: 300;
	font-size: 0.65625rem;     /* 10.5px */
	letter-spacing: 0.12em;
	color: rgba(10,10,10,0.32);
	text-decoration: none;
	padding: 0.125rem 0 0.1875rem;
	border-bottom: 1px solid transparent;
	transition: color .25s ease, border-color .25s ease;
}
.archive-filters .row--sub a::before,
.archive-filters .row--sub button::before{
	content: "·";
	margin-right: 0.75rem;
	color: rgba(10,10,10,0.20);
}
.archive-filters .row--sub a:first-child::before,
.archive-filters .row--sub button:first-child::before{ content: ""; margin: 0; }
.archive-filters .row--sub a:hover,
.archive-filters .row--sub button:hover{ color: rgba(10,10,10,0.62); }
.archive-filters .row--sub a.is-active,
.archive-filters .row--sub button.is-active{
	color: rgba(10,10,10,0.58);
	border-bottom-color: rgba(10,10,10,0.28);
}

/* ===== ③ LIST ===== */
.archive-list{
	padding: 0 1.625rem;
	display: flex;
	flex-direction: column;
	gap: 0;
}
.entry{
	display: block;
	padding: 2.25rem 0 3.5rem;
	color: var(--ink);
	text-decoration: none;
}
.entry + .entry{
	border-top: 1px solid var(--line-on-light-soft);
	padding-top: 3.5rem;
}

/* サムネイル (任意・なくても成立する) */
.entry .thumb{
	position: relative;
	width: 100%;
	aspect-ratio: 4 / 3;
	background: var(--paper-soft);
	overflow: hidden;
	margin-bottom: 1.375rem;
	border-radius: 1px;
}
.entry .thumb img{
	position: absolute; inset: 0;
	width: 100%; height: 100%;
	object-fit: cover;
	transition: transform 1.4s ease;
}
.entry:hover .thumb img{ transform: scale(1.02); }
.entry .thumb:empty{ display: none; }   /* サムネ無しでも美しく成立 */

/* 日付 (小さく控えめ) */
.entry .date{
	display: block;
	font-family: var(--mono);
	font-size: 0.65625rem;    /* 10.5px */
	letter-spacing: 0.18em;
	color: var(--dim-on-light);
	margin-bottom: 0.625rem;
	text-transform: uppercase;
}

/* タイトル */
.entry .title{
	margin: 0 0 0.75rem;
	font-family: var(--jp);
	font-weight: 300;
	font-size: 1.125rem;
	letter-spacing: 0.06em;
	line-height: 1.55;
	color: var(--ink);
	text-wrap: pretty;
}

/* 抜粋 (任意) */
.entry .excerpt{
	margin: 0;
	font-family: var(--jp);
	font-weight: 300;
	font-size: 0.84375rem;    /* 13.5px */
	line-height: 1.85;
	letter-spacing: 0.06em;
	color: rgba(10,10,10,0.62);
	text-wrap: pretty;
}
.entry .excerpt:empty{ display: none; }

/* 「Read →」テキスト導線 (控えめ) */
.entry .more{
	display: inline-block;
	margin-top: 1.125rem;
	font-family: var(--en);
	font-weight: 400;
	font-size: 0.65625rem;    /* 10.5px */
	letter-spacing: 0.22em;
	color: rgba(10,10,10,0.42);
	transition: color .25s ease, letter-spacing .25s ease;
}
.entry:hover .more{ color: rgba(10,10,10,0.85); letter-spacing: 0.26em; }

/* 空状態 */
.archive-list .empty,
.empty.diary-empty{
	text-align: center;
	padding: 5rem 1.25rem;
	font-family: var(--jp);
	font-weight: 300;
	font-size: 0.8125rem;
	letter-spacing: 0.12em;
	color: var(--dim-on-light);
}

/* ===== ④ Pagination — very quiet ===== */
.pagination{
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1.75rem;
	padding: 3.5rem 1.625rem 5rem;
	font-family: var(--mono);
	font-size: 0.6875rem;     /* 11px */
	letter-spacing: 0.20em;
	color: var(--dim-on-light);
}
.pagination a,
.pagination span{
	padding: 0.25rem 0;
	color: inherit;
	text-decoration: none;
	transition: color .25s ease, border-color .25s ease;
}
.pagination a:hover{ color: var(--ink); }
.pagination .current{
	color: var(--ink);
	border-bottom: 1px solid var(--ink);
}
.pagination .disabled,
.pagination .dots{
	opacity: 0.30;
	pointer-events: none;
}
/* WP paginate_links() の prev/next を控えめに */
.pagination .prev,
.pagination .next{
	color: rgba(10,10,10,0.55);
}
.pagination .prev:hover,
.pagination .next:hover{ color: var(--ink); }

/* ============================================================
   Single article (記事詳細)
   ============================================================ */

/* ===== Article header (intro) ===== */
.article-head{
	padding: 8.125rem 1.625rem 2.25rem;
}
.article-head .crumb{
	font-family: var(--mono);
	font-size: 0.625rem;       /* 10px */
	letter-spacing: 0.22em;
	color: var(--dim-on-light);
	margin: 0 0 2rem;
	text-transform: uppercase;
}
.article-head .crumb a{
	color: inherit;
	text-decoration: none;
	opacity: 0.8;
	transition: opacity .25s ease;
}
.article-head .crumb a:hover{ opacity: 1; }
.article-head .crumb .sep{ margin: 0 0.5rem; opacity: 0.5; }
.article-head .kicker{
	font-family: var(--en);
	font-weight: 400;
	font-size: 0.6875rem;      /* 11px */
	letter-spacing: 0.28em;
	text-transform: uppercase;
	color: var(--dim-on-light);
	margin: 0 0 1.25rem;
}
.article-head h1{
	margin: 0;
	font-family: var(--jp);
	font-weight: 300;
	font-size: clamp(1.75rem, 7.6vw, 2.25rem);
	letter-spacing: 0.06em;
	line-height: 1.55;
	color: var(--ink);
	text-wrap: pretty;
}
.article-head .lede{
	margin: 1.5rem 0 0;
	font-family: var(--jp);
	font-weight: 300;
	font-size: 0.90625rem;     /* 14.5px */
	letter-spacing: 0.06em;
	line-height: 1.95;
	color: rgba(10,10,10,0.7);
	text-wrap: pretty;
}
.article-head .rule{
	height: 1px;
	background: var(--line-on-light);
	margin: 2.75rem 0 0;
}

/* Optional eyecatch directly under the title block */
.article-eyecatch{
	margin: 2.25rem 0 0;
}
.article-eyecatch figure{ margin: 0; }
.article-eyecatch img{
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	display: block;
}
.article-eyecatch figcaption{
	padding: 0.75rem 1.625rem 0;
	font-family: var(--mono);
	font-size: 0.625rem;       /* 10px */
	letter-spacing: 0.18em;
	color: var(--dim-on-light);
}

/* ===== Article body (.entry-content — WordPress-friendly) ===== */
.entry-wrap{
	padding: 2.5rem 1.625rem 5rem;
}
.entry-content{
	font-family: var(--jp);
	font-weight: 300;
	font-size: 0.9375rem;      /* 15px */
	line-height: 1.95;
	letter-spacing: 0.05em;
	color: var(--ink);
}
.entry-content > * + *{ margin-top: 1.4em; }
.entry-content p{
	margin: 0;
	text-wrap: pretty;
}
.entry-content a{
	color: var(--ink);
	text-decoration: none;
	border-bottom: 1px solid var(--line-on-light);
	transition: border-color .25s ease;
}
.entry-content a:hover{ border-bottom-color: var(--ink); }
.entry-content strong, .entry-content b{ font-weight: 500; }
.entry-content em, .entry-content i{ font-style: normal; color: rgba(10,10,10,0.75); }

/* Headings (h2-h6) */
.entry-content h2{
	font-family: var(--jp);
	font-weight: 300;
	font-size: clamp(1.3125rem, 5.2vw, 1.5625rem);
	letter-spacing: 0.08em;
	line-height: 1.55;
	color: var(--ink);
	margin: 3.4em 0 1.2em;
	padding: 0.15em 0 0.15em 1.125rem;
	border-left: 1px solid rgba(10,10,10,0.55);
	border-top: 0;
}
.entry-content h2:first-child{ margin-top: 0; }

.entry-content h3{
	font-family: var(--jp);
	font-weight: 400;
	font-size: clamp(1.0625rem, 4.4vw, 1.1875rem);
	letter-spacing: 0.06em;
	line-height: 1.6;
	color: var(--ink);
	margin: 2.6em 0 1.2em;
	display: table;
	position: relative;
	padding-bottom: 0.6em;
}
.entry-content h3::after{
	content: "";
	position: absolute;
	left: -0.375rem;
	right: -0.375rem;
	bottom: 0;
	height: 1px;
	background: rgba(10,10,10,0.16);
}
.entry-content h3 + *{ margin-top: 0.2em; }

.entry-content h4{
	font-family: var(--jp);
	font-weight: 400;
	font-size: 0.96875rem;     /* 15.5px */
	letter-spacing: 0.05em;
	line-height: 1.65;
	color: var(--ink);
	margin: 2.0em 0 0.6em;
	display: block;
	padding-bottom: 0;
	border-bottom: 0;
}
.entry-content h4 + *{ margin-top: 0.2em; }

.entry-content h5{
	font-family: var(--mono);
	font-weight: 400;
	font-size: 0.65625rem;     /* 10.5px */
	letter-spacing: 0.28em;
	text-transform: uppercase;
	color: rgba(10,10,10,0.42);
	margin: 1.8em 0 0.5em;
}

.entry-content h6{
	font-family: var(--en);
	font-weight: 400;
	font-size: 0.6875rem;      /* 11px */
	letter-spacing: 0.18em;
	color: var(--dim-on-light);
	margin: 1.6em 0 0.4em;
}

/* Lists */
.entry-content ul, .entry-content ol{
	margin: 0;
	padding-left: 1.4em;
}
.entry-content ul li, .entry-content ol li{ margin: 0.5em 0; }
.entry-content ul{ list-style: none; padding-left: 0; }
.entry-content ul > li{
	position: relative;
	padding-left: 1.4em;
}
.entry-content ul > li::before{
	content: "";
	position: absolute;
	left: 0; top: 0.95em;
	width: 0.75rem; height: 1px;
	background: var(--ink);
	opacity: 0.55;
}
.entry-content ol{ list-style: none; counter-reset: item; padding-left: 0; }
.entry-content ol > li{
	position: relative;
	padding-left: 2.2em;
	counter-increment: item;
}
.entry-content ol > li::before{
	content: counter(item, decimal-leading-zero);
	position: absolute; left: 0; top: 0;
	font-family: var(--mono);
	font-size: 0.6875rem;
	letter-spacing: 0.12em;
	color: var(--dim-on-light);
	line-height: 1.95;
}

/* Blockquote */
.entry-content blockquote{
	margin: 2.4em 0;
	padding: 0.25rem 0 0.25rem 1.375rem;
	border-left: 1px solid var(--ink);
	font-family: var(--jp);
	font-weight: 300;
	font-style: normal;
	color: rgba(10,10,10,0.75);
	letter-spacing: 0.06em;
	line-height: 1.95;
}
.entry-content blockquote p{ margin: 0; }
.entry-content blockquote cite{
	display: block;
	margin-top: 0.75rem;
	font-family: var(--mono);
	font-size: 0.65625rem;
	letter-spacing: 0.18em;
	font-style: normal;
	color: var(--dim-on-light);
}

/* Code */
.entry-content code{
	font-family: var(--mono);
	font-size: 0.92em;
	background: var(--paper-soft);
	padding: 0.1em 0.4em;
}
.entry-content pre{
	margin: 1.8em 0;
	padding: 1.125rem 1rem;
	background: var(--paper-soft);
	overflow-x: auto;
	font-family: var(--mono);
	font-size: 0.78125rem;     /* 12.5px */
	line-height: 1.7;
	letter-spacing: 0;
}
.entry-content pre code{ background: transparent; padding: 0; }

/* Images & figures (WordPress: .wp-block-image, figure) */
.entry-content figure,
.entry-content .wp-block-image{ margin: 2.6em 0; }
.entry-content figure img,
.entry-content .wp-block-image img{
	width: 100%;
	display: block;
	height: auto;
}
.entry-content figcaption,
.entry-content .wp-element-caption{
	margin-top: 0.75rem;
	font-family: var(--mono);
	font-size: 0.65625rem;
	letter-spacing: 0.18em;
	color: var(--dim-on-light);
	text-align: left;
}

/* Table */
.entry-content .table-wrap,
.entry-content figure.wp-block-table{
	margin: 2.6em 0;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}
.entry-content table{
	width: 100%;
	border-collapse: collapse;
	font-family: var(--jp);
	font-weight: 300;
	font-size: 0.84375rem;     /* 13.5px */
	letter-spacing: 0.04em;
	line-height: 1.7;
}
.entry-content table th,
.entry-content table td{
	text-align: left;
	padding: 0.875rem 0.875rem;
	border-bottom: 1px solid var(--line-on-light);
	vertical-align: top;
}
.entry-content table th{
	font-weight: 400;
	color: var(--dim-on-light);
	font-family: var(--mono);
	font-size: 0.65625rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	border-bottom: 1px solid var(--ink);
	padding-bottom: 0.75rem;
}
.entry-content table td:first-child,
.entry-content table th:first-child{ padding-left: 0; }
.entry-content table td:last-child,
.entry-content table th:last-child{ padding-right: 0; text-align: right; }
.entry-content table tr:last-child td{ border-bottom: 0; }

/* Buttons (WordPress: .wp-block-button) */
.entry-content .wp-block-button,
.entry-content .is-button{ margin: 2.6em 0; }
.entry-content .wp-block-button__link,
.entry-content .is-button > a,
.entry-content a.btn-quiet{
	display: inline-flex;
	align-items: center;
	gap: 0.875rem;
	padding: 0.875rem 1.5rem;
	border: 1px solid var(--ink);
	color: var(--ink);
	background: transparent;
	border-radius: 0;
	font-family: var(--jp);
	font-weight: 300;
	font-size: 0.84375rem;
	letter-spacing: 0.20em;
	text-decoration: none;
	transition: background .3s ease, color .3s ease;
}
.entry-content .wp-block-button__link:hover,
.entry-content a.btn-quiet:hover{
	background: var(--ink); color: var(--paper);
	border-bottom-color: var(--ink);
}

/* Separator */
.entry-content hr,
.entry-content .wp-block-separator{
	border: 0;
	border-top: 1px solid var(--line-on-light);
	margin: 3.2em 0;
}

/* ===== Article CTA (quiet, single section) ===== */
.article-cta{
	border-top: 1px solid var(--line-on-light);
	padding: 3.125rem 1.625rem 5.625rem;
	text-align: center;
}
.article-cta .lead{
	font-family: var(--jp);
	font-weight: 300;
	font-size: 0.875rem;
	letter-spacing: 0.14em;
	color: var(--dim-on-light);
	margin: 0 0 1.5rem;
}
.article-cta .pair{
	display: inline-flex;
	flex-direction: column;
	gap: 0.875rem;
	width: 100%;
	max-width: 20rem;
}
.article-cta .pair a{
	display: inline-flex; align-items: center; justify-content: center;
	gap: 0.875rem;
	padding: 1rem 1.5rem;
	border: 1px solid var(--ink);
	color: var(--ink);
	font-family: var(--jp);
	font-weight: 300;
	font-size: 0.875rem;
	letter-spacing: 0.20em;
	text-decoration: none;
	transition: background .3s ease, color .3s ease;
}
.article-cta .pair a.primary{ background: var(--ink); color: var(--paper); }
.article-cta .pair a:hover{ background: var(--ink); color: var(--paper); }
.article-cta .pair a .arrow{ font-family: var(--en); font-weight: 300; }

/* ===== Back to Diary ===== */
.back-to-archive{
	text-align: center;
	padding: 0 1.625rem 3.5rem;
}
.back-to-archive a{
	display: inline-block;
	font-family: var(--en);
	font-weight: 400;
	font-size: 0.6875rem;
	letter-spacing: 0.24em;
	color: rgba(10,10,10,0.55);
	text-decoration: none;
	padding: 0.5rem 0;
	transition: color .25s ease, letter-spacing .25s ease;
}
.back-to-archive a:hover{
	color: var(--ink);
	letter-spacing: 0.28em;
}

/* ===== reveal (scroll-in) ===== */
.reveal{
	opacity: 0;
	transform: translateY(0.875rem);
	transition: opacity .9s ease, transform .9s ease;
}
.reveal.is-visible{ opacity: 1; transform: none; }

/* ============================================================
   Tablet (>= 540px)
   ============================================================ */
@media (min-width: 540px){
	/* Archive */
	.archive-hero{ padding: 12.5rem 2rem 3.5rem; }
	.archive-search{ padding: 2rem 2rem 0; }
	.archive-filters{ padding: 1.75rem 1.75rem 1.875rem; }
	.archive-list{ padding: 0 2rem; }
	.entry{ padding: 3rem 0 4.25rem; }
	.entry + .entry{ padding-top: 4.25rem; }
	.entry .title{ font-size: 1.1875rem; }
	.entry .excerpt{ font-size: 0.875rem; }

	/* Single */
	.article-head{ padding: 9.375rem 2rem 2.5rem; }
	.entry-wrap{ padding: 3rem 2rem 6rem; }
	.article-cta{ padding: 4.375rem 2rem 6.875rem; }
	.article-cta .pair{ flex-direction: row; max-width: 30rem; }
	.article-cta .pair a{ flex: 1; }
}

/* ============================================================
   PC (>= 768px) — release .page constraint, comfortable column.
   min(880px, 100% - 80px) で全幅でも左右 40px 以上のマージン確保。
   ============================================================ */
@media (min-width: 768px){
	.page{ max-width: none; overflow: visible; }

	/* Archive — 880px 横幅で読みやすい一覧 */
	.archive-hero,
	.archive-search,
	.archive-filters,
	.archive-list,
	.pagination{
		max-width: min(55rem, calc(100% - 5rem));
		margin-left: auto;
		margin-right: auto;
	}

	/* Single — 760px 横幅 (本文は少し狭めにして可読性優先) */
	.article-head,
	.article-eyecatch,
	.entry-wrap,
	.article-cta,
	.back-to-archive{
		max-width: min(47.5rem, calc(100% - 5rem));
		margin-left: auto;
		margin-right: auto;
	}
}
