/*
  サイト全体のスタイル。

  ※ Astro 7.3.4 には CSS パイプラインが出力を生成しない不具合があり、
    .astro の <style> ブロックや src/styles からの import が
    ビルド結果に一切含まれない。そのため CSS は public/ に置いて
    そのまま配信している（BaseHead.astro から <link> で読み込む）。
    Astro 側が直ったら src/styles へ戻してよい。

  配色:
    背景        #FFFFFF
    本文        #333333
    メイン      青 #0067C0（濃）/ #2B8FFF（明）… 見出し・リンク
    差し色      オレンジレッド #D93900 … セール・重要ポイント
    ダーク部分  #1A1A1A … ヘッダー・フッター

  グラデーションは使わない（すべて単色）。
  画像は基本的に角を丸めない。
*/

/* ---------------------------------------------------------------- tokens */

:root {
	/* 常に白背景で表示する（ダークテーマ時も配色を変えない） */
	color-scheme: light;

	--bg: #ffffff;

	--text: #333333;
	--text-strong: #1a1a1a;
	--text-muted: #6e6e73;

	--blue: #0067c0;
	--blue-bright: #2b8fff;
	--blue-soft: #eaf4ff;
	--blue-border: #c7e0f7;

	/* セール・重要ポイント用の差し色 */
	--alert: #d93900;
	--alert-soft: #fff1ec;

	/* ヘッダー・フッターなどのダーク部分 */
	--dark: #1a1a1a;
	--on-dark: #f2f2f2;
	--on-dark-muted: #a8a8a8;

	--line: #e6e6ea;

	/* レイアウト */
	--container: 1200px;
	--sidebar-width: 320px;
	--gutter: 56px;

	--font-sans:
		var(--font-atkinson), system-ui, -apple-system, 'Segoe UI', 'Hiragino Sans',
		'Hiragino Kaku Gothic ProN', 'Noto Sans JP', Meiryo, sans-serif;
}

/* ---------------------------------------------------------------- base */

* {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
	background-color: var(--bg);
}

body {
	font-family: var(--font-sans);
	margin: 0;
	padding: 0;
	text-align: left;
	background-color: var(--bg);
	color: var(--text);
	font-size: 17px;
	line-height: 1.9;
	line-break: strict;
	overflow-wrap: anywhere;
}

/* 本文カラム + 右サイドバーの2カラム。PC幅のときだけサイドバーを出す */
.layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) var(--sidebar-width);
	gap: var(--gutter);
	max-width: var(--container);
	margin: 0 auto;
	padding: 0 24px;
	align-items: start;
}
.layout > main {
	min-width: 0;
	padding: 2.5em 0 4em;
}

@media (max-width: 1040px) {
	.layout {
		grid-template-columns: minmax(0, 1fr);
		max-width: 820px;
		gap: 0;
	}
	/* 横幅が足りないときは、サイドバーの内容を本文の最後に回す */
	.sidebar {
		padding: 2.5em 0 4em;
		margin-top: 2.5em;
		border-top: 2px solid var(--line);
	}
	.layout > main {
		padding: 2em 0 0;
	}
}

h1,
h2,
h3 {
	margin: 0 0 0.6rem 0;
	color: var(--blue);
	line-height: 1.4;
	font-weight: 700;
}
h4,
h5,
h6 {
	margin: 0 0 0.6rem 0;
	color: var(--text-strong);
	line-height: 1.4;
	font-weight: 700;
}
h1 {
	font-size: 2em;
	line-height: 1.35;
}
h2 {
	font-size: 1.5em;
}
h3 {
	font-size: 1.2em;
}
h4 {
	font-size: 1.05em;
}

strong,
b {
	font-weight: 700;
	color: var(--text-strong);
}

a {
	color: var(--blue);
	text-underline-offset: 3px;
	text-decoration-color: var(--blue-border);
}
a:hover {
	color: var(--blue-bright);
	text-decoration-color: var(--blue-bright);
}

