@charset "UTF-8";
/*
 * Codebase テーマ
 *
 * 本文の可読性を最優先した1カラム構成。
 * 配色は「未指定（OSに追従）」「明示的にライト」「明示的にダーク」の3状態を扱う。
 * ライトの値を素の :root に置き、ダークはメディアクエリと data-theme の両方で
 * 同じトークンを再定義する。
 */

/* ---------------------------------------------------------------- トークン */

:root {
	--bg: #ffffff;
	--surface: #f5f7fa;
	--surface-strong: #eaeef4;
	--text: #161b22;
	--muted: #5b6672;
	--border: #e2e7ee;
	--accent: #1f6feb;
	--accent-contrast: #ffffff;
	--code-bg: #f6f8fa;
	--code-text: #1f2933;

	--content-width: 720px;
	--wide-width: 1040px;
	--gutter: 20px;

	--radius: 10px;
	--radius-sm: 6px;

	--font-sans: system-ui, -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN",
		"Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
	--font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
		"Noto Sans Mono", "Source Han Code JP", monospace;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #0e1116;
		--surface: #161b22;
		--surface-strong: #1f2630;
		--text: #e6edf3;
		--muted: #9aa7b4;
		--border: #262d36;
		--accent: #6ea8fe;
		--accent-contrast: #0e1116;
		--code-bg: #161b22;
		--code-text: #e6edf3;
	}
}

:root[data-theme="dark"] {
	--bg: #0e1116;
	--surface: #161b22;
	--surface-strong: #1f2630;
	--text: #e6edf3;
	--muted: #9aa7b4;
	--border: #262d36;
	--accent: #6ea8fe;
	--accent-contrast: #0e1116;
	--code-bg: #161b22;
	--code-text: #e6edf3;
}

/* ------------------------------------------------------------------- 基本 */

*, *::before, *::after { box-sizing: border-box; }

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	/*
	 * alignfull が 100vw を使うため、スクロールバーの幅ぶん横に溢れることがある。
	 * clip なら overflow: hidden と違ってスクロールコンテナを作らないので、
	 * ヘッダの position: sticky を壊さずに溢れだけを止められる。
	 */
	overflow-x: clip;
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-sans);
	font-size: 17px;
	line-height: 1.9;
	/* 日本語の字面を詰めすぎないよう、約物のカーニングは有効にする */
	font-feature-settings: "palt" 1;
	-webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; height: auto; }

a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { text-decoration: underline; }

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
	border-radius: 2px;
}

.screen-reader-text {
	position: absolute;
	width: 1px; height: 1px;
	margin: -1px; padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: absolute;
	left: -9999px;
	z-index: 100;
	padding: 10px 16px;
	background: var(--accent);
	color: var(--accent-contrast);
	border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus {
	left: 0; top: 0;
}

/* --------------------------------------------------------------- レイアウト */

.container {
	width: 100%;
	max-width: var(--content-width);
	margin-inline: auto;
	padding-inline: var(--gutter);
	padding-block: 48px 72px;
}

.container--list { max-width: var(--content-width); }
.container--narrow { max-width: 560px; }
.container--article { max-width: var(--content-width); }

/* ---------------------------------------------------------------- ヘッダー */

.site-header {
	position: sticky;
	top: 0;
	z-index: 20;
	background: color-mix(in srgb, var(--bg) 88%, transparent);
	backdrop-filter: saturate(180%) blur(12px);
	border-bottom: 1px solid var(--border);
}

.site-header__inner {
	max-width: var(--wide-width);
	margin-inline: auto;
	padding: 12px var(--gutter);
	display: flex;
	align-items: center;
	gap: 16px;
}

.site-branding { margin-right: auto; min-width: 0; }

.site-title {
	margin: 0;
	font-size: 1.0625rem;
	font-weight: 700;
	letter-spacing: 0.01em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.site-title a { color: var(--text); text-decoration: none; }
.site-title a:hover { color: var(--accent); }

.custom-logo { max-height: 36px; width: auto; }

.site-nav__list {
	display: flex;
	gap: 18px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.9375rem;
}
.site-nav__list a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.site-nav__list a:hover { color: var(--text); }

.site-header__actions { display: flex; gap: 4px; }

.icon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px; height: 36px;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--muted);
	font-size: 1rem;
	line-height: 1;
	cursor: pointer;
}
.icon-button:hover { background: var(--surface); color: var(--text); }

.site-search { border-top: 1px solid var(--border); background: var(--surface); }
.site-search__inner {
	max-width: var(--wide-width);
	margin-inline: auto;
	padding: 14px var(--gutter);
}

