/*
Theme Name: alumlayr
Theme URI: https://alumlayr.jp/
Author: ucn
Description: alumlayr.jp 用の小説サイトテーマ。作品 = 子ページを持つ最上位の固定ページ、話 = その子ページ。
Version: 0.2.12
Requires at least: 7.0
Requires PHP: 8.5
License: GPL-2.0-or-later
Text Domain: alumlayr
*/

/* ---------- 色と書体 ---------- */
:root {
	--paper: #f2e8d0;
	--paper-light: #fbf5e6;
	--paper-deep: #e6d8b6;
	--ink: #33251a;
	--ink-strong: #2a1c10;
	--ink-body: #2e2116;
	--ink-soft: #4a3826;
	--ink-muted: #5a4630;
	--accent: #7a2e1c;
	--accent-hover: #4f1a0e;
	--on-accent: #f8f0dc;
	--rule: #c9b48a;
	--rule-light: #dccaa3;
	--rule-dark: #8c7350;
	--rule-dot: #a38b62;
	--font-display: 'Shippori Mincho B1', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
	--font-body: 'Noto Serif JP', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
}

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

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--font-body);
	line-height: 1.8;
	-webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; height: auto; }

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

.skip-link {
	position: absolute;
	left: 8px;
	top: -100px;
	padding: 10px 16px;
	background: var(--ink);
	color: var(--paper);
	z-index: 10;
}
.skip-link:focus { top: 8px; color: var(--paper); }

/* 画面には出さず、読み上げソフトには読ませる */
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- 枠組み ---------- */
.container { max-width: 1080px; margin-inline: auto; padding-inline: 24px; }
.container--wide { max-width: 1080px; }
.container--medium { max-width: 860px; }
.container--narrow { max-width: 760px; }

.section { padding-bottom: 72px; }

.eyebrow {
	margin: 0 0 12px;
	font-size: 14px;
	letter-spacing: 0.3em;
	color: var(--accent);
}

.ornament { display: block; margin: 28px auto; color: var(--rule-dark); max-width: 100%; }
.ornament--small { width: 160px; height: 20px; margin: 22px auto 0; }

.frame { background: var(--paper-light); border: 1px solid var(--rule); padding: 10px; }
.frame__inner { border: 1px solid var(--rule-light); height: 100%; }

.section-heading {
	border-bottom: 3px double var(--rule-dark);
	padding-bottom: 14px;
	margin-bottom: 32px;
}
.section-heading h2 {
	margin: 0;
	font-family: var(--font-display);
	font-size: 30px;
	font-weight: 700;
	line-height: 1.4;
}

.button {
	display: inline-block;
	padding: 16px 36px;
	background: var(--accent);
	color: var(--on-accent);
	font-size: 16px;
	letter-spacing: 0.1em;
	text-decoration: none;
	text-align: center;
}
.button:hover { background: var(--accent-hover); color: var(--on-accent); }
.button--outline { background: transparent; color: var(--ink); border: 1px solid var(--accent); padding: 15px 32px; letter-spacing: 0.05em; }
.button--outline:hover { background: var(--paper-light); color: var(--ink); }
.button[hidden] { display: none; }

.empty { color: var(--ink-muted); text-align: center; padding: 32px 0; }

/* ---------- ヘッダー・フッター ---------- */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding-block: 22px;
}
.site-header__inner--center { justify-content: center; }
.site-header--slim .site-header__inner { padding-block: 14px; }

.site-logo {
	display: flex;
	align-items: center;
	gap: 12px;
	color: var(--ink);
	text-decoration: none;
	font-family: var(--font-display);
	font-weight: 800;
	font-size: 24px;
	letter-spacing: 0.1em;
}
.site-logo svg { color: var(--accent); flex: none; }
.site-logo:hover { color: var(--ink); }
.site-logo--small { gap: 10px; font-size: 19px; }

.site-header__work { color: var(--ink); text-decoration: none; font-size: 14px; padding-block: 10px; }

.site-footer {
	margin-top: 0;
	border-top: 1px solid var(--rule);
	padding: 40px 24px;
	text-align: center;
	font-size: 13px;
	letter-spacing: 0.1em;
	color: var(--ink-muted);
}