p {
	margin-bottom: 1.4em;
}

:focus-visible {
	outline: 2px solid var(--blue-bright);
	outline-offset: 2px;
}

/* 画像は基本的に角を丸めない */
img {
	max-width: 100%;
	height: auto;
	border-radius: 0;
	display: block;
}

code {
	padding: 2px 5px;
	background-color: var(--blue-soft);
	color: #00508f;
	border-radius: 3px;
	font-size: 0.9em;
}
pre {
	padding: 1.2em;
	overflow-x: auto;
}
pre > code {
	all: unset;
}

hr {
	border: none;
	border-top: 1px solid var(--line);
	margin: 2em 0;
}

.empty {
	color: var(--text-muted);
	padding: 2em 0;
}

.sr-only {
	border: 0;
	padding: 0;
	margin: 0;
	position: absolute !important;
	height: 1px;
	width: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ---------------------------------------------------------------- header */

.site-header {
	background: var(--dark);
}
.site-header nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 2em;
	max-width: var(--container);
	margin: 0 auto;
	padding: 0 24px;
}
.site-name {
	margin: 0;
	font-size: 1.05em;
	font-weight: 700;
	white-space: nowrap;
}
.site-name a {
	color: var(--on-dark);
	text-decoration: none;
}
.site-name a:hover {
	color: var(--blue-bright);
}
.nav-links {
	display: flex;
	flex-wrap: wrap;
}
.nav-links a {
	display: inline-block;
	padding: 1.1em 0.75em;
	color: var(--on-dark-muted);
	border-bottom: 3px solid transparent;
	text-decoration: none;
	font-size: 0.88em;
	white-space: nowrap;
}
.nav-links a:hover {
	color: var(--on-dark);
}
.nav-links a.active {
	font-weight: 700;
	color: var(--on-dark);
	border-bottom-color: var(--blue-bright);
}

/* ---------------------------------------------------------------- ファーストビュー */

.fv {
	background: var(--dark);
	border-top: 1px solid #2c2c2c;
	color: var(--on-dark);
}
.fv-inner {
	max-width: var(--container);
	margin: 0 auto;
	padding: 4em 24px;
}
.fv h1 {
	color: #ffffff;
	font-size: 2.6em;
	line-height: 1.25;
	margin: 0 0 0.4em;
	letter-spacing: 0.01em;
}
.fv p {
	color: var(--on-dark-muted);
	margin: 0;
	font-size: 1.02em;
}

@media (max-width: 720px) {
	.fv-inner {
		padding: 2.6em 20px;
	}
	.fv h1 {
		font-size: 1.9em;
	}
}

/* 全幅セクション用のコンテナ（サイドバーの幅まで使う） */
.container {
	max-width: var(--container);
	margin: 0 auto;
	padding: 0 24px;
}
@media (max-width: 1040px) {
	.container {
		max-width: 820px;
	}
}
@media (max-width: 720px) {
	.container {
		padding: 0 20px;
	}
}

.feed {
	padding-top: 2.5em;
}

/* ---------------------------------------------------------------- 新着/人気タブ */

.tabs {
	display: flex;
	gap: 0;
	border-bottom: 2px solid var(--line);
	margin-bottom: 1.8em;
}
.tab {
	appearance: none;
	background: none;
	border: none;
	border-bottom: 3px solid transparent;
	margin-bottom: -2px;
	padding: 0.7em 1.2em;
	font: inherit;
	font-weight: 700;
	font-size: 1em;
	color: var(--text-muted);
	cursor: pointer;
}
.tab:hover {
	color: var(--blue);
}
.tab.is-active {
	color: var(--blue);
	border-bottom-color: var(--blue);
}

/* ---------------------------------------------------------------- 記事カード */