@media (max-width: 640px) {
	.site-nav { display: none; }
}

/* ------------------------------------------------------------ 検索フォーム */

.search-form { display: flex; gap: 8px; }

.search-form__input {
	flex: 1;
	min-width: 0;
	padding: 10px 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--bg);
	color: var(--text);
	font: inherit;
	font-size: 0.9375rem;
}

.search-form__submit {
	padding: 10px 18px;
	border: 0;
	border-radius: var(--radius-sm);
	background: var(--accent);
	color: var(--accent-contrast);
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
}

/* -------------------------------------------------------- ページ見出し */

.page-header { margin-bottom: 40px; }

.page-header__title {
	margin: 0 0 8px;
	font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem);
	line-height: 1.4;
	letter-spacing: 0.01em;
}

.page-header__desc { margin: 0; color: var(--muted); font-size: 0.9375rem; }
.page-header__count { margin: 6px 0 0; color: var(--muted); font-size: 0.875rem; }
.page-header__search { margin-top: 20px; }

/* ------------------------------------------------------------- 記事一覧 */

.entry-list {
	display: flex;
	flex-direction: column;
}

.entry-card {
	padding-block: 28px;
	border-bottom: 1px solid var(--border);
}
.entry-card:first-child { padding-top: 0; }

.entry-card__link { text-decoration: none; color: inherit; display: block; }

.entry-card__title {
	margin: 0 0 8px;
	font-size: 1.1875rem;
	line-height: 1.6;
	letter-spacing: 0.01em;
}
.entry-card__link:hover .entry-card__title { color: var(--accent); }

.entry-card__excerpt {
	margin: 0 0 12px;
	color: var(--muted);
	font-size: 0.9375rem;
	line-height: 1.85;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.entry-card__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 14px;
}

/* --------------------------------------------------------------- メタ情報 */

.entry-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	color: var(--muted);
	font-size: 0.8125rem;
	font-variant-numeric: tabular-nums;
}

.entry-terms {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.chip {
	display: inline-block;
	padding: 3px 10px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--surface);
	color: var(--muted);
	font-size: 0.75rem;
	line-height: 1.6;
	text-decoration: none;
	white-space: nowrap;
}
.chip:hover {
	border-color: var(--accent);
	color: var(--accent);
	text-decoration: none;
}

/* ----------------------------------------------------------------- 記事 */

.entry-header { margin-bottom: 32px; }

.entry-header .entry-terms { margin-bottom: 14px; }

.entry-title {
	margin: 0 0 14px;
	font-size: clamp(1.625rem, 1.3rem + 1.6vw, 2.25rem);
	line-height: 1.45;
	letter-spacing: 0.005em;
	font-weight: 700;
}

.entry-thumbnail {
	margin: 0 0 36px;
	border-radius: var(--radius);
	overflow: hidden;
}
.entry-thumbnail img { display: block; width: 100%; }

.entry-body { position: relative; }

/* 本文 */

.entry-content { overflow-wrap: anywhere; }

.entry-content > * { margin-block: 0 1.6em; }
.entry-content > *:last-child { margin-bottom: 0; }

.entry-content h2 {
	margin-block: 2.4em 0.9em;
	padding-bottom: 0.4em;
	border-bottom: 1px solid var(--border);
	font-size: 1.4375rem;
	line-height: 1.5;
	scroll-margin-top: 80px;
}

.entry-content h3 {
	margin-block: 2em 0.8em;
	font-size: 1.1875rem;
	line-height: 1.6;
	scroll-margin-top: 80px;
}

.entry-content h4 {
	margin-block: 1.8em 0.7em;
	font-size: 1.0625rem;
}

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

.entry-content ul,
.entry-content ol { margin-block: 0 1.6em; padding-left: 1.6em; }
.entry-content li { margin-bottom: 0.5em; }
.entry-content li > ul,
.entry-content li > ol { margin-block: 0.5em 0; }

.entry-content blockquote {
	margin-inline: 0;
	padding: 4px 0 4px 20px;
	border-left: 3px solid var(--border);
	color: var(--muted);
}
.entry-content blockquote > *:last-child { margin-bottom: 0; }

.entry-content hr {
	border: 0;
	border-top: 1px solid var(--border);
	margin-block: 3em;
}

.entry-content img { border-radius: var(--radius-sm); }

.entry-content figure { margin-inline: 0; }
.entry-content figcaption {
	margin-top: 8px;
	color: var(--muted);
	font-size: 0.8125rem;
	text-align: center;
}

