/*
Theme Name: 知識のパレット
Description: 知識のパレット（infopalatte.net）のテーマ。用語辞典「知識の羅針盤」（/dictionary/）と兄弟の見た目にする。色・寸法の値は辞書サイトの static/tokens.css を読む。
Author: 知識のパレット 運営者
Version: 1.0.0
Requires at least: 7.0
Requires PHP: 8.3
Text Domain: infopalatte
*/

/*
 * 色・寸法の値（--color-text など）は辞書サイトの tokens.css が正（inc/setup.php が head に差し込む）。
 * ここでは var(--名前, 既定値) で使い、tokens.css が読めないときもライトの配色で表示が崩れないようにする。
 * 部品の名前と見た目は辞書サイト（dictionary-v2 の static/style.css）に合わせる。辞書側の部品を変えたら、
 * 同じ名前の部品をここでも見直す（.site-header・.search・.breadcrumb・.blog-card・.class-card・.tag・.pager・.ad-slot・.toc）。
 * モバイル優先（min-width で広げる）。
 */

/* ===== 基本 ===== */

/* このテーマだけの寸法（辞書サイトの tokens.css には無い）。本文の幅 50em（800px）は Cocoon の本文の幅（799px）と同じくらいで、
   本文の上・下の広告（PC 用は幅 728px）が左右に約36pxの余裕で入る（2026-10-21 運営者決定）。全体の最大幅は、
   サイドバー（18rem）を並べても本文の面がこの幅を取れるように 80rem にする */
:root {
  --layout-max: 80rem;
  --entry-measure: 50em;
}

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

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

