/*
Theme Name: Ma-Lite
Description: 余白と静けさを主役にした、個人ブログのためのミニマルなテーマ。「間（ま）」の美学 ― 足すより引くことで、言葉が立つ。 Ma-Lite はオーロラを事前描画した画像で表示する軽量版。
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ma-lite
Tags: blog, one-column, minimal, custom-menu, editor-style, threaded-comments
*/

/* ------------------------------------------------------------
   Tokens
   ------------------------------------------------------------ */
:root {
	--bg: #fbfaf7;
	--ink: #2a2a28;
	--muted: #8b8a84;
	--line: #e6e4de;
	--accent: #2a2a28;

	--font-body: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
	--font-display: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
	--font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

	--measure: 36rem;     /* 本文の行長 */
	--wide: 48rem;        /* 画像など少し広く */
	--gutter: clamp(1.5rem, 6vw, 3rem);
	--space: clamp(5rem, 14vh, 9rem); /* セクション間の大きな間 */

	/* オーロラ（ライト：生成りに淡くにじむ程度） */
	--aurora-opacity: .75;
	--aurora-1: rgba(58, 148, 122, .32);
	--aurora-2: rgba(44, 116, 158, .26);
	--aurora-3: rgba(104, 168, 118, .22);
	--aurora-ray: rgba(64, 156, 130, .22);
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #181817;
		--ink: #dcdad4;
		--muted: #85837d;
		--line: #2c2b29;
		--accent: #dcdad4;

		--aurora-opacity: 1;
		--aurora-1: rgba(40, 132, 104, .55);
		--aurora-2: rgba(34, 102, 142, .48);
		--aurora-3: rgba(72, 140, 96, .36);
		--aurora-ray: rgba(96, 196, 164, .26);
	}
}

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 1rem;
	font-weight: 400;
	line-height: 2;
	letter-spacing: 0.04em;
	font-feature-settings: "palt" 0;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

a {
	color: inherit;
	text-decoration: none;
	transition: opacity .3s ease;
}
a:hover { opacity: .55; }
a:focus-visible {
	outline: 1px solid var(--ink);
	outline-offset: 4px;
}

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

::selection { background: var(--ink); color: var(--bg); }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}
.screen-reader-text:focus {
	clip: auto; width: auto; height: auto;
	padding: .5rem 1rem;
	top: 1rem; left: 1rem;
	background: var(--bg);
	z-index: 100;
}

/* ------------------------------------------------------------
   Layout
   ------------------------------------------------------------ */
.site {
	position: relative;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	padding: 0 var(--gutter);
}
.site > :not(.aurora) {
	position: relative;
	z-index: 1;
}

/* ------------------------------------------------------------
   Aurora — ヘッダー背後で緩やかに揺らめく光
   transform / opacity のみをアニメーションさせ、描画負荷を抑える。
   ------------------------------------------------------------ */
.aurora {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: clamp(24rem, 64vh, 40rem);
	overflow: hidden;
	pointer-events: none;
	z-index: 0;
	opacity: var(--aurora-opacity);
}

/*
 * 上から下へ、中央から左右へ溶けるビネット。
 * mask-image だと動くレイヤーを毎フレーム合成し直すことになり、
 * スマホ（特に Safari）でちらつきの原因になるため、背景色を重ねて表現する。
 */
.aurora::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background: radial-gradient(ellipse 85% 100% at 50% 0%, transparent 25%, var(--bg) 78%);
}

/*
 * 描画面は画面幅ちょうど。構図はデスクトップ幅（1280px）基準で作られた画像を
 * 中央で切り取って表示するので、狭い画面でも見える範囲は Ma と同じになる。
 * レイヤー自体は見えている範囲の大きさしか持たないため、スマホでも描画メモリが小さく済む。
 */
.aurora__stage {
	position: absolute;
	inset: 0;
}

.aurora__stage > * {
	position: absolute;
	display: block;
}