/* インラインコード */
.entry-content :not(pre) > code {
	padding: 0.15em 0.4em;
	border-radius: 4px;
	background: var(--surface-strong);
	color: var(--code-text);
	font-family: var(--font-mono);
	font-size: 0.875em;
	word-break: break-word;
}

/* コードブロック */
.entry-content pre,
.entry-content .wp-block-code {
	margin-block: 0 1.8em;
	padding: 18px 20px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--code-bg);
	color: var(--code-text);
	font-family: var(--font-mono);
	font-size: 0.875rem;
	line-height: 1.75;
	/* 長い行は折り返さず横スクロールさせる。コードの構造を保つため */
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	tab-size: 4;
}

.entry-content pre code,
.entry-content .wp-block-code code {
	padding: 0;
	background: none;
	border: 0;
	font-size: inherit;
	color: inherit;
	white-space: pre;
	font-family: inherit;
}

/* コピーボタン
 *
 * pre の中に置くと横スクロール時に一緒に流れてしまうため、
 * スクロールしないラッパ側に絶対配置する（ラッパは JS が作る）。
 */
.code-block { position: relative; }
.code-block > pre { margin-bottom: 0; }
.code-block { margin-block: 0 1.8em; }

.code-copy {
	position: absolute;
	top: 8px;
	right: 8px;
	padding: 4px 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--bg);
	color: var(--muted);
	font-family: var(--font-sans);
	font-size: 0.75rem;
	line-height: 1.6;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.15s ease;
}
.code-block:hover .code-copy,
.code-copy:focus-visible { opacity: 1; }
.code-copy:hover { color: var(--text); border-color: var(--accent); }

@media (hover: none) {
	.code-copy { opacity: 1; }
}

/* テーブル */
.entry-content table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9375rem;
}
.entry-content :is(figure.wp-block-table, .table-scroll) {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}
.entry-content th,
.entry-content td {
	padding: 10px 12px;
	border: 1px solid var(--border);
	text-align: left;
	vertical-align: top;
}
.entry-content th { background: var(--surface); font-weight: 600; }

/* 幅広ブロック */
.entry-content .alignwide {
	width: min(var(--wide-width), calc(100vw - var(--gutter) * 2));
	margin-inline: calc(50% - min(var(--wide-width), calc(100vw - var(--gutter) * 2)) / 2);
	max-width: none;
}
.entry-content .alignfull {
	width: 100vw;
	margin-inline: calc(50% - 50vw);
	max-width: none;
}
.entry-content .alignleft { float: left; margin: 0 1.5em 1em 0; }
.entry-content .alignright { float: right; margin: 0 0 1em 1.5em; }
.entry-content .aligncenter { margin-inline: auto; }

/* ----------------------------------------------------------------- 目次 */

.entry-toc {
	margin-block: 40px 0;
	padding: 18px 20px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
}

.entry-toc__title {
	margin: 0 0 10px;
	font-size: 0.875rem;
	font-weight: 700;
	color: var(--muted);
	letter-spacing: 0.04em;
}

.entry-toc__nav ol {
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.875rem;
	line-height: 1.7;
}
.entry-toc__nav li { margin-bottom: 6px; }
.entry-toc__nav li:last-child { margin-bottom: 0; }
.entry-toc__nav .is-h3 { padding-left: 1.1em; font-size: 0.8125rem; }
.entry-toc__nav a {
	color: var(--muted);
	text-decoration: none;
	display: block;
}
.entry-toc__nav a:hover { color: var(--accent); }
.entry-toc__nav a.is-active { color: var(--accent); font-weight: 600; }

/* 広い画面では本文の横に追従表示する */
@media (min-width: 1200px) {
	.has-toc .container--article { max-width: var(--wide-width); }

	/*
	 * 本文カラムはグリッドの1列目＝コンテナ左端から始まる。
	 * 見出しやフッタを中央寄せにすると本文と左端が揃わないため、
	 * 幅だけ本文に合わせて左端に置く。
	 */
	.has-toc .entry-header,
	.has-toc .entry-thumbnail,
	.has-toc .entry-footer,
	.has-toc .post-nav,
	.has-toc .comments {
		max-width: var(--content-width);
		margin-inline: 0;
	}

	.has-toc .entry-body {
		display: grid;
		grid-template-columns: minmax(0, var(--content-width)) 1fr;
		gap: 48px;
	}

	.has-toc .entry-toc {
		position: sticky;
		top: 80px;
		align-self: start;
		max-height: calc(100vh - 120px);
		overflow-y: auto;
		margin-block: 0;
		border: 0;
		border-left: 1px solid var(--border);
		border-radius: 0;
		background: none;
		padding: 0 0 0 20px;
	}
}