/* 横3列 × 2行 ＝ 最大6記事 */
.card-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1.8em 1.4em;
}
@media (max-width: 860px) {
	.card-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
/* モバイルでも2列のまま。文字と余白だけ幅に合わせて詰める */
@media (max-width: 520px) {
	.card-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 1.4em 0.9em;
	}
	.card-grid .card-title {
		font-size: 0.82em;
		line-height: 1.55;
		margin-top: 0.55em;
	}
	.card-grid .card-category {
		font-size: 0.6em;
		padding: 0.3em 0.6em;
	}
}

.card a {
	display: block;
	text-decoration: none;
	color: inherit;
}
.card-image {
	position: relative;
	aspect-ratio: 1200 / 630;
	background: var(--dark);
	overflow: hidden;
}
.card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.25s ease;
}
.card a:hover .card-image img {
	transform: scale(1.03);
}
.card-category {
	position: absolute;
	left: 0;
	bottom: 0;
	background: var(--blue);
	color: #ffffff;
	font-size: 0.72em;
	font-weight: 700;
	padding: 0.35em 0.9em;
	letter-spacing: 0.02em;
}
.card-title {
	margin: 0.7em 0 0;
	font-size: 0.93em;
	line-height: 1.6;
	color: var(--text-strong);
	font-weight: 700;
}
.card a:hover .card-title {
	color: var(--blue);
	text-decoration: underline;
}

/* ------------------------------------------------- 新着/人気の「左1枚大 + 右4枚」 */

.feed-grid {
	display: grid;
	grid-template-columns: 1.08fr 1fr;
	gap: 1.8em;
	align-items: stretch;
}

/* 右側は2列 × 2行 ＝ 4枚 */
.feed-sub {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	grid-template-rows: auto auto;
	gap: 1.8em 1.4em;
	align-content: start;
}

/*
  左の大カードは、右側（小カード2行分）と同じ高さにそろえる。
  カード全体を縦Flexにして、画像を余った高さいっぱいに伸ばす。
*/
.card-large {
	height: 100%;
}
.card-large a {
	display: flex;
	flex-direction: column;
	height: 100%;
}
.card-large .card-image {
	flex: 1 1 auto;
	aspect-ratio: auto;
	min-height: 220px;
}
.card-large .card-image img {
	height: 100%;
	object-fit: cover;
}
.card-large .card-title {
	font-size: 1.25em;
	line-height: 1.55;
	flex: 0 0 auto;
}
.card-large .card-category {
	font-size: 0.78em;
	padding: 0.4em 1em;
}