/*
 * Ma-Lite：各レイヤーは Ma のオーロラを「止まったときの姿」で事前に描画した画像。
 * filter / mask / SVG を一切使わず、画像を transform と opacity で動かすだけにして、
 * GPU ドライバによる描画差（ちらつき）が出ないようにしている。
 *
 * 画像は描画面の上下左右に 20% ずつ余白を足した範囲（140% × 140%）を描いたもの。
 * 入場アニメーションで動かしても端が見えないようにするための余白。
 *
 * レイヤーは 2 枚（色の雲・リボン 3 本をまとめた 1 枚）。
 * 大きな画像レイヤーを同時に 4〜5 枚動かすと、Chrome の描画メモリが足りなくなり
 * フレームを描き切れなくなる（スマホでは画素密度の分さらに厳しい）ため。
 */
.aurora__layer {
	top: -20%;
	left: -20%;
	width: 140%;
	height: 140%;
	background-repeat: no-repeat;
	/* 画像の横幅は「1280px の描画面 × 140%」= 1792px を下限に、中央で切り取る */
	background-size: max(100%, 1792px) 100%;
	background-position: 50% 0;
}

.aurora__layer--glow     { background-image: url("assets/aurora/glow-light.webp"); }
.aurora__layer--ribbons  { background-image: url("assets/aurora/ribbons-light.webp"); }

@media (prefers-color-scheme: dark) {
	.aurora__layer--glow     { background-image: url("assets/aurora/glow-dark.webp"); }
	.aurora__layer--ribbons  { background-image: url("assets/aurora/ribbons-dark.webp"); }
}

/* リボンの支点：元の SVG の右上の角（画像内の位置に換算） */
.aurora__layer--ribbons {
	/* 画像の 88.6% の位置。画像は中央寄せなので、レイヤー中央からの距離で指定する */
	transform-origin: calc(50% + .386 * max(100%, 1792px)) 10%;
}

/* ------------------------------------------------------------
   Aurora intro — サイトに入ってきたときに 1 回だけ再生
   （html.aurora-seen は functions.php のインラインスクリプトが付与）
   ------------------------------------------------------------ */
.aurora__layer {
	animation-duration: 5s;
	animation-timing-function: cubic-bezier(.25, .1, .2, 1);
	animation-fill-mode: backwards; /* 開始待ちの間も from の状態（何もない）を保つ */
	animation-iteration-count: 1;
}
.aurora__layer--glow     { animation-name: aurora-in-glow;    animation-duration: 6s; }
.aurora__layer--ribbons  { animation-name: aurora-in-ribbon;  animation-delay: .5s; animation-duration: 5.5s; }

/* 色の雲：左下からふわりと滲み出る */
@keyframes aurora-in-glow {
	from { opacity: 0; transform: translate3d(-4.5%, 2.5%, 0) scale(.94); }
}
/* リボン：右上の支点から、左下へ向かってほどけるように伸びる */
@keyframes aurora-in-ribbon {
	from { opacity: 0; transform: rotate(10deg) scale(.75, .57); }
}

html.aurora-seen .aurora__stage * {
	animation: none;
}

.site-main {
	flex: 1;
	width: 100%;
	max-width: var(--measure);
	margin: 0 auto;
	padding: var(--space) 0;
}

/* ------------------------------------------------------------
   Header
   ------------------------------------------------------------ */
.site-header {
	width: 100%;
	max-width: var(--measure);
	margin: 0 auto;
	padding-top: clamp(2.5rem, 8vh, 4.5rem);
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem 2rem;
}

.site-title {
	margin: 0;
	font-family: var(--font-display);
	font-size: 1.0625rem;
	font-weight: 500;
	letter-spacing: .2em;
	line-height: 1.6;
}

.site-description {
	margin: .25rem 0 0;
	color: var(--muted);
	font-size: .75rem;
	letter-spacing: .12em;
}

.site-nav ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: .25rem 1.75rem;
}
.site-nav a {
	color: var(--muted);
	font-size: .8125rem;
	letter-spacing: .14em;
}
.site-nav .current-menu-item > a,
.site-nav a:hover {
	color: var(--ink);
	opacity: 1;
}

/* ------------------------------------------------------------
   Archive / Index
   ------------------------------------------------------------ */
.archive-header {
	margin-bottom: 4rem;
}
.archive-title {
	margin: 0;
	font-family: var(--font-display);
	font-size: 1.125rem;
	font-weight: 500;
	letter-spacing: .14em;
}
.archive-description {
	margin-top: .75rem;
	color: var(--muted);
	font-size: .875rem;
}