/* ------------------------------------------------------- 記事フッター周り */

.entry-footer { margin-top: 48px; }

.entry-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.entry-tags a {
	display: inline-block;
	padding: 3px 10px;
	border: 1px solid var(--border);
	border-radius: 999px;
	color: var(--muted);
	font-size: 0.75rem;
	text-decoration: none;
}
.entry-tags a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.post-nav {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-top: 56px;
}

.post-nav__item {
	padding: 16px 18px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	text-decoration: none;
	color: var(--text);
	background: var(--bg);
}
.post-nav__item:hover { border-color: var(--accent); text-decoration: none; }
.post-nav__item--next { text-align: right; }
.post-nav__item--next:only-child { grid-column: 2; }

.post-nav__label {
	display: block;
	color: var(--muted);
	font-size: 0.75rem;
	margin-bottom: 4px;
}
.post-nav__title {
	display: block;
	font-size: 0.9375rem;
	line-height: 1.6;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

@media (max-width: 600px) {
	.post-nav { grid-template-columns: 1fr; }
	.post-nav__item--next { text-align: left; }
	.post-nav__item--next:only-child { grid-column: 1; }
}

/* ------------------------------------------------------------ ページ送り */

.pagination {
	margin-top: 48px;
}
.pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: center;
}
.pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	padding-inline: 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	color: var(--muted);
	text-decoration: none;
	font-size: 0.875rem;
}
.pagination .page-numbers:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pagination .page-numbers.current {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--accent-contrast);
	font-weight: 600;
}
.pagination .dots { border-color: transparent; }

/* ------------------------------------------------------------- コメント */

.comments { margin-top: 64px; padding-top: 40px; border-top: 1px solid var(--border); }
.comments__title { margin: 0 0 24px; font-size: 1.125rem; }
.comment-list { list-style: none; margin: 0 0 32px; padding: 0; }
.comment-list ol.children { list-style: none; padding-left: 20px; }
.comment-body { padding-block: 16px; border-bottom: 1px solid var(--border); }
.comment-meta { font-size: 0.8125rem; color: var(--muted); }
.comment-form textarea,
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"] {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--bg);
	color: var(--text);
	font: inherit;
	font-size: 0.9375rem;
}
.comment-form .submit {
	padding: 10px 20px;
	border: 0;
	border-radius: var(--radius-sm);
	background: var(--accent);
	color: var(--accent-contrast);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

/* -------------------------------------------------------------- 通知面 */

.notice-page { text-align: center; padding-block: 40px; }
.notice-page--inline { text-align: left; padding-block: 24px; }
.notice-page__code { margin: 0; font-size: 3.5rem; font-weight: 700; color: var(--border); line-height: 1; }
.notice-page__title { margin: 12px 0 8px; font-size: 1.25rem; }
.notice-page__text { margin: 0 0 24px; color: var(--muted); font-size: 0.9375rem; }
.notice-page__search { margin-bottom: 24px; }

.button {
	display: inline-block;
	padding: 10px 22px;
	border-radius: var(--radius-sm);
	background: var(--accent);
	color: var(--accent-contrast);
	font-size: 0.9375rem;
	font-weight: 600;
	text-decoration: none;
}
.button:hover { text-decoration: none; opacity: 0.9; }

/* -------------------------------------------------------------- フッター */

.site-footer {
	margin-top: 80px;
	border-top: 1px solid var(--border);
	background: var(--surface);
}

.site-footer__inner {
	max-width: var(--wide-width);
	margin-inline: auto;
	padding: 32px var(--gutter);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.footer-nav__list {
	display: flex;
	flex-wrap: wrap;
	gap: 18px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.875rem;
}
.footer-nav__list a { color: var(--muted); text-decoration: none; }
.footer-nav__list a:hover { color: var(--text); }

.site-footer__copy { margin: 0; color: var(--muted); font-size: 0.8125rem; }

/* --------------------------------------------------- 既存プラグインとの調整 */

/* table-of-contents-plus が本文中に目次を出す場合、テーマ側の見た目に寄せる */
#toc_container {
	background: var(--surface) !important;
	border: 1px solid var(--border) !important;
	border-radius: var(--radius);
	padding: 16px 20px !important;
	width: 100% !important;
	font-size: 0.875rem;
}
#toc_container a { color: var(--muted); text-decoration: none; }
#toc_container a:hover { color: var(--accent); }