@media (max-width: 900px) {
	.feed-grid {
		grid-template-columns: minmax(0, 1fr);
	}
	.card-large .card-image {
		aspect-ratio: 1200 / 630;
		min-height: 0;
	}
	.card-large .card-title {
		font-size: 1.1em;
	}
}
@media (max-width: 520px) {
	.feed-sub {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* ---------------------------------------------------------------- カテゴリ別セクション */

.section-heading {
	font-size: 1.25em;
	padding-bottom: 0.4em;
	border-bottom: 2px solid var(--blue-border);
	margin-bottom: 1.2em;
}

.cat-section {
	margin-top: 3.5em;
}
/* 最初のセクションはサイドバー先頭（「記事を探す」）と高さを揃えるため余白なし */
.cat-section:first-of-type {
	margin-top: 0;
}
.cat-section-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1em;
	padding-bottom: 0.4em;
	border-bottom: 2px solid var(--blue-border);
}
.cat-section-head h2 {
	margin: 0;
	font-size: 1.25em;
}
.cat-section-head h2 a {
	text-decoration: none;
}
/* セクションごとに見出し下線の色を変える */
.cat-section:nth-of-type(2) .cat-section-head {
	border-bottom-color: #a9d3f7;
}
.cat-section:nth-of-type(3) .cat-section-head {
	border-bottom-color: #f6c3b2;
}
.cat-section:nth-of-type(3) .cat-section-head h2 a {
	color: var(--alert);
}
.cat-section-more {
	font-size: 0.82em;
	font-weight: 700;
	text-decoration: none;
	white-space: nowrap;
}
.cat-section-desc {
	margin: 0.8em 0 1.4em;
	font-size: 0.88em;
	color: var(--text-muted);
}

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

.page-head {
	margin-bottom: 2em;
	padding-bottom: 1.2em;
	border-bottom: 2px solid var(--blue-border);
}
.page-head h1 {
	margin-bottom: 0.3em;
}
.page-lead {
	margin: 0 0 0.6em;
	color: var(--text);
}
.list-count {
	margin: 0;
	color: var(--text-muted);
	font-size: 0.88em;
}
.list-group {
	margin-bottom: 3em;
}
.list-group h2 {
	font-size: 1.25em;
	padding-bottom: 0.4em;
	border-bottom: 2px solid var(--blue-border);
	margin-bottom: 1.2em;
}
.list-group h2 a {
	text-decoration: none;
}

/* ---------------------------------------------------------------- 記事ページ */

.post-header {
	margin-bottom: 1.6em;
}
.post-header h1 {
	margin: 0.4em 0 0.4em;
	color: var(--text-strong);
}
.post-date {
	margin: 0;
	font-size: 0.85em;
	color: var(--text-muted);
}
.category-badge {
	display: inline-block;
	background: var(--blue);
	color: #ffffff;
	font-size: 0.76em;
	font-weight: 700;
	padding: 0.3em 0.9em;
	text-decoration: none;
	letter-spacing: 0.02em;
}
.category-badge:hover {
	background: var(--blue-bright);
	color: #ffffff;
}
.post-cover {
	margin-bottom: 2.2em;
	background: var(--dark);
}
.post-cover img {
	width: 100%;
}
.post-body {
	color: var(--text);
}
.post-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6em;
	list-style: none;
	padding: 0;
	margin: 3em 0 0;
}
.post-tags li {
	background: var(--blue-soft);
	color: var(--blue);
	font-size: 0.8em;
	padding: 0.2em 0.8em;
	border: 1px solid var(--blue-border);
}
.post-back {
	margin-top: 2.5em;
	padding-top: 1.5em;
	border-top: 1px solid var(--line);
	font-size: 0.9em;
}
.post-back a {
	text-decoration: none;
	font-weight: 700;
}

/* ---------------------------------------------------------------- 記事本文 */

.prose h2 {
	margin-top: 2.2em;
	padding-bottom: 0.3em;
	border-bottom: 2px solid var(--blue-border);
}
.prose h3 {
	margin-top: 1.8em;
	padding-left: 0.5em;
	border-left: 4px solid var(--blue-bright);
}
.prose p {
	margin-bottom: 1.8em;
}
.prose ul,
.prose ol {
	margin-bottom: 1.8em;
	padding-left: 1.4em;
}
.prose li {
	margin-bottom: 0.4em;
}
.prose li::marker {
	color: var(--blue);
}
.prose table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 1.8em;
	font-size: 0.95em;
	display: block;
	overflow-x: auto;
}
.prose th,
.prose td {
	border: 1px solid var(--line);
	padding: 0.6em 0.8em;
	text-align: left;
	vertical-align: top;
}
.prose th {
	background: var(--blue-soft);
	color: var(--text-strong);
	font-weight: 700;
	white-space: nowrap;
	border-bottom: 2px solid var(--blue-border);
}
/* 引用は「重要ポイント」の扱いなので差し色のオレンジレッド */
.prose blockquote {
	border-left: 4px solid var(--alert);
	background: var(--alert-soft);
	color: var(--text);
	padding: 0.8em 1.2em;
	margin: 0 0 1.8em 0;
}
.prose blockquote p:last-child {
	margin-bottom: 0;
}

/* ---------------------------------------------------------------- サイドバー */

/* サイドバーはスクロール追従せず、本文と一緒に流れる。
   上端は本文側の最初のセクション（「パソコンの選び方」）と揃える。 */
.sidebar {
	align-self: start;
	padding: 2.5em 0 4em;
}
.sidebar-inner {
	position: static;
}
.side-block {
	margin-bottom: 2.2em;
}
.side-heading {
	font-size: 0.95em;
	color: var(--text-strong);
	padding-bottom: 0.5em;
	margin-bottom: 0.9em;
	border-bottom: 2px solid var(--blue);
}