.post-list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.post-list__item + .post-list__item {
	margin-top: 3.25rem;
}
.post-list__date {
	display: block;
	color: var(--muted);
	font-family: var(--font-mono);
	font-size: .75rem;
	letter-spacing: .08em;
	line-height: 1;
	margin-bottom: .75rem;
}
.post-list__title {
	margin: 0;
	font-family: var(--font-display);
	font-size: 1.1875rem;
	font-weight: 500;
	line-height: 1.75;
	letter-spacing: .06em;
}
.post-list__excerpt {
	margin: .5rem 0 0;
	color: var(--muted);
	font-size: .875rem;
	line-height: 1.9;
}

.pagination {
	margin-top: 6rem;
	font-size: .8125rem;
	letter-spacing: .14em;
}
.pagination .nav-links {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
}
.pagination .page-numbers { color: var(--muted); padding: 0 .35em; }
.pagination .page-numbers.current { color: var(--ink); }

.no-results {
	color: var(--muted);
}

/* ------------------------------------------------------------
   Single / Page
   ------------------------------------------------------------ */
.entry-header {
	margin-bottom: 4.5rem;
}
.entry-meta {
	display: block;
	color: var(--muted);
	font-family: var(--font-mono);
	font-size: .75rem;
	letter-spacing: .08em;
	margin-bottom: 1.5rem;
}
.entry-title {
	margin: 0;
	font-family: var(--font-display);
	font-size: clamp(1.5rem, 1.2rem + 1.2vw, 1.875rem);
	font-weight: 500;
	line-height: 1.6;
	letter-spacing: .08em;
}

.entry-thumbnail {
	margin: 0 0 4rem;
}
.entry-thumbnail img { display: block; width: 100%; }

.entry-footer {
	margin-top: 5rem;
	padding-top: 2rem;
	border-top: 1px solid var(--line);
	color: var(--muted);
	font-size: .8125rem;
	letter-spacing: .1em;
}
.entry-footer a { margin-right: 1em; }

.post-navigation {
	margin-top: 4rem;
	font-size: .875rem;
}
.post-navigation .nav-links {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 2rem;
}
.post-navigation .nav-next { text-align: right; grid-column: 2; }
.post-navigation .meta-nav {
	display: block;
	color: var(--muted);
	font-size: .75rem;
	letter-spacing: .14em;
	margin-bottom: .25rem;
}

/* ------------------------------------------------------------
   Content typography (also used by editor-style.css)
   ------------------------------------------------------------ */
.entry-content > * { margin-top: 0; margin-bottom: 0; }
.entry-content > * + * { margin-top: 1.75em; }

.entry-content h2,
.entry-content h3,
.entry-content h4 {
	font-family: var(--font-display);
	font-weight: 500;
	line-height: 1.7;
	letter-spacing: .08em;
}
.entry-content > h2 { font-size: 1.3125rem; margin-top: 4.5em; }
.entry-content > h3 { font-size: 1.125rem;  margin-top: 3.5em; }
.entry-content > h4 { font-size: 1rem;      margin-top: 3em; }
.entry-content > h2 + *,
.entry-content > h3 + *,
.entry-content > h4 + * { margin-top: 1.25em; }

.entry-content a {
	text-decoration: underline;
	text-decoration-color: var(--muted);
	text-decoration-thickness: 1px;
	text-underline-offset: .3em;
}

.entry-content ul,
.entry-content ol { padding-left: 1.5em; }
.entry-content li + li { margin-top: .4em; }

.entry-content blockquote,
.entry-content .wp-block-quote {
	margin-left: 0;
	margin-right: 0;
	padding-left: 1.75em;
	border-left: 1px solid var(--line);
	color: var(--muted);
}
.entry-content blockquote cite {
	display: block;
	margin-top: 1em;
	font-size: .8125rem;
	font-style: normal;
}

.entry-content hr,
.entry-content .wp-block-separator {
	border: 0;
	height: auto;
	margin: 5em auto;
	text-align: center;
	background: none;
}
.entry-content hr::before,
.entry-content .wp-block-separator::before {
	content: "・・・";
	color: var(--muted);
	letter-spacing: 1em;
	font-size: .75rem;
}