/* ---------- トップページ ---------- */
/* ヘッダーの線から最初の区画までの余白（作品ページの見出しと同じ 64px。スマホ幅では 40px） */
.front { padding-top: 64px; }
@media (max-width: 600px) {
	.front { padding-top: 40px; }
}

.latest {
	padding: 36px 40px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
}
.latest__body { flex: 1 1 440px; min-width: 0; }
.latest .eyebrow { font-size: 13px; margin-bottom: 10px; }
.latest__title { margin: 0 0 8px; font-family: var(--font-display); font-size: 28px; font-weight: 700; line-height: 1.5; }
.latest__meta { margin: 0; font-size: 16px; color: var(--ink-soft); }

.work-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
	gap: 28px;
}
.work-card { padding: 28px 26px 24px; display: flex; flex-direction: column; gap: 12px; }
.work-card__tags { margin: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; letter-spacing: 0.12em; color: var(--ink-muted); }
.work-card__genre { color: var(--accent); }
.work-card__title { margin: 0; font-family: var(--font-display); font-size: 23px; line-height: 1.5; }
.work-card__title a { color: var(--ink-strong); text-decoration: none; }
.work-card__title a:hover { color: var(--accent); }
.work-card__blurb { margin: 0; font-size: 15px; line-height: 1.9; color: var(--ink-soft); flex-grow: 1; }
.work-card__meta { margin: 0; font-size: 13px; color: var(--ink-muted); border-top: 1px dotted #b39d74; padding-top: 12px; }

.band { background: var(--paper-deep); border-top: 1px solid var(--rule); padding-block: 64px; }
.band + .site-footer { border-top-color: var(--rule); }
.band__title { margin: 0 0 24px; text-align: center; font-family: var(--font-display); font-size: 28px; font-weight: 700; }

.update-log { margin: 0; padding: 0; list-style: none; }
.update-log li {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 24px;
	padding: 14px 4px;
	border-bottom: 1px dotted var(--rule-dot);
	font-size: 15px;
}
.update-log time { color: var(--ink-muted); min-width: 120px; }
.update-log a { color: var(--ink); text-decoration: none; flex: 1 1 300px; }
.update-log a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- 作品ページ ---------- */
.breadcrumb { padding-top: 24px; font-size: 14px; color: var(--ink-muted); display: flex; flex-wrap: wrap; gap: 10px; }

.work-header { padding-block: 64px 48px; text-align: center; }
.work-header__title {
	margin: 0;
	font-family: var(--font-display);
	font-weight: 800;
	font-size: clamp(32px, 6vw, 52px);
	line-height: 1.4;
	color: var(--ink-strong);
}
.work-header__meta { margin: 0; font-size: 15px; color: var(--ink-muted); }

.synopsis-frame { margin-bottom: 40px; }
.synopsis { padding: 36px clamp(20px, 5vw, 44px); }
.synopsis h2 { margin: 0 0 18px; font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: 0.2em; }
.synopsis p { margin: 0 0 16px; font-size: 16px; line-height: 2.1; color: #3d2d1e; }
.synopsis p:last-child { margin-bottom: 0; }

.work-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-bottom: 72px; }
.work-actions .button { font-size: 17px; }

.toc { padding-bottom: 88px; }
.toc .section-heading { margin-bottom: 8px; }
.toc__chapter { margin-top: 32px; }
.toc__chapter-title { margin: 0 0 6px; font-family: var(--font-display); font-size: 19px; font-weight: 700; color: var(--accent); letter-spacing: 0.1em; }
.toc__list { margin: 0; padding: 0; list-style: none; }
.toc__list li { border-bottom: 1px dotted var(--rule-dot); }
.toc__list a {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 20px;
	padding: 16px 4px;
	color: var(--ink);
	text-decoration: none;
}
.toc__list a:hover .toc__title { color: var(--accent); text-decoration: underline; }
.toc__no { font-size: 14px; color: var(--ink-muted); min-width: 64px; }
.toc__title { flex: 1 1 320px; font-size: 16px; }
.toc__date { font-size: 13px; color: var(--ink-muted); }

/* ---------- 本文ページ ---------- */
.reader-settings {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 8px;
	padding-top: 16px;
}
.reader-settings__gap { width: 12px; }
.setting-button {
	min-width: 44px;
	height: 44px;
	padding: 0 14px;
	border: 1px solid var(--rule-dot);
	background: var(--paper-light);
	color: var(--ink);
	font-family: inherit;
	font-size: 13px;
	cursor: pointer;
}
.setting-button--m { font-size: 15px; }
.setting-button--l { font-size: 17px; }
.setting-button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.episode { padding-top: 48px; padding-bottom: 88px; }
.episode-header { text-align: center; margin-bottom: 56px; }
.episode-header__title {
	margin: 0;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: clamp(26px, 4.5vw, 34px);
	line-height: 1.5;
	color: var(--ink-strong);
}

.reader-body {
	max-width: 680px;
	margin-inline: auto;
	font-size: 17px;
	line-height: 2.1;
	letter-spacing: 0.03em;
	color: var(--ink-body);
	overflow-wrap: anywhere;
}
html[data-reader-size="s"] .reader-body { font-size: 15px; }
html[data-reader-size="l"] .reader-body { font-size: 20px; }
.reader-body p { margin: 0 0 1.4em; text-indent: 1em; }
.reader-body h2, .reader-body h3 { font-family: var(--font-display); text-indent: 0; }
.reader-body hr { border: none; text-align: center; margin: 2.4em 0; }
.reader-body hr::after { content: '◇'; color: var(--rule-dark); }

html[data-reader-mode="v"] .reader-body {
	writing-mode: vertical-rl;
	/* 縦書きの要素は行が進む方向（横）に伸びるので、幅を親に固定して枠内で横スクロールさせる */
	width: 100%;
	max-width: none;
	height: min(70vh, 720px);
	overflow-x: auto;
	overflow-y: hidden;
	padding: clamp(24px, 4vw, 40px) clamp(16px, 3vw, 32px);
	background: #f7efdc;
	border: 1px solid var(--rule-light);
	letter-spacing: 0.05em;
	text-orientation: mixed;
}
html[data-reader-mode="v"] .reader-body p { margin: 0 0 0 0.9em; }
/* ルビ（inc/typography.php が |漢字《かんじ》 / 漢字《かんじ》 を <ruby> にする。本文・タイトル・章・あとがき・あらすじ・紹介文） */
ruby { ruby-position: over; ruby-align: center; }
/* 見出し用の Shippori Mincho B1 は 700/800 しか無いので、ルビは本文用の Noto Serif JP 400 で細く出す */
rt { font-family: var(--font-body); font-size: 0.5em; font-weight: 400; letter-spacing: 0; line-height: 1; text-indent: 0; }
/* 縦中横（inc/typography.php が 1〜2 桁の数字と !? を .tcy で囲む） */
html[data-reader-mode="v"] .reader-body .tcy {
	-webkit-text-combine: horizontal;
	text-combine-upright: all;
	letter-spacing: 0;
}

.afterword {
	max-width: 680px;
	margin: 56px auto 0;
	border-top: 1px dotted var(--rule-dot);
	padding-top: 24px;
	font-size: 14px;
	line-height: 2;
	color: var(--ink-muted);
}
.afterword p { margin: 0; }
.afterword .afterword__label { margin-bottom: 6px; letter-spacing: 0.2em; color: var(--accent); }

.episode-nav {
	max-width: 680px;
	margin: 56px auto 0;
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 10px;
	text-align: center;
}
.episode-nav__link {
	display: block;
	padding: 16px 8px;
	border: 1px solid var(--rule-dot);
	color: var(--ink);
	text-decoration: none;
	font-size: 15px;
}
.episode-nav__link:hover { background: var(--paper-light); color: var(--ink); }
.episode-nav__link--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.episode-nav__link--primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.episode-nav__link.is-disabled { color: #8a7558; border-color: #d4c29d; }

/* ---------- その他のページ ---------- */
.entry { padding-block: 64px 88px; }
.entry__title { margin: 0 0 32px; font-family: var(--font-display); font-size: 32px; font-weight: 700; text-align: center; }
.entry__content { font-size: 16px; line-height: 2; }

.pagination { margin-top: 32px; text-align: center; }
.nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