body {
  margin: 0;
  color: var(--color-text, #1f2328);
  background: var(--color-page, #f5f4f0);
  font-family: var(--font-body, sans-serif);
  font-size: var(--font-size-base, 1rem);
  line-height: var(--line-height, 1.85);
  overflow-wrap: anywhere;
}

a {
  color: var(--color-link, #0b5cad);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--color-accent-strong, #6b2c0c);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--color-accent, #8a3b12);
  outline-offset: 2px;
}

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

.visually-hidden,
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -999px;
}

.skip-link:focus {
  left: var(--space, 1rem);
  top: var(--space, 1rem);
  z-index: 10;
  background: var(--color-bg, #fff);
  padding: 0.5rem;
}

/* ===== ヘッダー（辞書サイトと同じ） ===== */
.site-header {
  background: var(--color-bg, #fff);
  border-top: 3px solid var(--color-accent, #8a3b12);
  border-bottom: 1px solid var(--color-border-soft, #e4e2dc);
}

/* スマートフォンではロゴと兄弟サイトへのリンクを1行目、検索欄を2行目の全幅に置く */
.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  max-width: var(--layout-max, 80rem);
  margin: 0 auto;
  padding: 0.75rem var(--space, 1rem);
}

.site-logo {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--color-text, #1f2328);
}

.site-sister {
  margin-left: auto;
  font-size: 0.875rem;
  white-space: nowrap;
  text-decoration: none;
}

.site-sister__note {
  color: var(--color-muted, #59636e);
}

form.search { /* body にも WordPress が class="search" を付けるので form に絞る */
  position: relative;
  display: flex;
  order: 3;
  flex: 1 1 100%;
  gap: 0.5rem;
}

.search__input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text, #1f2328);
  background: var(--color-surface, #f6f8fa) no-repeat 0.75rem 50%;
  background-image: var(--icon-search, none);
  border: 1px solid var(--color-border, #d0d7de);
  border-radius: 999px;
}

.search__input:focus {
  background-color: var(--color-bg, #fff);
}

.search__submit {
  flex: 0 0 auto;
  padding: 0.5rem 0.9rem;
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--color-on-accent, #fff);
  background: var(--color-accent, #8a3b12);
  border: 1px solid var(--color-accent, #8a3b12);
  border-radius: var(--radius, 6px);
  cursor: pointer;
}

/* 入力中の候補（辞書サイトの検索欄と同じ） */
.search__results {
  position: absolute;
  z-index: 5;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 60vh;
  margin: 0.25rem 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  background: var(--color-bg, #fff);
  border: 1px solid var(--color-border, #d0d7de);
  border-radius: var(--radius, 6px);
  box-shadow: var(--shadow-raise, 0 4px 16px rgb(31 35 40 / 12%));
}

.search__results li + li {
  border-top: 1px solid var(--color-border-soft, #e4e2dc);
}

.search__results li a {
  display: block;
  padding: 0.5rem 0.75rem;
  line-height: 1.5;
  text-decoration: none;
}

.search__results li a:hover,
.search__results li a:focus-visible {
  background: var(--color-accent-soft, #f8eee6);
}

.search__reading {
  display: block;
  font-size: 0.75rem;
  color: var(--color-muted, #59636e);
}

.search__empty {
  padding: 0.5rem 0.75rem;
  color: var(--color-muted, #59636e);
}

.search__submit:hover {
  background: var(--color-accent-strong, #6b2c0c);
}

/* グローバルメニュー（スマートフォンでは横にスクロール） */
.site-nav {
  max-width: var(--layout-max, 80rem);
  margin: 0 auto;
  overflow-x: auto;
}

.site-nav__list {
  display: flex;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0 var(--space, 1rem) 0.5rem;
  list-style: none;
  font-size: 0.875rem;
  white-space: nowrap;
}

.site-nav__list a {
  display: block;
  padding: 0.25rem 0;
  color: var(--color-text, #1f2328);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.site-nav__list a:hover,
.site-nav__list .current-menu-item > a {
  color: var(--color-accent, #8a3b12);
  border-bottom-color: var(--color-accent, #8a3b12);
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  max-width: var(--layout-max, 80rem);
  margin: 0 auto;
  padding: 0.25rem var(--space, 1rem) 0.5rem;
  list-style: none;
  font-size: 0.875rem;
  color: var(--color-muted, #59636e);
}

.breadcrumb li + li::before {
  content: "›";
  margin-right: 0.25rem;
}

/* ===== 本文とサイドバーの並び ===== */
.site-layout {
  max-width: var(--layout-max, 80rem);
  margin: 0 auto;
  padding: var(--space, 1rem) var(--space, 1rem) 2.5rem;
}

.site-main {
  min-width: 0;
}

.site-sidebar {
  margin-top: 2rem;
}

/* ===== 記事・固定ページの白い面（辞書サイトの語のページ .term と同じ） ===== */
.entry,
.not-found {
  margin: 0 calc(var(--space, 1rem) * -1);
  padding: 1.25rem var(--space, 1rem);
  background: var(--color-bg, #fff);
  border-top: 1px solid var(--color-border-soft, #e4e2dc);
  border-bottom: 1px solid var(--color-border-soft, #e4e2dc);
}

.entry__title {
  margin: 0 0 0.5rem;
  font-size: 1.625rem;
  line-height: 1.45;
}

.entry__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0 0 1rem;
  font-size: 0.8125rem;
  color: var(--color-muted, #59636e);
}

.entry__thumbnail {
  margin: 0 0 1rem;
}

.entry__thumbnail img {
  display: block;
  width: 100%;
  border-radius: var(--radius, 6px);
}

.entry__terms {
  margin: 2rem 0 1rem;
}

/* AI で作成した記事の注記（辞書サイトの「作成：AIにより生成・検証」の欄と同じ見た目） */
.post-notice {
  margin: 0 0 1.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--color-muted, #59636e);
  background: var(--color-surface, #f6f8fa);
  border-radius: var(--radius, 6px);
}

.post-notice p {
  margin: 0;
}

/* ===== 本文の中身（ブロックエディタの標準ブロックを含む） ===== */
.entry__content > * {
  max-width: var(--entry-measure, 50em);
}

.entry__content > .alignwide,
.entry__content > .alignfull,
.entry__content > figure,
.entry__content > .wp-block-table,
.entry__content > .toc {
  max-width: none;
}

.entry__content p {
  margin: 0 0 1.25em;
}

.entry__content h2 {
  margin: 2.25rem 0 0.75rem;
  padding-left: 0.6rem;
  font-size: 1.25rem;
  line-height: 1.5;
  border-left: 4px solid var(--color-accent, #8a3b12);
  scroll-margin-top: 1rem;
}

.entry__content h3 {
  margin: 1.75rem 0 0.5rem;
  padding-bottom: 0.25rem;
  font-size: 1.125rem;
  line-height: 1.5;
  border-bottom: 1px solid var(--color-border-soft, #e4e2dc);
  scroll-margin-top: 1rem;
}

.entry__content h4 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1rem;
}

.entry__content ul,
.entry__content ol {
  padding-left: 1.5rem;
}

.entry__content li + li {
  margin-top: 0.25em;
}

.entry__content blockquote {
  margin: 1.5rem 0;
  padding: 0.5rem 1rem;
  color: var(--color-muted, #59636e);
  background: var(--color-surface, #f6f8fa);
  border-left: 4px solid var(--color-border, #d0d7de);
}

.entry__content figure {
  margin: 1.5rem 0;
}

/* 旧エディタの画像。[caption] には WordPress が style="width: 1024px" を付けるので、面の幅に収める（2026-10-21、
   スマートフォンでページが横に 1040px まで広がっていた） */
.entry__content .wp-caption {
  max-width: 100%;
}

/* 旧エディタの配置（class="aligncenter" など。Cocoon では Cocoon の CSS が持っていた）。
   左右の回り込みは画面の広いときだけ（狭い画面では中央に置く） */
.entry__content .aligncenter,
.entry__content .alignleft,
.entry__content .alignright {
  display: block;
  margin-right: auto;
  margin-left: auto;
}

.entry__content::after {
  display: table;
  clear: both;
  content: "";
}

.entry__content figcaption {
  font-size: 0.8125rem;
  color: var(--color-muted, #59636e);
}

.entry__content hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--color-border-soft, #e4e2dc);
}

.entry__content code,
.entry__content kbd {
  padding: 0.1em 0.35em;
  font-size: 0.875em;
  background: var(--color-surface, #f6f8fa);
  border-radius: 4px;
}

.entry__content pre {
  overflow-x: auto;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.6;
  background: var(--color-surface, #f6f8fa);
  border: 1px solid var(--color-border-soft, #e4e2dc);
  border-radius: var(--radius, 6px);
}

.entry__content pre code {
  padding: 0;
  background: none;
}

/* 表は横にスクロールさせ、ページの横のはみ出しを防ぐ */
.wp-block-table {
  overflow-x: auto;
}

.entry__content table {
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9375rem;
}

.entry__content th,
.entry__content td {
  padding: 0.35rem 0.6rem;
  vertical-align: top;
  border: 1px solid var(--color-border, #d0d7de);
}

.entry__content th {
  background: var(--color-surface, #f6f8fa);
}

/* ボタン（辞書サイトの「詳細解説を読む」と同じ） */
.wp-block-button__link,
.wp-element-button {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  line-height: 1.6;
  color: var(--color-on-accent, #fff);
  text-decoration: none;
  background: var(--color-accent, #8a3b12);
  border: 0;
  border-radius: var(--radius, 6px);
  box-shadow: var(--shadow-card, 0 1px 2px rgb(31 35 40 / 6%));
}

.wp-block-button__link:hover,
.wp-element-button:hover {
  color: var(--color-on-accent, #fff);
  background: var(--color-accent-strong, #6b2c0c);
}

/* 本文に入っている Cocoon の「白抜きボックス」（2か所） */
.blank-box {
  margin: 1.5rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border, #d0d7de);
  border-radius: var(--radius, 6px);
}

/* ===== 目次（辞書サイトの詳細ページの目次と同じ） ===== */
.toc {
  margin: 1.5rem 0;
  padding: 0.75rem 1rem;
  background: var(--color-bg, #fff);
  border: 1px solid var(--color-border-soft, #e4e2dc);
  border-radius: var(--radius-card, 10px);
}

.toc summary {
  font-weight: 700;
  cursor: pointer;
}

.toc ol {
  margin: 0.5rem 0 0;
  padding-left: 0;
  list-style: none;
  font-size: 0.9375rem;
  line-height: 1.6;
  counter-reset: toc;
}

.toc ol ol {
  margin: 0 0 0 1rem;
  font-size: 0.875rem;
}

.toc li {
  margin: 0;
}

.toc li a {
  display: block;
  padding: 0.3rem 0.5rem;
  color: var(--color-text, #1f2328);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.toc li a:hover {
  background: var(--color-surface, #f6f8fa);
  border-left-color: var(--color-accent, #8a3b12);
}

/* h2 の項目: 左に見出しへのリンク、右に h3 以下を開く・閉じるボタン（assets/theme.js が付ける）。開いた小見出しは下の行 */
.toc__list > .toc__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.toc__list > .toc__item > .toc__sub {
  grid-column: 1 / -1;
}

.toc__list > .toc__item + .toc__item {
  border-top: 1px solid var(--color-border-soft, #e4e2dc);
}

.toc__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin: 0;
  padding: 0;
  color: var(--color-muted, #59636e);
  background: none;
  border: 0;
  border-radius: var(--radius, 6px);
  cursor: pointer;
}

.toc__toggle:hover {
  color: var(--color-accent, #8a3b12);
  background: var(--color-surface, #f6f8fa);
}

/* 右向きの矢印。開いているときは下向き */
.toc__toggle::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid currentcolor;
  border-bottom: 2px solid currentcolor;
  transform: rotate(-45deg);
  transition: transform 0.15s;
}

.toc__toggle[aria-expanded="true"]::before {
  transform: rotate(45deg);
}

.toc__sub {
  margin: 0 0 0.25rem 1rem;
}

/* ===== SNS のシェア ===== */
.share {
  margin: 1rem 0;
}

.share__heading {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
}

.share__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.share__link {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--color-text, #1f2328);
  text-decoration: none;
  background: var(--color-bg, #fff);
  border: 1px solid var(--color-border, #d0d7de);
  border-radius: 999px;
  cursor: pointer;
}

.share__link:hover {
  color: var(--color-accent, #8a3b12);
  border-color: var(--color-accent, #8a3b12);
}

/* ===== 一覧（辞書サイトのブログカード・分類のカードと同じ） ===== */
.section-title {
  margin: 2rem 0 0.75rem;
  font-size: 1.25rem;
  line-height: 1.5;
}

.section-title__note {
  margin-left: 0.5em;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-muted, #59636e);
}

.listing__title {
  margin: 0.5rem 0;
  font-size: 1.5rem;
  line-height: 1.5;
}

.listing__count,
.listing__status {
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-muted, #59636e);
}

.listing__description {
  max-width: var(--measure, 40em);
}

.listing__children {
  margin: 0.75rem 0;
}

.blog-cards,
.class-grid {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}

.blog-cards {
  grid-template-columns: minmax(0, 1fr); /* 長い語（URL など）でカードが画面より広がらないよう、列の最小幅を 0 にする */
}

.blog-cards > li,
.class-grid > li {
  min-width: 0;
}

.class-grid {
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
}

/* ブログカード：スマートフォンでは左に縮小画像、右に文字。PC では上に画像 */
.blog-card,
.class-card {
  display: flex;
  height: 100%;
  color: var(--color-text, #1f2328);
  text-decoration: none;
  background: var(--color-bg, #fff);
  border: 1px solid var(--color-border-soft, #e4e2dc);
  border-radius: var(--radius-card, 10px);
  box-shadow: var(--shadow-card, 0 1px 2px rgb(31 35 40 / 6%));
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.blog-card:hover,
.class-card:hover {
  color: var(--color-text, #1f2328);
  border-color: var(--color-accent, #8a3b12);
  box-shadow: var(--shadow-raise, 0 4px 16px rgb(31 35 40 / 12%));
}

.blog-card {
  gap: 0.75rem;
  padding: 0.75rem;
}

.blog-card__image {
  flex: 0 0 7.5rem;
  align-self: flex-start; /* カードの高さに引き伸ばさない（縦横比を保つ） */
  width: 7.5rem;
  height: auto;
  aspect-ratio: 40 / 21;
  object-fit: cover;
  border-radius: var(--radius, 6px);
}

.blog-card__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.blog-card__headword {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--color-link, #0b5cad);
}

.blog-card__reading,
.blog-card__category,
.class-card__count {
  font-size: 0.8125rem;
  color: var(--color-muted, #59636e);
}

.blog-card__definition {
  display: -webkit-box;
  margin: 0.25rem 0;
  overflow: hidden;
  font-size: 0.875rem;
  line-height: 1.7;
  -webkit-line-clamp: 3; /* 一覧では3行まで */
  -webkit-box-orient: vertical;
}

.blog-card__category {
  margin-top: auto;
}

.class-card {
  flex-direction: column;
  padding: 0.75rem 1rem;
}

.class-card__name {
  font-weight: 700;
  line-height: 1.5;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag {
  display: inline-block;
  padding: 0.125rem 0.625rem;
  font-size: 0.875rem;
  text-decoration: none;
  border: 1px solid var(--color-border, #d0d7de);
  border-radius: 999px;
}

.tag__count {
  margin-left: 0.375em;
  font-size: 0.75rem;
  color: var(--color-muted, #59636e);
}

.pager ol {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.375rem;
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}

.pager .page-numbers,
.pager .post-page-numbers {
  display: inline-block;
  min-width: 2.25rem;
  padding: 0.375rem 0.5rem;
  text-align: center;
  text-decoration: none;
  background: var(--color-bg, #fff);
  border: 1px solid var(--color-border, #d0d7de);
  border-radius: var(--radius, 6px);
}

.pager .page-numbers.dots {
  background: none;
  border-color: transparent;
}

.pager .current {
  font-weight: 700;
  color: var(--color-on-accent, #fff);
  background: var(--color-accent, #8a3b12);
  border-color: var(--color-accent, #8a3b12);
}

.related {
  margin-top: 2rem;
}

/* ===== トップ ===== */
.top__hero {
  margin: calc(var(--space, 1rem) * -1) calc(var(--space, 1rem) * -1) 0.5rem;
  padding: 1.5rem var(--space, 1rem);
  background: var(--color-bg, #fff);
  border-bottom: 1px solid var(--color-border-soft, #e4e2dc);
}

.top__title {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  letter-spacing: 0.06em;
}

.top__lead {
  max-width: var(--measure, 40em);
  margin: 0;
  color: var(--color-muted, #59636e);
}

/* ===== ウィジェット・広告 ===== */
.widget {
  margin: 0 0 1.5rem;
}

.widget__title,
.site-sidebar .wp-block-heading {
  margin: 0 0 0.5rem;
  padding-left: 0.6rem;
  font-size: 1rem;
  line-height: 1.5;
  border-left: 4px solid var(--color-accent, #8a3b12);
}

.site-sidebar ul {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9375rem;
}

.site-sidebar .wp-block-search__inside-wrapper {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.site-sidebar .wp-block-search__input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--color-text, #1f2328);
  background: var(--color-surface, #f6f8fa);
  border: 1px solid var(--color-border, #d0d7de);
  border-radius: var(--radius, 6px);
}

.site-sidebar .wp-block-search__button {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.5rem 0.9rem;
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.5;
  white-space: nowrap;
  color: var(--color-on-accent, #fff);
  background: var(--color-accent, #8a3b12);
  border: 0;
  border-radius: var(--radius, 6px);
  box-shadow: none;
}

/* 広告枠（辞書サイトの .ad-slot と同じ。中身は忍者AdMax・楽天のタグ） */
.ad-slot {
  max-width: 100%;
  margin: 2rem 0;
  overflow-x: auto; /* PC のブラウザを狭くしたときの幅728pxの広告で、ページ全体が横にはみ出さないよう枠の中だけで送る */
  text-align: center;
}

/* 狭い画面では、本文の面の左右の余白も広告に使う（768px の画面で幅 728px の広告に左右20pxの余裕）。
   max-width: 100% のままだと面の中の幅に抑えられて広がらない */
.entry .ad-slot {
  max-width: none;
  margin-left: calc(var(--space, 1rem) * -1);
  margin-right: calc(var(--space, 1rem) * -1);
}

/* 広告のタグが差し込む要素（id・class なし）の中は左寄せに戻す。忍者AdMax のスマートフォン用は 320×50 を枠の幅まで
   transform で拡大するが、受け継いだ中央寄せで先に右へずれ、拡大の分だけ枠の右へはみ出していた（2026-10-21、iPhone 390px で 35px）。
   広告そのものは .ad-slot の中央寄せで真ん中に置かれる */
.ad-slot div {
  text-align: left;
}

.ad-slot__label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  color: var(--color-muted, #59636e);
}

.widget-area--content-top .widget,
.widget-area--content-bottom .widget {
  margin: 0;
}

/* ===== フッター ===== */
.site-footer {
  padding: 1.5rem var(--space, 1rem);
  font-size: 0.875rem;
  color: var(--color-muted, #59636e);
  text-align: center;
  background: var(--color-bg, #fff);
  border-top: 1px solid var(--color-border-soft, #e4e2dc);
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.5rem;
  margin: 0 0 0.5rem;
  padding: 0;
  list-style: none;
}

/* ===== お問い合わせ（mu-plugins/contact-form.php のフォーム） ===== */

/* 入力の誤りの文字の色 --color-error: ライト 6.54:1・ダーク 7.51:1（辞書サイトに同じ部品が無いので、tokens.css に値を足さずここで持つ） */
.contact-form {
  --color-error: #b3261e;

  max-width: var(--measure, 40em);
}

.contact-form__field {
  margin: 0 0 1.25rem;
}

.contact-form__label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 700;
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--color-text, #1f2328);
  background: var(--color-bg, #fff);
  border: 1px solid var(--color-border, #d0d7de);
  border-radius: var(--radius, 6px);
}

.contact-form [aria-invalid="true"] {
  border-color: var(--color-error, #b3261e);
}

@media screen and (prefers-color-scheme: dark) {
  .contact-form {
    --color-error: #ff8a80;
  }
}

.contact-form__error {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--color-error, #b3261e);
}

.contact-form__notice {
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border, #d0d7de);
  border-left-width: 4px;
  border-radius: var(--radius, 6px);
}

.contact-form__notice--ok {
  border-left-color: var(--color-accent, #8a3b12);
  background: var(--color-accent-soft, #f8eee6);
}

.contact-form__notice--ng {
  border-left-color: var(--color-error, #b3261e);
  background: var(--color-notice-bg, #fff4e5);
}

.contact-form__turnstile {
  margin: 0 0 1rem;
}

.contact-form__submit {
  padding: 0.6rem 1.5rem;
  font: inherit;
  font-weight: 600;
  color: var(--color-on-accent, #fff);
  background: var(--color-accent, #8a3b12);
  border: 0;
  border-radius: var(--radius, 6px);
  cursor: pointer;
}

.contact-form__submit:hover {
  background: var(--color-accent-strong, #6b2c0c);
}

/* ===== 広い画面 ===== */
@media (min-width: 40em) {
  .blog-cards {
    grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr));
  }

  .blog-card {
    flex-direction: column;
    padding: 0 0 0.75rem;
    overflow: hidden;
  }

  .blog-card__image {
    flex: none;
    width: 100%;
    border-radius: 0;
  }

  .blog-card__body {
    flex: 1 1 auto;
    padding: 0 0.75rem;
  }

  .entry__content .alignleft {
    float: left;
    max-width: 50%;
    margin: 0.25rem 1.5rem 1rem 0;
  }

  .entry__content .alignright {
    float: right;
    max-width: 50%;
    margin: 0.25rem 0 1rem 1.5rem;
  }
}

@media (min-width: 48em) {
  .site-header__inner {
    flex-wrap: nowrap;
    padding: 0.75rem 1.5rem;
  }

  form.search {
    order: 0;
    flex: 0 1 28rem;
  }

  .site-nav__list,
  .breadcrumb ol {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .entry__title {
    font-size: 1.875rem;
  }

  .top__hero {
    margin: 0 0 0.5rem;
    padding: 2rem 2.5rem;
    border: 1px solid var(--color-border-soft, #e4e2dc);
    border-radius: var(--radius-card, 10px);
  }

  .top__title {
    font-size: 2.125rem;
  }
}

/* 本文の面（角丸・影）にするのは 60em（960px）から。それより狭いと、面の左右の余白で幅 728px の広告が入らない。
   サイドバーが本文の下に来る間は、本文・サイドバーを本文の面の幅にそろえて中央に置く */
@media (min-width: 60em) {
  .site-layout {
    padding: 1.5rem;
  }

  .site-main:not(.site-main--wide),
  .site-sidebar {
    width: 100%;
    max-width: calc(var(--entry-measure, 50em) + 5rem + 2px);
    margin-right: auto;
    margin-left: auto;
  }

  .entry,
  .not-found {
    margin: 0;
    padding: 2rem 2.5rem;
    border: 1px solid var(--color-border-soft, #e4e2dc);
    border-radius: var(--radius-card, 10px);
    box-shadow: var(--shadow-card, 0 1px 2px rgb(31 35 40 / 6%));
  }

  .entry .ad-slot {
    margin-left: 0;
    margin-right: 0;
  }
}

/* PC: 本文の右にサイドバー（下の欄は画面について来る）。80em（1280px）から。それより狭いと本文の面が広告の幅を取れない */
@media (min-width: 80em) {
  .site-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18rem;
    gap: 2rem;
    align-items: start;
  }

  .site-main--wide {
    grid-column: 1 / -1;
  }

  .site-sidebar {
    max-width: none;
    margin-top: 0;
  }

  .site-sidebar__scroll {
    position: sticky;
    top: 1rem;
  }
}

/* ===== 印刷: 本文だけ（ライトの配色。tokens.css のダークは screen に閉じている） ===== */
@media print {
  .site-header .search,
  .site-sister,
  .site-nav,
  .site-sidebar,
  .share,
  .related,
  .widget-area,
  .ad-slot,
  .site-footer,
  .skip-link {
    display: none !important; /* 印刷時はどの指定よりも優先して隠す */
  }

  body {
    background: #fff;
  }

  .entry {
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .entry__content > * {
    max-width: none;
  }

  .toc details:not([open]) ol,
  .toc__sub[hidden] {
    display: block !important; /* 印刷では閉じている小見出しも出す */
  }

  .toc__toggle {
    display: none;
  }
}
