/* ========================================
   Senior AI - Main Stylesheet
   シニア向けに最適化：大きい文字・高コントラスト・広いタップ領域
   ======================================== */

/* ---------- Base ---------- */
body { overflow-wrap: anywhere; word-break: normal; }
::selection { background: var(--color-accent); color: #fff; }

button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

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

/* フォントサイズ切替対応（JSで data-font-size 属性を変える） */
html[data-font-size="small"] { --font-base: 16px; }
html[data-font-size="medium"] { --font-base: 18px; }
html[data-font-size="large"] { --font-base: 20px; }
html[data-font-size="xlarge"] { --font-base: 22px; }

/* ---------- Layout ---------- */
.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-branding { display: flex; align-items: center; gap: 12px; }
.site-logo { max-height: 48px; width: auto; }

.main-nav { display: flex; align-items: center; gap: 12px; }
.main-nav-list {
	display: flex; list-style: none; margin: 0; padding: 0; gap: 4px;
	flex-wrap: wrap;
}
.main-nav-list a {
	display: inline-block;
	padding: 10px 14px;
	border-radius: 999px;
	text-decoration: none;
	color: var(--color-text);
	font-weight: 500;
	min-height: 44px;
	line-height: 1.5;
}
.main-nav-list a:hover { background: var(--color-primary); color: #fff; }

.font-size-switcher {
	display: inline-flex; gap: 4px; align-items: center;
	background: #fff; border: 1px solid var(--color-border); border-radius: 999px;
	padding: 4px;
}
.font-size-switcher button {
	border: 0; background: transparent; padding: 6px 10px; border-radius: 999px;
	color: var(--color-text-sub); font-weight: 600; min-height: 36px;
}
.font-size-switcher button[aria-pressed="true"] {
	background: var(--color-primary); color: #fff;
}
.font-size-switcher .label { font-size: 13px; color: var(--color-text-sub); padding: 0 4px; }

.menu-toggle {
	display: none;
	border: 1px solid var(--color-border); background: #fff; border-radius: 999px;
	padding: 8px 14px; font-weight: 600; min-height: 44px; min-width: 44px;
}

@media (max-width: 720px) {
	.menu-toggle { display: inline-flex; align-items: center; gap: 6px; }
	.main-nav-list {
		display: none;
		position: absolute; left: 0; right: 0; top: 100%;
		background: #fff; border-bottom: 1px solid var(--color-border);
		padding: 12px 16px; flex-direction: column; align-items: stretch;
	}
	.main-nav[aria-expanded="true"] .main-nav-list { display: flex; }
}

/* ---------- Breadcrumb ---------- */
.breadcrumbs { font-size: 14px; color: var(--color-text-sub); margin: 0 0 16px; }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs li + li::before { content: "›"; margin-right: 6px; color: #b0a88f; }
.breadcrumbs a { color: var(--color-text-sub); text-decoration: none; }
.breadcrumbs a:hover { color: var(--color-primary); text-decoration: underline; }
.breadcrumbs [aria-current="page"] { color: var(--color-text); font-weight: 600; }

/* ---------- Article ---------- */
.entry {
	background: var(--color-surface);
	border-radius: var(--radius);
	padding: 36px clamp(20px, 4vw, 44px);
	box-shadow: var(--shadow);
}
.entry-header { margin-bottom: 24px; }
.entry-eyecatch { margin: 0 0 24px; }
.entry-eyecatch img { border-radius: var(--radius-sm); width: 100%; height: auto; }

.entry-category {
	display: inline-block;
	padding: 4px 12px;
	background: var(--color-primary);
	color: #fff;
	border-radius: 999px;
	font-size: 13px;
	text-decoration: none;
}
.entry-category:hover { background: var(--color-link-hover); color: #fff; }

.reading-time { display: inline-flex; align-items: center; gap: 6px; }
.reading-time .icon { font-size: 16px; }

.entry-content {
	font-size: var(--font-base);
	line-height: var(--line-base);
}
.entry-content > * { max-width: var(--content-w); margin-left: auto; margin-right: auto; }
.entry-content > .wp-block-image, .entry-content > figure { max-width: 100%; }

.entry-content h2 {
	font-size: 1.5em; line-height: 1.5;
	margin: 2.2em 0 1em;
	padding: 12px 16px 12px 20px;
	border-left: 6px solid var(--color-primary);
	background: #f2ede2;
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.entry-content h3 {
	font-size: 1.25em; line-height: 1.55;
	margin: 1.8em 0 .8em;
	padding-bottom: 6px;
	border-bottom: 2px dotted var(--color-accent);
}
.entry-content h4 { font-size: 1.1em; margin: 1.6em 0 .6em; color: var(--color-primary); }
.entry-content p { margin: 0 0 1.2em; }
.entry-content ul, .entry-content ol { padding-left: 1.6em; margin: 0 0 1.4em; }
.entry-content li { margin: .4em 0; }
.entry-content ul li::marker { color: var(--color-accent); }

.entry-content a {
	color: var(--color-link);
	font-weight: 500;
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}
.entry-content a:hover { background: #fff5da; }

.entry-content blockquote {
	margin: 1.5em 0;
	padding: 16px 20px;
	background: #f7f3e8;
	border-left: 4px solid var(--color-accent);
	border-radius: var(--radius-sm);
	color: var(--color-text-sub);
}

.entry-content table {
	width: 100%;
	border-collapse: collapse;
	margin: 1.5em 0;
	font-size: .95em;
}
.entry-content th, .entry-content td {
	border: 1px solid var(--color-border);
	padding: 10px 12px;
	text-align: left;
}
.entry-content th { background: #f2ede2; font-weight: 700; }
.entry-content tr:nth-child(even) td { background: #fbf8f1; }

.entry-content code {
	background: #f3efe4;
	padding: 2px 6px;
	border-radius: 4px;
	font-size: .92em;
}
.entry-content pre {
	background: #2a2a2a; color: #f5f3ec;
	padding: 16px 20px; border-radius: var(--radius-sm);
	overflow-x: auto;
}
.entry-content pre code { background: transparent; color: inherit; padding: 0; }

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

/* ---------- TOC ---------- */
.toc {
	background: #fbf8f1;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	padding: 18px 22px;
	margin: 28px 0 32px;
	max-width: var(--content-w);
}
.toc-title {
	margin: 0 0 10px;
	font-size: 18px;
	color: var(--color-primary);
	padding: 0;
	background: none;
	border: 0;
	border-radius: 0;
	line-height: 1.4;
}
.entry-content .toc { background: #fbf8f1; }
.entry-content .toc .toc-title { background: none; }
.toc-list { list-style: none; padding: 0; margin: 0; counter-reset: toc; }
.toc-list li { padding: 4px 0; }
.toc-list .toc-l2 { counter-increment: toc; }
.toc-list .toc-l2::before {
	content: counter(toc) ". ";
	color: var(--color-primary); font-weight: 700;
}
.toc-list .toc-l3 { padding-left: 24px; font-size: .95em; color: var(--color-text-sub); }
.toc-list a { color: var(--color-text); text-decoration: none; }
.toc-list a:hover { color: var(--color-primary); text-decoration: underline; }

/* ---------- Shortcodes (FAQ / Step / Boxes) ---------- */
.faq { margin: 0 0 12px; padding: 0; }
.faq:first-of-type { margin-top: 1.6em; }
.faq:last-of-type { margin-bottom: 1.6em; }
.faq br { display: none; }
.faq-item { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 16px 20px; margin: 0; }
.faq-q { font-weight: 700; display: flex; gap: 10px; align-items: flex-start; margin: 0 0 8px; font-size: 1.05em; line-height: 1.55; }
.faq-a { margin: 0 0 0 38px; color: var(--color-text); display: flex; gap: 10px; align-items: flex-start; line-height: 1.8; }
.faq-a > p { margin: 0; }
.faq-a p { margin: 0 0 .4em; }
.faq-a p:last-child { margin-bottom: 0; }
.faq-badge {
	display: inline-flex; align-items: center; justify-content: center;
	width: 28px; height: 28px; border-radius: 50%;
	background: var(--color-primary); color: #fff; font-weight: 700; font-size: 14px;
	flex: 0 0 auto; line-height: 1;
}
.faq-badge-a { background: var(--color-accent); }

.step-group { display: flex; flex-direction: column; gap: 14px; margin: 1.5em 0; }
.step-group br { display: none; }
.step { display: flex; gap: 16px; background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 18px 20px; align-items: flex-start; }
.step-num {
	flex: 0 0 48px;
	width: 48px; height: 48px;
	background: var(--color-primary); color: #fff;
	border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	font-weight: 700; font-size: 20px;
}
.step-body { flex: 1 1 auto; min-width: 0; }
.entry-content .step-title, .step-title {
	margin: 0 0 6px;
	font-size: 1.1em;
	line-height: 1.55;
	color: var(--color-primary);
	border: 0;
	padding: 0;
	background: none;
	border-radius: 0;
}
.step-text { color: var(--color-text); }
.step-text p { margin: 0 0 .6em; }
.step-text p:last-child { margin-bottom: 0; }

.box { margin: 1.5em 0; padding: 16px 20px 16px 54px; border-radius: var(--radius-sm); position: relative; }
.box-title { display: block; font-weight: 700; margin-bottom: 4px; }
.box::before {
	content: ""; position: absolute; left: 16px; top: 18px;
	width: 28px; height: 28px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	font-weight: 700; color: #fff;
}
.box-caution { background: #fef3e8; border: 1px solid #f6c79a; }
.box-caution::before { content: "!"; background: #d97706; color: #fff; font-size: 18px; line-height: 28px; text-align: center; }
.box-point { background: #e6f5f1; border: 1px solid #9bd1c4; }
.box-point::before { content: "✓"; background: var(--color-primary); font-size: 16px; line-height: 28px; text-align: center; }
.box-memo { background: #f0f4fa; border: 1px solid #b9c9e1; }
.box-memo::before { content: "i"; background: #4a6fa5; font-size: 16px; line-height: 28px; text-align: center; font-style: italic; }

/* ---------- Ad ---------- */
.ad-wrap {
	margin: 2em auto;
	max-width: var(--content-w);
	text-align: center;
}
.ad-label {
	display: block;
	font-size: 12px;
	color: var(--color-text-sub);
	margin-bottom: 4px;
	text-align: right;
}

/* ---------- Card Grid (archive/related) ---------- */
.card-grid {
	list-style: none; padding: 0; margin: 0;
	display: grid; gap: 20px;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card {
	background: var(--color-surface);
	border-radius: var(--radius);
	overflow: hidden;
	box-shadow: var(--shadow);
	transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-strong); }
.card a { display: block; color: var(--color-text); text-decoration: none; }
.card-thumb {
	width: 100%; aspect-ratio: 3/2; object-fit: cover;
	background: linear-gradient(135deg, #f2ede2, #e6f5f1);
}
.card-thumb-placeholder {
	display: flex; align-items: center; justify-content: center;
	color: var(--color-primary); font-weight: 700;
}
.card-link { display: block; }
.card-body { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.card-category {
	align-self: flex-start;
	font-size: 12px; padding: 3px 10px;
}
.card-title {
	margin: 0;
	font-size: 17px; font-weight: 700; line-height: 1.55;
	color: var(--color-text);
	display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
	overflow: hidden;
}
.card:hover .card-title { color: var(--color-primary); }
.card-meta {
	display: flex; gap: 10px; align-items: center;
	font-size: 13px; color: var(--color-text-sub);
	margin-top: auto;
}

/* ---------- Entry tags ---------- */
.entry-tags { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px; }
.entry-tag {
	display: inline-block;
	padding: 6px 14px;
	background: #f2ede2;
	border-radius: 999px;
	color: var(--color-text);
	text-decoration: none;
	font-size: 14px;
	line-height: 1.4;
	transition: background .15s ease, color .15s ease;
}
.entry-tag:hover { background: var(--color-primary); color: #fff; }

/* ---------- Related posts ---------- */
.related-posts { margin: 40px 0 0; }
.section-title {
	font-size: 22px; margin: 0 0 20px;
	border-left: 6px solid var(--color-accent);
	padding-left: 14px;
}

/* ---------- Sidebar ---------- */
.sidebar { display: flex; flex-direction: column; gap: 24px; align-self: start; position: sticky; top: 90px; }
@media (max-width: 960px) {
	.sidebar { position: static; top: auto; }
}
.widget {
	background: var(--color-surface);
	border-radius: var(--radius);
	padding: 22px 22px 20px;
	box-shadow: var(--shadow);
}
.widget:empty { display: none; }
.widget-title {
	font-size: 17px; margin: 0 0 14px;
	color: var(--color-primary);
	padding: 0 0 10px 0;
	border-bottom: 2px solid var(--color-border);
	background: none;
	border-radius: 0;
}
.widget ul { list-style: none; padding: 0; margin: 0; }
.widget li { padding: 8px 0; }
.widget li + li { padding-top: 10px; border-top: 1px dashed var(--color-border); margin-top: 0; }
.widget a { color: var(--color-text); text-decoration: none; display: block; min-height: 40px; line-height: 1.5; }
.widget a:hover { color: var(--color-primary); }
.widget-search .widget-title { margin-bottom: 10px; }

.searchform { display: flex; gap: 6px; }
.searchform input[type="search"] {
	flex: 1; padding: 12px 14px; border: 1px solid var(--color-border); border-radius: 999px;
	min-height: 44px;
}
.searchform button {
	padding: 10px 18px; border: 0; border-radius: 999px;
	background: var(--color-primary); color: #fff; font-weight: 600; min-height: 44px;
}

/* ---------- Front Page ---------- */
.hero {
	background: linear-gradient(135deg, #e6f5f1 0%, #fef3e8 100%);
	border-radius: var(--radius);
	padding: clamp(36px, 6vw, 64px) clamp(24px, 5vw, 56px);
	margin: 0 0 32px;
	text-align: center;
	box-shadow: var(--shadow);
}
.hero-title { margin: 0 0 14px; font-size: clamp(26px, 4vw, 36px); line-height: 1.35; letter-spacing: .02em; }
.hero-lead { margin: 0; color: var(--color-text); font-size: clamp(16px, 2.2vw, 18px); line-height: 1.7; }

.front-section { margin: 40px 0; }
.front-section:first-of-type { margin-top: 0; }
.category-list {
	list-style: none; padding: 0; margin: 0;
	display: grid; gap: 14px;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.category-list a {
	padding: 16px 20px;
	background: #fff; border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	text-decoration: none; color: var(--color-text);
	font-weight: 700; min-height: 64px;
	display: flex; align-items: center; gap: 10px;
	transition: transform .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
}
.category-list a:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); transform: translateY(-1px); }
.category-list a::before {
	content: "▶"; color: var(--color-accent); font-size: 11px; flex: 0 0 auto;
}
.category-list a:hover::before { color: #fff; }

/* ---------- Archive header ---------- */
.archive-header { margin-bottom: 28px; }
.archive-header .page-title {
	font-size: clamp(22px, 3vw, 28px);
	margin: 0 0 10px;
	padding-left: 14px;
	border-left: 6px solid var(--color-primary);
	line-height: 1.35;
}
.archive-description { color: var(--color-text-sub); font-size: 15px; line-height: 1.8; }

/* ---------- Pagination ---------- */
.pagination {
	display: flex; justify-content: center; gap: 6px; flex-wrap: wrap;
	margin: 40px 0 0;
}
.pagination .page-numbers {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 44px; min-height: 44px; padding: 0 14px;
	border-radius: 8px; background: #fff; border: 1px solid var(--color-border);
	color: var(--color-text); text-decoration: none; font-weight: 600;
}
.pagination .page-numbers.current, .pagination .page-numbers:hover {
	background: var(--color-primary); color: #fff; border-color: var(--color-primary);
}

/* ---------- Footer ---------- */
.site-footer {
	background: #2a2a2a; color: #f5f3ec;
	padding: 40px 0 20px;
	margin-top: 60px;
}
.site-footer a { color: #f5f3ec; }
.site-footer .widget-title { color: var(--color-accent); border-bottom-color: rgba(255,255,255,.15); }
.footer-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }
.footer-widgets { display: grid; gap: 30px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 30px; }
.footer-widgets .widget { background: transparent; padding: 0; box-shadow: none; }
.footer-widgets .widget li { border-top-color: rgba(255,255,255,.15); }
.site-footer-bottom { border-top: 1px solid rgba(255,255,255,.15); padding-top: 18px; text-align: center; font-size: 14px; opacity: .9; }
.site-footer-bottom p { margin: 0 0 6px; }
.site-footer-bottom p:last-child { margin-bottom: 0; opacity: .75; font-size: 13px; }
.site-footer-tagline { font-size: 15px; color: var(--color-accent); }
.footer-nav { list-style: none; margin: 0 0 18px; padding: 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 20px; }
.footer-nav li { padding: 0; border: 0; margin: 0; }
.footer-nav a { color: #f5f3ec; text-decoration: none; padding: 6px 4px; display: inline-block; }
.footer-nav a:hover { text-decoration: underline; color: var(--color-accent); }

/* ---------- 404 / Search ---------- */
.notfound, .search-noresult {
	background: #fff; padding: 60px 24px; border-radius: var(--radius);
	text-align: center;
}
.notfound h1, .search-noresult h1 { margin: 0 0 12px; }

/* ---------- Dark mode ---------- */
@media (prefers-color-scheme: dark) {
	:root {
		--color-bg: #14120d;
		--color-surface: #1f1c16;
		--color-text: #f1ecde;
		--color-text-sub: #b8b09b;
		--color-border: #3a3529;
		--color-link: #7dd3bf;
		--color-link-hover: #a8e5d4;
	}
	.site-header { background: rgba(20,18,13,.95); }
	.entry-content h2 { background: #2a2419; }
	.entry-content blockquote { background: #2a2419; }
	.toc { background: #1f1c16; }
	.site-footer { background: #0a0907; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
	html { scroll-behavior: auto; }
}