.entry-content figure { margin-left: 0; margin-right: 0; }
.entry-content > figure,
.entry-content > .wp-block-image,
.entry-content > .wp-block-gallery,
.entry-content > .wp-block-embed { margin-top: 3.5em; margin-bottom: 3.5em; }
.entry-content > .alignwide {
	width: min(var(--wide), calc(100vw - var(--gutter) * 2));
	max-width: none;
	margin-left: 50%;
	transform: translateX(-50%);
}
.entry-content > .alignfull {
	width: 100vw;
	max-width: none;
	margin-left: 50%;
	transform: translateX(-50%);
}
.entry-content figcaption,
.entry-content .wp-element-caption {
	margin-top: .75em;
	color: var(--muted);
	font-size: .75rem;
	text-align: center;
	letter-spacing: .08em;
}
.entry-content img { display: block; }
.alignleft  { float: left;  margin: .5em 2em 1em 0; }
.alignright { float: right; margin: .5em 0 1em 2em; }
.aligncenter { margin-left: auto; margin-right: auto; }

.entry-content code,
.entry-content kbd {
	font-family: var(--font-mono);
	font-size: .875em;
	padding: .1em .35em;
	background: var(--line);
	border-radius: 2px;
}
.entry-content pre {
	font-family: var(--font-mono);
	font-size: .8125rem;
	line-height: 1.8;
	padding: 1.5em;
	overflow-x: auto;
	background: transparent;
	border: 1px solid var(--line);
	letter-spacing: 0;
}
.entry-content pre code { padding: 0; background: none; }

.entry-content table {
	width: 100%;
	border-collapse: collapse;
	font-size: .875rem;
}
.entry-content th,
.entry-content td {
	padding: .75em .5em;
	border-bottom: 1px solid var(--line);
	text-align: left;
}

/* ------------------------------------------------------------
   Comments
   ------------------------------------------------------------ */
.comments-area {
	margin-top: 6rem;
	font-size: .9375rem;
}
.comments-title,
.comment-reply-title {
	font-family: var(--font-display);
	font-size: 1rem;
	font-weight: 500;
	letter-spacing: .14em;
	margin: 0 0 2.5rem;
}
.comment-list,
.comment-list .children {
	list-style: none;
	margin: 0;
	padding: 0;
}
.comment-list .children { padding-left: 1.75rem; border-left: 1px solid var(--line); }
.comment-body { margin-bottom: 2.5rem; }
.comment-meta {
	color: var(--muted);
	font-size: .75rem;
	letter-spacing: .08em;
}
.comment-meta .avatar { display: none; }
.comment-author .fn { color: var(--ink); font-style: normal; }
.comment-author .says { display: none; }
.comment-metadata { display: inline; margin-left: .75em; }
.reply { font-size: .75rem; color: var(--muted); letter-spacing: .1em; }

.comment-respond { margin-top: 4rem; }
.comment-form label {
	display: block;
	color: var(--muted);
	font-size: .75rem;
	letter-spacing: .12em;
	margin-bottom: .25rem;
}
.comment-form p { margin: 0 0 1.5rem; }
.comment-notes,
.logged-in-as { color: var(--muted); font-size: .75rem; }

input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
textarea {
	width: 100%;
	padding: .6em 0;
	font: inherit;
	color: var(--ink);
	background: transparent;
	border: 0;
	border-bottom: 1px solid var(--line);
	border-radius: 0;
	transition: border-color .3s ease;
}
input:focus,
textarea:focus {
	outline: none;
	border-bottom-color: var(--ink);
}
textarea { resize: vertical; min-height: 8em; }

button,
input[type="submit"] {
	font: inherit;
	font-size: .8125rem;
	letter-spacing: .2em;
	color: var(--ink);
	background: transparent;
	border: 1px solid var(--ink);
	padding: .75em 2.25em;
	cursor: pointer;
	transition: background .3s ease, color .3s ease;
}
button:hover,
input[type="submit"]:hover {
	background: var(--ink);
	color: var(--bg);
}

.search-form { display: flex; gap: 1rem; align-items: flex-end; }
.search-form label { flex: 1; }
.search-form__input { flex: 1; min-width: 0; }
.search-form__input::placeholder { color: var(--muted); opacity: .6; }
.search-form__submit { padding: .6em 1.5em; }
.archive-header .search-form { margin-top: 2rem; }