/* 検索 */
.search {
	position: relative;
}
.search-input {
	width: 100%;
	font-size: 15px;
	font-family: inherit;
	padding: 0.65em 0.8em;
	border: 1px solid var(--line);
	background: #fafafa;
	color: var(--text);
}
.search-input:focus {
	background: #ffffff;
	border-color: var(--blue);
	outline: none;
}
.search-results {
	list-style: none;
	margin: 0.6em 0 0;
	padding: 0;
	border: 1px solid var(--line);
}
.search-results li {
	border-bottom: 1px solid var(--line);
	padding: 0.6em 0.8em;
}
.search-results li:last-child {
	border-bottom: none;
}
.search-results a {
	display: block;
	font-size: 0.88em;
	line-height: 1.55;
	text-decoration: none;
	font-weight: 700;
}
.search-result-cat {
	display: block;
	font-size: 0.74em;
	color: var(--text-muted);
	margin-top: 0.2em;
}
.search-empty {
	margin: 0.6em 0 0;
	font-size: 0.85em;
	color: var(--text-muted);
}

/* カテゴリ一覧 */
.side-categories {
	list-style: none;
	margin: 0;
	padding: 0;
}
.side-categories li {
	border-bottom: 1px solid var(--line);
}
.side-categories a {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.5em;
	padding: 0.7em 0.2em;
	text-decoration: none;
	font-size: 0.92em;
	font-weight: 700;
}
.side-categories a:hover {
	color: var(--blue-bright);
}
.side-count {
	font-size: 0.8em;
	font-weight: 400;
	color: var(--text-muted);
	background: var(--blue-soft);
	padding: 0.05em 0.6em;
}

/* 管理人紹介 */
.profile {
	border: 1px solid var(--line);
	padding: 1.2em;
	text-align: center;
}
.profile-avatar {
	width: 84px;
	height: 84px;
	margin: 0 auto 0.8em;
	object-fit: cover;
}
.profile-name {
	margin: 0 0 0.5em;
	font-weight: 700;
	color: var(--text-strong);
}
.profile-text {
	margin: 0 0 1em;
	font-size: 0.85em;
	line-height: 1.8;
	color: var(--text-muted);
	text-align: left;
}
.profile-link {
	display: inline-block;
	font-size: 0.85em;
	font-weight: 700;
	text-decoration: none;
	border: 1px solid var(--blue);
	padding: 0.45em 1.2em;
}
.profile-link:hover {
	background: var(--blue);
	color: #ffffff;
}

/* ---------------------------------------------------------------- footer */

.site-footer {
	padding: 2.5em 24px 4em;
	background: var(--dark);
	color: var(--on-dark-muted);
	text-align: center;
	font-size: 0.9em;
}
.footer-links {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 1.2em;
	margin-bottom: 1.2em;
}
.footer-links a {
	color: var(--on-dark);
	text-decoration: none;
	font-weight: 700;
}
.footer-links a:hover {
	color: var(--blue-bright);
	text-decoration: underline;
}
.footer-note {
	max-width: 44em;
	margin: 0 auto 1em;
	font-size: 0.85em;
	line-height: 1.7;
}
.footer-copy {
	margin: 0;
}

/* ---------------------------------------------------------------- 狭い画面 */

@media (max-width: 720px) {
	body {
		font-size: 16px;
		line-height: 1.85;
	}
	h1 {
		font-size: 1.6em;
	}
	h2 {
		font-size: 1.3em;
	}
	.site-header nav {
		flex-direction: column;
		align-items: flex-start;
		gap: 0;
		padding: 0.8em 20px 0;
	}
	.nav-links {
		margin-left: -0.75em;
	}
	.nav-links a {
		padding: 0.6em 0.75em 0.8em;
	}
	.layout {
		padding: 0 20px;
	}
}
