/* =========================================================
   nyaaalog — main stylesheet
   トークンは theme.json（--wp--preset--color--*, --wp--custom--*）を参照
   ========================================================= */

/* ---------- Base ---------- */
:root {
	--ny-base: var(--wp--preset--color--base, #fff);
	--ny-cream: var(--wp--preset--color--cream, #fff3e0);
	--ny-cream-deep: var(--wp--preset--color--cream-deep, #ffd699);
	--ny-accent: var(--wp--preset--color--accent, #ff9900);
	--ny-accent-dark: var(--wp--preset--color--accent-dark, #a35f00);
	--ny-ink: var(--wp--preset--color--ink, #000);
	--ny-text: var(--wp--preset--color--text, #333);
	--ny-text-sub: var(--wp--preset--color--text-sub, #6b6b6b);
	--ny-border: var(--wp--preset--color--border, #e5e5e5);
	--ny-r-s: var(--wp--custom--radius--s, 4px);
	--ny-r-m: var(--wp--custom--radius--m, 6px);
	--ny-r-l: var(--wp--custom--radius--l, 10px);
	--ny-r-pill: var(--wp--custom--radius--pill, 999px);
	--ny-shadow: var(--wp--custom--shadow--card, 6px 6px 0 #000);
	--ny-content: 720px;
	--ny-wide: 1120px;
	--ny-gutter: 20px;
	--ny-font: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }

body {
	margin: 0;
	background: var(--ny-base);
	color: var(--ny-text);
	font-family: var(--ny-font);
	font-size: 16px;
	line-height: 1.9;
	letter-spacing: .02em;
	overflow-wrap: anywhere;
	-webkit-font-smoothing: antialiased;
}
@media (min-width: 768px) { body { font-size: 17px; } }

img, svg, video { max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: .2em; }
a:hover { color: var(--ny-accent-dark); }
:focus-visible { outline: 3px solid var(--ny-ink); box-shadow: 0 0 0 6px var(--ny-accent); outline-offset: 2px; border-radius: 4px; }

.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 1000; padding: 8px 16px; background: var(--ny-text); color: #fff; border-radius: var(--ny-r-s); }
.skip-link:focus { top: 8px; color: #fff; }

.container { width: 100%; max-width: calc(var(--ny-wide) + var(--ny-gutter) * 2); margin-inline: auto; padding-inline: var(--ny-gutter); }
.container--narrow { max-width: calc(var(--ny-content) + var(--ny-gutter) * 2); }

/* ---------- Header ---------- */
.site-header {
	position: sticky; top: 0; z-index: 100;
	background: #fff;
	border-bottom: 3px solid var(--ny-ink);
}
.admin-bar .site-header { top: var(--wp-admin--admin-bar--height, 0); }
.site-header__inner {
	display: flex; align-items: center; gap: 16px;
	max-width: calc(var(--ny-wide) + var(--ny-gutter) * 2); margin-inline: auto;
	padding: 12px var(--ny-gutter); min-height: 60px;
}
.site-logo { display: inline-flex; align-items: center; text-decoration: none; line-height: 0; }
.site-logo .logo { width: 150px; height: auto; }

.menu-toggle {
	margin-left: auto; display: inline-grid; place-items: center;
	width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--ny-r-s);
	background: var(--ny-accent); cursor: pointer; color: var(--ny-ink);
}
.menu-toggle__bar, .menu-toggle__bar::before, .menu-toggle__bar::after {
	display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor; transition: transform .2s, opacity .2s;
}
.menu-toggle__bar { position: relative; }
.menu-toggle__bar::before, .menu-toggle__bar::after { content: ""; position: absolute; left: 0; }
.menu-toggle__bar::before { top: -6px; }
.menu-toggle__bar::after { top: 6px; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar { background: transparent; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar::before { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar::after { transform: translateY(-6px) rotate(-45deg); }

.site-nav__list { list-style: none; margin: 0; padding: 0; }
.site-nav__list a { display: block; text-decoration: none; font-weight: 900; font-size: .9375rem; color: var(--ny-ink); }
.site-search input {
	width: 100%; padding: 10px 16px; border: 2px solid var(--ny-ink); border-radius: var(--ny-r-s);
	background: #fff; font: inherit; font-size: .9375rem; color: var(--ny-text);
}
.site-search input:focus { outline: none; box-shadow: 0 0 0 4px var(--ny-accent); }

@media (max-width: 767px) {
	.site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; padding: 8px var(--ny-gutter) 24px; background: #fff; border-bottom: 1px solid var(--ny-border); box-shadow: 0 12px 24px rgba(51, 51, 51, .08); }
	.site-nav.is-open { display: block; }
	.site-nav__list a { padding: 14px 4px; border-bottom: 1px solid var(--ny-border); }
	.site-search { margin-top: 16px; }
}
@media (min-width: 768px) {
	.menu-toggle { display: none; }
	.site-nav { margin-left: auto; display: flex; align-items: center; gap: 24px; }
	.site-nav__list { display: flex; gap: 24px; }
	.site-nav__list a { padding: 6px 0; border-bottom: 4px solid transparent; }
	.site-nav__list a:hover, .site-nav__list .current-menu-item > a { color: var(--ny-ink); border-bottom-color: var(--ny-accent); }
	.site-search input { width: 200px; }
}

/* ---------- Footer ---------- */
.site-footer { margin-top: 96px; background: var(--ny-ink); color: #fff; border-top: 10px solid var(--ny-accent); }
.site-footer .logo text { fill: #fff; }
.site-footer__inner { max-width: calc(var(--ny-wide) + var(--ny-gutter) * 2); margin-inline: auto; padding: 48px var(--ny-gutter) 32px; text-align: center; }
.site-footer__copy { margin: 16px 0 28px; font-weight: 900; font-size: clamp(1.125rem, 3.6vw, 1.5rem); line-height: 1.5; }
.footer-nav__list { list-style: none; margin: 0 0 24px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; font-size: .875rem; }
.footer-nav__list a { text-decoration: none; color: #fff; font-weight: 700; }
.footer-nav__list a:hover { color: var(--ny-accent); }
.site-footer__copyright { margin: 0; color: #bdbdbd; font-size: .8125rem; }

/* ---------- Buttons ---------- */
.button, .wp-block-button__link, .wp-element-button {
	display: inline-flex; align-items: center; justify-content: center; gap: .5em;
	min-height: 48px; padding: 12px 28px; border: 2px solid var(--ny-ink); border-radius: var(--ny-r-s);
	background: var(--ny-accent); color: var(--ny-ink); font: inherit; font-weight: 900; line-height: 1.4;
	text-decoration: none; cursor: pointer; box-shadow: 4px 4px 0 var(--ny-ink);
	transition: transform .15s, box-shadow .15s;
}
.button:hover, .wp-block-button__link:hover { color: var(--ny-ink); transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ny-ink); }

/* ---------- Layout / sections ---------- */
.site-main { display: block; padding-top: 24px; }
.section { padding-block: 48px; }
@media (min-width: 768px) { .section { padding-block: 72px; } }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.section__title { position: relative; margin: 0 0 32px; padding-bottom: 18px; color: var(--ny-ink); font-size: clamp(1.875rem, 7vw, 3rem); font-weight: 900; line-height: 1.15; letter-spacing: -.01em; }
.section__title::after { content: ""; position: absolute; left: 0; bottom: 0; width: 72px; height: 8px; background: var(--ny-accent); }
.section__more { flex-shrink: 0; padding: 4px 0; border-bottom: 3px solid var(--ny-accent); font-size: .9375rem; font-weight: 900; text-decoration: none; color: var(--ny-ink); }

/* ---------- Hero ---------- */
.site-main:has(> .hero) { padding-top: 0; }
.hero { position: relative; background: var(--ny-accent); color: var(--ny-ink); clip-path: polygon(0 0, 100% 0, 100% calc(100% - 7vw), 0 100%); }
.hero__inner { position: relative; padding-block: 48px calc(64px + 7vw); }
.hero__eyebrow { display: inline-block; margin: 0 0 20px; padding: 4px 12px; background: var(--ny-ink); color: #fff; font-size: .875rem; font-weight: 700; }
.hero__title { margin: 0 0 24px; font-size: clamp(2rem, 8.6vw, 5.5rem); font-weight: 900; line-height: 1.12; letter-spacing: -.02em; }
.hero__lead { margin: 0; max-width: 32em; color: var(--ny-ink); font-weight: 700; }
@media (min-width: 768px) { .hero__inner { padding-block: 96px calc(88px + 7vw); } }

/* ---------- Cards ---------- */
.card-grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
.container--narrow .card-grid { grid-template-columns: 1fr; }
@media (min-width: 600px) { .container--narrow .card-grid { grid-template-columns: repeat(2, 1fr); } }
.card { min-width: 0; }
.card__link { display: flex; flex-direction: column; height: 100%; background: #fff; border: 2px solid var(--ny-ink); border-radius: var(--ny-r-s); overflow: hidden; text-decoration: none; transition: box-shadow .15s, transform .15s; }
.card__link:hover { color: var(--ny-ink); box-shadow: 6px 6px 0 var(--ny-accent); transform: translate(-3px, -3px); }
@media (prefers-reduced-motion: reduce) { .card__link, .button, .wp-block-button__link { transition: none; } }
.card__thumb { aspect-ratio: 40 / 21; background: var(--ny-accent); border-bottom: 2px solid var(--ny-ink); overflow: hidden; }
.card__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card__thumb--placeholder { display: grid; place-items: center; }
.card__thumb--placeholder .logo { width: 50%; }
.card__thumb--placeholder .logo path, .card__thumb--placeholder .logo rect { fill: #fff; }
.card__body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; flex: 1; }
.card__title { margin: 0; color: var(--ny-ink); font-size: 1.0625rem; font-weight: 900; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card__meta { margin: auto 0 0; color: var(--ny-text-sub); font-size: .8125rem; }
.cat-label { align-self: flex-start; display: inline-block; padding: 1px 10px; border-radius: 0; background: var(--ny-ink); color: #fff; font-size: .75rem; font-weight: 700; line-height: 1.8; text-decoration: none; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs ol { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: .8125rem; color: var(--ny-text-sub); }
.breadcrumbs li:not(:last-child)::after { content: "›"; margin-left: 4px; }
.breadcrumbs a { color: inherit; text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs [aria-current] { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Archive / empty ---------- */
.archive-header { margin-bottom: 40px; padding: 32px 24px; border: 2px solid var(--ny-ink); background: var(--ny-accent); color: var(--ny-ink); }
.archive-header__label { margin: 0; font-size: .875rem; font-weight: 700; }
.archive-header__title { margin: 4px 0 0; font-size: clamp(1.75rem, 6vw, 2.5rem); font-weight: 900; line-height: 1.25; }
.archive-header__desc p { margin: 8px 0 0; font-size: .9375rem; }
.empty-state { padding: 40px 0; text-align: center; }
.empty-state__code { margin: 0; font-size: clamp(5rem, 22vw, 9rem); font-weight: 900; line-height: 1; color: var(--ny-ink); text-shadow: 6px 6px 0 var(--ny-accent); }
.empty-state__title { font-size: 1.5rem; }
.search-form { display: flex; gap: 8px; max-width: 480px; margin: 24px auto; }
.search-form__input { flex: 1; min-width: 0; padding: 10px 16px; border: 2px solid var(--ny-ink); border-radius: var(--ny-r-s); font: inherit; background: #fff; }
.search-form__submit { min-height: 44px; padding-inline: 20px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 40px; }
.pagination .page-numbers { display: grid; place-items: center; min-width: 44px; height: 44px; padding: 0 12px; border-radius: var(--ny-r-s); border: 2px solid var(--ny-ink); text-decoration: none; font-weight: 900; }
.pagination .page-numbers.current { background: var(--ny-accent); border-color: var(--ny-accent); }

/* ---------- Entry ---------- */
.entry-header { margin-bottom: 24px; }
.entry-title { margin: 12px 0; color: var(--ny-ink); font-size: 1.75rem; font-weight: 900; line-height: 1.35; letter-spacing: -.005em; }
@media (min-width: 768px) { .entry-title { font-size: 2.375rem; } }
.entry-meta { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; color: var(--ny-text-sub); font-size: .8125rem; }
.entry-date time::before { content: "公開 "; }
.entry-date--updated time::before { content: "更新 "; }
.entry-thumbnail { margin: 0 0 32px; }
.entry-thumbnail img { display: block; width: 100%; border-radius: var(--ny-r-m); }

.entry-content > * { margin-block: 0 1.9em; }
.entry-content p { line-height: 1.9; }
.entry-content h2 { margin: 2.8em 0 1.2em; padding: 16px 20px; background: var(--ny-ink); color: #fff; border-left: 10px solid var(--ny-accent); font-size: 1.375rem; font-weight: 900; line-height: 1.5; }
.entry-content h3 { margin: 2.2em 0 1em; padding-bottom: 8px; border-bottom: 3px solid var(--ny-ink); color: var(--ny-ink); font-size: 1.1875rem; font-weight: 900; line-height: 1.55; position: relative; }
.entry-content h3::after { content: ""; position: absolute; left: 0; bottom: -3px; width: 72px; height: 3px; background: var(--ny-accent); }
.entry-content h4 { margin: 2em 0 .8em; font-size: 1.0625rem; }
.entry-content a { color: var(--ny-ink); text-decoration-color: var(--ny-accent); text-decoration-thickness: 3px; }
.entry-content a:hover { color: var(--ny-accent-dark); }
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content li + li { margin-top: .4em; }
.entry-content li::marker { color: var(--ny-accent-dark); }
.entry-content img { border-radius: var(--ny-r-m); }
.entry-content figure { margin-inline: 0; }
.entry-content figcaption { color: var(--ny-text-sub); font-size: .8125rem; text-align: center; }
.entry-content blockquote { margin-inline: 0; padding: 16px 20px; border-left: 6px solid var(--ny-ink); background: #f5f5f5; border-radius: 0 var(--ny-r-m) var(--ny-r-m) 0; }
.entry-content strong { background: linear-gradient(transparent 62%, var(--ny-cream-deep) 62%); }
.entry-content hr { border: 0; border-top: 1px dashed var(--ny-border); }
.entry-content pre, .entry-content code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .875em; }
.entry-content pre { padding: 16px; border-radius: var(--ny-r-m); background: #2b2b2b; color: #f5f5f5; overflow-x: auto; }
.entry-content :not(pre) > code { padding: .1em .4em; border-radius: 4px; background: var(--ny-cream); }
.entry-content .wp-block-table { overflow-x: auto; }
.entry-content table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.entry-content th, .entry-content td { padding: 10px 12px; border: 1px solid var(--ny-border); }
.entry-content thead th, .entry-content th { background: var(--ny-ink); color: #fff; }
.entry-content iframe, .entry-content video { max-width: 100%; }

/* スマホの表：画面の幅に押し込まず、横にスクロールして読む。1列目（項目名）は左に固定する */
.table-scroll-hint { display: none; }
@media (max-width: 767px) {
  .entry-content .wp-block-table { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .entry-content .wp-block-table table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; line-height: 1.6; }
  .entry-content .wp-block-table th, .entry-content .wp-block-table td { min-width: 8em; max-width: 15em; padding: 8px 10px; border-width: 0 1px 1px 0; vertical-align: top; }
  .entry-content .wp-block-table tr > :first-child { position: sticky; left: 0; z-index: 1; min-width: 5.5em; max-width: 7.5em; border-left-width: 1px; font-weight: 700; }
  .entry-content .wp-block-table td:first-child { background: var(--ny-cream); }
  .entry-content .wp-block-table table > :first-child > tr:first-child > * { border-top-width: 1px; }
  .entry-content .table-scroll-hint.is-visible { display: block; margin: 0 0 .4em; color: var(--ny-text-sub); font-size: .75rem; text-align: right; }
}

/* TOC */
.nyaaalog-toc { margin: 0 0 2.4em; border: 2px solid var(--ny-ink); border-radius: var(--ny-r-s); background: #fff; }
.nyaaalog-toc summary { padding: 12px 20px; background: var(--ny-accent); color: var(--ny-ink); font-weight: 900; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.nyaaalog-toc summary::-webkit-details-marker { display: none; }
.nyaaalog-toc summary::after { content: "閉じる"; font-size: .8125rem; color: var(--ny-ink); font-weight: 700; }
.nyaaalog-toc details:not([open]) summary::after { content: "開く"; }
.nyaaalog-toc .nyaaalog-toc__list { margin: 0; padding: 14px 20px 18px 44px; font-size: .9375rem; line-height: 1.7; }
.nyaaalog-toc .nyaaalog-toc__list ol { padding-left: 1.4em; font-size: .875rem; list-style: disc; }
@media (min-width: 768px) { .nyaaalog-toc .nyaaalog-toc__list { padding: 16px 28px 20px 52px; } }
.nyaaalog-toc li { margin-top: .5em; }
.nyaaalog-toc a { text-decoration: none; }
.nyaaalog-toc a:hover { text-decoration: underline; }

/* Author / related / profile CTA */
.entry-footer { margin-top: 48px; }
.author-box { display: flex; gap: 16px; padding: 20px; border: 2px solid var(--ny-ink); border-radius: var(--ny-r-s); background: var(--ny-cream); }
.author-box__avatar img { border-radius: 50%; display: block; }
.author-box__label { margin: 0; font-size: .75rem; color: var(--ny-text-sub); font-weight: 700; }
.author-box__name { margin: 0; font-weight: 700; }
.author-box__bio { margin: 6px 0 0; font-size: .875rem; line-height: 1.8; }
.author-box__more { display: inline-block; margin-top: 6px; font-size: .875rem; font-weight: 700; }
.related-posts { margin-top: 56px; }
.profile-cta { padding: 40px 24px; border: 2px solid var(--ny-ink); border-radius: var(--ny-r-s); background: var(--ny-cream); text-align: center; }
.profile-cta__title { margin: 0 0 8px; color: var(--ny-ink); font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 900; line-height: 1.3; }