/* ------------------------------------------------------------
   Home aside (search + monthly archive)
   ------------------------------------------------------------ */
.home-aside {
	margin-top: 7rem;
	padding-top: 3rem;
	border-top: 1px solid var(--line);
	display: grid;
	gap: 3.5rem;
}
.home-aside__title {
	margin: 0 0 1.25rem;
	color: var(--muted);
	font-family: var(--font-body);
	font-size: .75rem;
	font-weight: 400;
	letter-spacing: .2em;
}
.archive-years {
	margin: 0;
	display: grid;
	grid-template-columns: auto 1fr;
	column-gap: 2rem;
	row-gap: .75rem;
	align-items: baseline;
}
.archive-years__year {
	font-family: var(--font-mono);
	font-size: .8125rem;
	letter-spacing: .08em;
	color: var(--ink);
}
.archive-years__months { margin: 0; }
.archive-years__months ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: .5rem 1.5rem;
}
.archive-years__months a {
	font-family: var(--font-mono);
	font-size: .8125rem;
	letter-spacing: .08em;
	color: var(--muted);
}
.archive-years__months a:hover { color: var(--ink); }
.archive-years__count {
	margin-left: .35em;
	font-size: .6875rem;
	opacity: .6;
}
.archive-years__count::before { content: "("; }
.archive-years__count::after { content: ")"; }
.category-list,
.category-list__children {
	list-style: none;
	margin: 0;
	padding: 0;
}
.category-list > li + li { margin-top: .6rem; }
.category-list__children { margin-top: .5rem; padding-left: 1em; }
.category-list__children > li + li { margin-top: .4rem; }
.category-list a {
	color: var(--muted);
	font-size: .875rem;
	letter-spacing: .08em;
}
.category-list a:hover { color: var(--ink); }
.category-list .archive-years__count { font-family: var(--font-mono); }

/* 2ペイン：右側に検索とアーカイブ */
@media (min-width: 52rem) {
	.home-aside {
		margin: 0;
		padding: 0 0 0 2rem;
		border-top: 0;
		border-left: 1px solid var(--line);
		gap: 3rem;
	}
	.home-aside .search-form { gap: .75rem; }
	.home-aside .search-form__input { font-size: .875rem; }
	.home-aside .search-form__submit { padding: .5em 1em; font-size: .75rem; letter-spacing: .14em; }
	.archive-years { column-gap: 1.25rem; }
	.archive-years__months ul { gap: .4rem 1rem; }
}

/* 中くらいの幅：本文の列と右ペインをまとめて中央に置く */
@media (min-width: 52rem) and (max-width: 74.99rem) {
	.home .site-header,
	.home .site-main,
	.home .site-footer { max-width: calc(var(--measure) + 15rem); }
	.home .site-main {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 12rem;
		column-gap: 3rem;
		align-content: start;
	}
	.home .site-main > * { grid-column: 1; }
	.home .site-main > .home-aside {
		grid-column: 2;
		grid-row: 1 / span 10;
		align-self: start;
	}
}

/* 広い幅：本文の列は中央のまま、右の余白に静かに置く */
@media (min-width: 75rem) {
	.home .site-main { position: relative; }
	.home-aside {
		position: absolute;
		top: var(--space);
		left: calc(100% + 5rem);
		width: 13rem;
	}
}

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */
.site-footer {
	width: 100%;
	max-width: var(--measure);
	margin: 0 auto;
	padding: 0 0 clamp(2.5rem, 8vh, 4rem);
	color: var(--muted);
	font-size: .6875rem;
	letter-spacing: .16em;
}

/* ------------------------------------------------------------
   Small screens
   ------------------------------------------------------------ */
@media (max-width: 600px) {
	body { font-size: .9375rem; line-height: 1.95; }
	.site-header { flex-direction: column; gap: 1.25rem; }
	.alignleft, .alignright { float: none; margin: 1.5em 0; }
	.post-navigation .nav-links { grid-template-columns: 1fr; }
	.post-navigation .nav-next { grid-column: 1; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; }
	.aurora__stage * { animation: none; }
}
