/* ==========================================================================
   日本史の友 — Friendly Learning Edition (2026-06 全面刷新)
   方針: 明るく親しみやすい学習サイト。白基調 × 朱印「友」(#C8102E) を軸に、
   時代カラーを前面に出す。マークアップ互換（クラス名は旧デザインと同一）。
   ========================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Hiragino Mincho Pro", "MS PMincho", serif;
  --sans: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", "Helvetica Neue", sans-serif;

  /* 角の丸み（サイト共通の基準値） */
  --radius: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* ライトモード（デフォルト）: 白基調 + 暖色の地 */
  --accent:       #c8102e;            /* 朱印ブランド色 */
  --accent-dark:  #a30d26;
  --accent-tint:  #fbeef0;            /* 朱のごく淡い面 */
  --ink:          #2b2a28;
  --mute:         #79736b;
  --paper:        #faf7f2;            /* ページの地（暖かい生成り白） */
  --paper-deep:   #f1eadf;
  --card-bg:      #ffffff;            /* カード・面は白 */
  --hero-bg:      #faf7f2;            /* ヒーローの地（和紙トーン） */
  --line:         #e9e2d7;            /* 罫線 */
  --line-strong:  #d8cfc0;
  --shadow-soft:  0 6px 24px rgba(73, 60, 43, 0.08);
  --shadow-hover: 0 14px 34px rgba(73, 60, 43, 0.14);
  --focus-ring:   0 0 0 3px rgba(200, 16, 46, 0.25);
  --header-bg-soft: rgba(255, 255, 255, 0.88);
  --hero-wash-kodai: rgba(46, 127, 194, 0.09);
  --hero-wash-chusei: rgba(47, 158, 106, 0.08);
  --hero-wash-accent: rgba(200, 16, 46, 0.07);
  --footer-bg:    #ffffff;
  --footer-fg:    #2b2a28;
  --footer-fg-muted: rgba(43, 42, 40, 0.65);
  --footer-link:  #a30d26;
  --footer-divider: #e9e2d7;
  --wash-blue:    rgba(46, 127, 194, 0.13);
  --wash-green:   rgba(47, 158, 106, 0.1);
  --wash-gold:    rgba(184, 134, 11, 0.13);

  /* 時代カラー（明るめに調整）。一覧カード・バッジに使う。
     通史=金茶 / 古代=空藍 / 中世=若緑 / 近世=朱（ブランド色）/ 近現代=菫 */
  --era-tsushi:    #b8860b;
  --era-kodai:     #2e7fc2;
  --era-chusei:    #2f9e6a;
  --era-kinsei:    #c8102e;
  --era-kingendai: #6f63b8;

  color-scheme: light;
}

/* 手動トグル用 */
[data-theme="dark"] {
  --accent:       #f0506b;
  --accent-dark:  #d93d58;
  --accent-tint:  #3a2228;
  --ink:          #ece8e0;
  --mute:         #a59e93;
  --paper:        #1b1916;
  --paper-deep:   #12100d;
  --card-bg:      #26221e;
  --hero-bg:      #211d18;
  --line:         #3a342c;
  --line-strong:  #4a4338;
  --shadow-soft:  0 6px 24px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 14px 34px rgba(0, 0, 0, 0.4);
  --focus-ring:   0 0 0 3px rgba(240, 80, 107, 0.35);
  --header-bg-soft: rgba(38, 34, 30, 0.88);
  --hero-wash-kodai: rgba(98, 168, 222, 0.13);
  --hero-wash-chusei: rgba(86, 189, 139, 0.11);
  --hero-wash-accent: rgba(240, 80, 107, 0.11);
  --footer-bg:    #15130f;
  --footer-fg:    #ece8e0;
  --footer-fg-muted: rgba(236, 232, 224, 0.65);
  --footer-link:  #ece8e0;
  --footer-divider: rgba(255, 255, 255, 0.12);
  --wash-blue:    rgba(98, 168, 222, 0.16);
  --wash-green:   rgba(86, 189, 139, 0.13);
  --wash-gold:    rgba(217, 169, 58, 0.13);
  --era-tsushi:    #d9a93a;
  --era-kodai:     #62a8de;
  --era-chusei:    #56bd8b;
  --era-kinsei:    #f0506b;
  --era-kingendai: #998fd6;
  color-scheme: dark;
}
[data-theme="light"] {
  --accent:       #c8102e;
  --accent-dark:  #a30d26;
  --accent-tint:  #fbeef0;
  --ink:          #2b2a28;
  --mute:         #79736b;
  --paper:        #faf7f2;
  --paper-deep:   #f1eadf;
  --card-bg:      #ffffff;
  --hero-bg:      #faf7f2;
  --line:         #e9e2d7;
  --line-strong:  #d8cfc0;
  --shadow-soft:  0 6px 24px rgba(73, 60, 43, 0.08);
  --shadow-hover: 0 14px 34px rgba(73, 60, 43, 0.14);
  --focus-ring:   0 0 0 3px rgba(200, 16, 46, 0.25);
  --header-bg-soft: rgba(255, 255, 255, 0.88);
  --hero-wash-kodai: rgba(46, 127, 194, 0.09);
  --hero-wash-chusei: rgba(47, 158, 106, 0.08);
  --hero-wash-accent: rgba(200, 16, 46, 0.07);
  --footer-bg:    #ffffff;
  --footer-fg:    #2b2a28;
  --footer-fg-muted: rgba(43, 42, 40, 0.65);
  --footer-link:  #a30d26;
  --footer-divider: #e9e2d7;
  --wash-blue:    rgba(46, 127, 194, 0.13);
  --wash-green:   rgba(47, 158, 106, 0.1);
  --wash-gold:    rgba(184, 134, 11, 0.13);
  --era-tsushi:    #b8860b;
  --era-kodai:     #2e7fc2;
  --era-chusei:    #2f9e6a;
  --era-kinsei:    #c8102e;
  --era-kingendai: #6f63b8;
  color-scheme: light;
}

html {
  scroll-padding-top: 92px;
  background: var(--paper);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

::selection {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
}

body {
  font-family: var(--sans);
  background:
    linear-gradient(180deg, var(--paper) 0%, var(--paper-deep) 58%, var(--paper) 100%);
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-dark); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

a, button, input { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ========== ヘッダー ========== */
#header {
  background: var(--header-bg-soft);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(14px);
}
#header .inner-header {
  width: 95%;
  max-width: 1280px;
  margin: 0 auto;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 16px;
}
#header .logo {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}
#header .logo a {
  color: var(--ink) !important;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--card-bg) 72%, var(--accent-tint));
  position: relative;
  top: 1px;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
#header .logo .logo-icon { top: 0; }
#header .logo a:hover {
  color: var(--accent) !important;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--card-bg) 56%, var(--accent-tint));
  box-shadow: 0 4px 12px rgba(73, 60, 43, 0.08);
}
#header nav.pc {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
#header nav.pc > a {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  transition: background 0.18s ease, color 0.18s ease;
}
#header nav.pc > a:hover {
  background: var(--accent-tint);
  color: var(--accent);
}

/* ========== テーマトグルボタン（theme.js が注入） ========== */
#theme-toggle {
  background: none;
  border: 1.5px solid var(--line-strong);
  color: var(--mute);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  margin-left: 8px;
  line-height: 1;
  vertical-align: middle;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
#theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-tint);
}

/* ========== コンテナ ========== */
#container {
  width: 95%;
  max-width: 1280px;
  margin: 0 auto;
  overflow: hidden;
  padding: 36px 16px 72px;
}

/* ========== サイドバー ========== */
#sub {
  float: left;
  width: 230px;
  padding: 22px 20px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: sticky;
  top: 92px;
  align-self: flex-start;
}
#sub h3 {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent);
  margin: 22px 0 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent-tint);
  letter-spacing: 0.08em;
}
#sub h3:first-child { margin-top: 0; }
#sub ul { list-style: none; margin-bottom: 12px; }
#sub ul li {
  font-size: 13.5px;
  padding: 2px 0;
}
#sub ul li a {
  color: var(--ink);
  text-decoration: none;
  display: block;
  padding: 6px 10px;
  margin: 0 -10px;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}
#sub ul li a:hover {
  color: var(--accent);
  background: var(--accent-tint);
}

/* サイドバー目次 現在地・アクティブ強調 */
#sub ul li a.active,
#sub ul li a[aria-current="page"] {
  color: var(--accent);
  font-weight: 700;
  background: var(--accent-tint);
}

/* ========== メインコンテンツ ========== */
#inner {
  margin-left: 230px;
  min-height: 600px;
  padding-left: 36px;
}

/* ========== トップページ：フルブリード化 ========== */
#container:has(.hero-home) {
  width: 100%;
  max-width: none;
  padding: 0 0 72px;
}
#container:has(.hero-home) #sub { display: none; }
#container:has(.hero-home) #inner {
  margin-left: 0;
  padding-left: 0;
}
#container:has(.hero-home) #inner > .section-title,
#container:has(.hero-home) #inner > .card-grid,
#container:has(.hero-home) #inner > .more-link-wrap,
#container:has(.hero-home) #inner > .point-box,
#container:has(.hero-home) #inner > .home-news {
  width: min(1180px, calc(100% - 36px));
  margin-left: auto;
  margin-right: auto;
}
#container:has(.hero-home) #inner > .section-title {
  max-width: 1180px;
}

/* ========== ヒーロー（トップページ）========== */
/* Safari のフルページスクリーンショットでは、ヒーロー全面の layered gradients
   や mask-image が黒く合成されることがある。背景は単色にして安全側へ倒す。 */
.hero-home,
#inner > .hero-home {
  position: relative;
  overflow: visible;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(300px, 0.66fr);
  align-items: center;
  gap: clamp(28px, 5vw, 64px);
  margin: 0 0 64px;
  padding: clamp(58px, 8vw, 108px) clamp(20px, 6vw, 88px) clamp(50px, 7vw, 90px);
  background: var(--hero-bg);
  background-image: none;
  border-bottom: 1px solid var(--line);
}
.hero-home::before,
#inner > .hero-home::before {
  content: none;
}
.hero-home::after,
#inner > .hero-home::after {
  content: "";
  position: absolute;
  left: clamp(20px, 6vw, 88px);
  right: clamp(20px, 6vw, 88px);
  bottom: -1px;
  height: 1px;
  background: var(--line);
  opacity: 1;
}
.hero-home > * { position: relative; z-index: 1; }

.hero-home .hero-copy {
  max-width: 780px;
  position: relative;
  z-index: 40;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding: 6px 14px;
  background: color-mix(in srgb, var(--card-bg) 70%, var(--accent-tint));
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-radius: var(--radius-pill);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-home h1,
#inner > .hero-home h1 {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 18px;
  font-family: var(--serif);
  color: var(--ink);
  font-size: clamp(44px, 7vw, 92px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0;
}
.hero-home h1 .logo-icon {
  width: clamp(40px, 5.4vw, 72px);
  height: clamp(40px, 5.4vw, 72px);
  margin-right: 0;
  top: 0;
  border-radius: 18%;
  box-shadow: 0 14px 28px rgba(200, 16, 46, 0.24), 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.hero-home .tagline,
#inner > .hero-home .tagline {
  max-width: 660px;
  margin: 0 0 28px;
  color: var(--mute);
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 1.95;
  font-weight: 600;
}

/* ヒーロー内 記事検索 */
.hero-search {
  position: relative;
  z-index: 1200;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  width: min(640px, 100%);
  padding: 8px;
  background: var(--card-bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  box-shadow: 0 18px 48px rgba(73, 60, 43, 0.11);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.hero-search:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus-ring), var(--shadow-soft);
}
.hero-search input {
  min-width: 0;
  border: 0;
  border-radius: var(--radius-pill);
  padding: 12px 12px 12px 20px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  outline: none;
}
.hero-search input:focus,
.hero-search input:focus-visible {
  outline: none;
  box-shadow: none;
}
.hero-search input::-webkit-search-decoration,
.hero-search input::-webkit-search-cancel-button,
.hero-search input::-webkit-search-results-button,
.hero-search input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
}
.hero-search input::placeholder { color: var(--mute); }
.hero-search button {
  min-width: 96px;
  border: 0;
  border-radius: var(--radius-pill);
  padding: 12px 24px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.hero-search button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(200, 16, 46, 0.25);
}
.hero-search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 8px;
  right: 8px;
  display: none;
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  z-index: 1201;
  text-align: left;
}
.hero-search-results.visible { display: block; }
.hero-search-results a,
.hero-search-results .empty {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 18px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.hero-search-results a:last-child { border-bottom: 0; }
.hero-search-results a:hover { background: var(--accent-tint); }
.hero-search-results strong {
  font-family: var(--serif);
  font-size: 16px;
}
.hero-search-results span {
  color: var(--mute);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.hero-search-results .empty { color: var(--mute); font-size: 13px; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0 0;
}
.hero-actions .hero-stats {
  margin: 0;
}
.hero-stats div {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 8px;
  min-height: 42px;
  padding: 8px 14px;
  background: color-mix(in srgb, var(--card-bg) 76%, var(--paper));
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  box-shadow: 0 6px 18px rgba(73, 60, 43, 0.06);
}
.hero-stats dt {
  color: var(--mute);
  font-size: 11px;
  font-weight: 800;
}
.hero-stats dd {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

/* ボタン */
.btn-primary {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: #fff;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 800;
  padding: 13px 28px;
  text-decoration: none;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-pill);
  transition: transform 0.18s ease, background 0.18s ease,
              border-color 0.18s ease, box-shadow 0.18s ease;
}
.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(200, 16, 46, 0.25);
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  background: var(--card-bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 800;
  padding: 13px 28px;
  text-decoration: none;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-pill);
  transition: transform 0.18s ease, border-color 0.18s ease,
              color 0.18s ease, box-shadow 0.18s ease;
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

/* 入場アニメーション：読み込み時に下からふわっと（段差をつけて順番に） */
@keyframes hero-rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero-home .hero-eyebrow,
.hero-home h1,
.hero-home .tagline,
.hero-home .hero-search,
.hero-home .hero-actions,
.hero-home .hero-stats,
.hero-home .hero-feature {
  animation: hero-rise 0.65s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.hero-home h1 { animation-delay: 0.06s; }
.hero-home .tagline { animation-delay: 0.12s; }
.hero-home .hero-search { animation-delay: 0.18s; }
.hero-home .hero-actions { animation-delay: 0.24s; }
.hero-home .hero-stats { animation-delay: 0.28s; }
.hero-home .hero-feature { animation-delay: 0.2s; }
@media (prefers-reduced-motion: reduce) {
  .hero-home .hero-eyebrow,
  .hero-home h1,
  .hero-home .tagline,
  .hero-home .hero-search,
  .hero-home .hero-actions,
  .hero-home .hero-stats,
  .hero-home .hero-feature { animation: none; }
}

/* ヒーロー右：4つの入口カード（時代カラーで彩る） */
.hero-feature {
  display: grid;
  gap: 12px;
}
.hero-feature-card {
  --feature-color: var(--accent);
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: center;
  min-height: 96px;
  padding: 18px 22px 18px 24px;
  color: var(--ink);
  text-decoration: none;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--feature-color) 10%, transparent), transparent 44%),
    var(--card-bg);
  border: 1px solid var(--line);
  border-left: 6px solid var(--feature-color, var(--accent));
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.hero-feature-card::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 16px;
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  color: var(--feature-color);
  opacity: 0;
  transform: translateX(-6px) rotate(45deg);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.hero-feature-card:nth-child(1) { --feature-color: var(--era-kodai); }
.hero-feature-card:nth-child(2) { --feature-color: var(--era-tsushi); }
.hero-feature-card:nth-child(3) { --feature-color: var(--era-chusei); }
.hero-feature-card:nth-child(4) { --feature-color: var(--era-kingendai); }
.hero-feature-card:nth-child(5) { --feature-color: var(--era-kinsei); }
.hero-feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--feature-color, var(--accent));
}
.hero-feature-card:hover::after {
  opacity: 1;
  transform: translateX(0) rotate(45deg);
}
.hero-feature-card strong {
  display: block;
  margin-bottom: 6px;
  font-family: var(--serif);
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 900;
  line-height: 1.2;
}
.hero-feature-card span {
  color: var(--mute);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
}

/* ========== お知らせ（トップページ） ========== */
.home-news {
  display: grid;
  grid-template-columns: minmax(120px, 0.22fr) minmax(0, 1fr);
  gap: 28px;
  margin: 0 0 48px;
  padding: 28px 32px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}
.home-news-head p {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
}
.home-news-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 900;
}
.news-list { display: grid; gap: 0; }
.news-item,
.news-empty {
  display: grid;
  grid-template-columns: 96px 64px minmax(180px, 0.72fr) minmax(0, 1fr);
  gap: 16px;
  align-items: baseline;
  padding: 14px 0;
  color: inherit;
  text-decoration: none;
  border-top: 1px solid var(--line);
  transition: background 0.18s ease, color 0.18s ease;
}
.news-item:first-child,
.news-empty:first-child { border-top: 0; }
.news-item time {
  color: var(--mute);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.news-label {
  justify-self: start;
  padding: 3px 10px;
  background: var(--accent-tint);
  border-radius: var(--radius-pill);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.6;
  white-space: nowrap;
}
.news-item strong {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.5;
}
.news-body {
  color: var(--mute);
  font-size: 13px;
  line-height: 1.7;
}
.news-item:hover strong { color: var(--accent); }
.news-item:hover {
  background: color-mix(in srgb, var(--accent-tint) 42%, transparent);
}
.news-more {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent);
  text-decoration: none;
}
.news-more:hover { text-decoration: underline; }

/* ========== セクション見出し ========== */
.section-title {
  font-size: clamp(22px, 2.8vw, 28px);
  font-weight: 900;
  margin: 64px 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title::before {
  content: "";
  flex-shrink: 0;
  width: 10px;
  height: 28px;
  background: var(--accent);
  border-radius: 5px;
}
.section-title a {
  color: inherit;
  text-decoration: none;
}
.section-title a:hover {
  color: var(--accent);
}
#inner > .hero-home + .section-title { margin-top: 0; }
#inner > .more-link-wrap + .section-title { margin-top: 48px; }

/* 部見出し（章節別目次） */
.part-title {
  font-family: var(--serif);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 900;
  line-height: 1.25;
  margin: 64px 0 20px;
  padding: 14px 20px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-left: 8px solid var(--accent);
  border-radius: var(--radius);
}

/* ========== カードグリッド ========== */
/* 注意: .card-grid 内のインデントは build.py が解析するため変更不可（HTML側） */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 56px;
}
.card {
  --card-era: var(--accent);
  background: var(--card-bg);
  padding: 26px 24px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/* 上端に時代カラーのアクセントバー */
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--card-era);
  opacity: 0.85;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--card-era) 45%, var(--line));
}
.card:hover h3 a { color: var(--card-era); }

/* 時代カラー（data-era 持ちは時代色、無印は朱） */
.card[data-era="tsushi"]    { --card-era: var(--era-tsushi); }
.card[data-era="kodai"]     { --card-era: var(--era-kodai); }
.card[data-era="chusei"]    { --card-era: var(--era-chusei); }
.card[data-era="kinsei"]    { --card-era: var(--era-kinsei); }
.card[data-era="kingendai"] { --card-era: var(--era-kingendai); }
#container:has(.hero-home) #inner > .card-grid > .card:nth-child(1) { --card-era: var(--era-tsushi); }
#container:has(.hero-home) #inner > .card-grid > .card:nth-child(2) { --card-era: var(--era-kinsei); }
#container:has(.hero-home) #inner > .card-grid > .card:nth-child(3) { --card-era: var(--era-kingendai); }
#container:has(.hero-home) #inner > .card-grid > .card:nth-child(4) { --card-era: var(--era-chusei); }
#container:has(.hero-home) #inner > .card-grid > .card:nth-child(5) { --card-era: var(--era-kinsei); }
#container:has(.hero-home) #inner > .card-grid > .card:nth-child(6) { --card-era: var(--era-kodai); }

/* 時代バッジ：色つきピル */
.card .era {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  padding: 3px 12px;
  margin-bottom: 14px;
  background: color-mix(in srgb, var(--card-era) 11%, transparent);
  border-radius: var(--radius-pill);
  color: var(--card-era);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.card h3 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 12px;
  line-height: 1.25;
}
.card h3 a {
  color: var(--ink);
  text-decoration: none;
  transition: color 0.18s ease;
}
#container:has(.hero-home) #inner > .card-grid > .card {
  min-height: 310px;
}
.card p {
  font-size: 13.5px;
  color: var(--mute);
  line-height: 1.8;
  margin-bottom: 18px;
  flex: 1;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
}
.card .card-link {
  display: inline-block;
  font-size: 13px;
  font-weight: 800;
  color: var(--card-era);
  text-decoration: none;
  transition: opacity 0.18s ease;
}
.card .card-link:hover { opacity: 0.75; }
.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.card-foot .card-link { align-self: auto; }
.card .card-date {
  font-size: 11px;
  font-weight: 700;
  color: var(--mute);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ========== 50音順索引 ========== */
.index-section {
  margin-bottom: 48px;
}
.index-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}
.index-item {
  --index-era: var(--accent);
}
.index-item[data-era="tsushi"]    { --index-era: var(--era-tsushi); }
.index-item[data-era="kodai"]     { --index-era: var(--era-kodai); }
.index-item[data-era="chusei"]    { --index-era: var(--era-chusei); }
.index-item[data-era="kinsei"]    { --index-era: var(--era-kinsei); }
.index-item[data-era="kingendai"] { --index-era: var(--era-kingendai); }
.index-item a,
.index-empty {
  display: grid;
  grid-template-columns: minmax(10em, 1.2fr) minmax(8em, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
  min-height: 54px;
  padding: 11px 14px 11px 16px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-left: 5px solid var(--index-era);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 3px 12px rgba(73, 60, 43, 0.05);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.index-item a:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--index-era) 45%, var(--line));
  box-shadow: var(--shadow-soft);
}
.index-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.35;
}
.index-reading,
.index-alias {
  color: var(--mute);
  font-size: 12px;
  line-height: 1.4;
}
.index-era {
  justify-self: end;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--index-era) 11%, transparent);
  color: var(--index-era);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.index-alias {
  grid-column: 2 / -1;
}
.index-empty {
  display: block;
  color: var(--mute);
  border-left-color: var(--line-strong);
}

/* ========== 「すべての記事を見る」リンク ========== */
.more-link-wrap {
  text-align: center;
  margin: -24px 0 56px;
}
.more-link {
  display: inline-block;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  padding: 13px 32px;
  background: var(--card-bg);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-pill);
  transition: transform 0.18s ease, border-color 0.18s ease,
              color 0.18s ease, box-shadow 0.18s ease;
}
.more-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

/* ========== 記事ページ ========== */
.breadcrumb {
  font-size: 12.5px;
  color: var(--mute);
  margin-bottom: 28px;
}
.breadcrumb a { color: inherit; text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }
.breadcrumb .sep { margin: 0 8px; opacity: 0.55; }

.article-header,
.article-body { max-width: 780px; }

.article-header {
  margin-bottom: 44px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.article-header::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 88px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}
.article-header .era-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  margin-bottom: 18px;
  background: var(--accent-tint);
  border-radius: var(--radius-pill);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.article-header h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 4.2vw, 48px);
  font-weight: 900;
  margin-bottom: 14px;
  line-height: 1.2;
  color: var(--ink);
}
.article-header .subtitle {
  font-size: 16.5px;
  color: var(--mute);
  font-weight: 600;
  line-height: 1.7;
  max-width: 720px;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--mute);
}
.article-meta span { white-space: nowrap; }
.article-meta span + span { padding-left: 14px; border-left: 1px solid var(--line-strong); }

.article-body { counter-reset: h2-counter; }
.article-body h2 {
  font-family: var(--serif);
  font-size: clamp(24px, 3vw, 31px);
  font-weight: 900;
  margin: 64px 0 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  line-height: 1.35;
  display: flex;
  align-items: baseline;
  gap: 14px;
  position: relative;
}
.article-body h2::before {
  counter-increment: h2-counter;
  content: counter(h2-counter, decimal-leading-zero);
  flex-shrink: 0;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.6em;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.article-body h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 56px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}
.article-body h3 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 900;
  margin: 42px 0 14px;
  line-height: 1.45;
}
.article-body p {
  margin-bottom: 24px;
  font-size: 16px;
  line-height: 2;
}
.article-body ul, .article-body ol {
  padding-left: 26px;
  margin-bottom: 24px;
  font-size: 15.5px;
}
.article-body li { margin-bottom: 10px; line-height: 1.9; }
.article-body strong { font-weight: 800; }

/* 強調は太字に統一。<em> も斜体ではなく太字扱い。
   重要語はいずれ解説記事へのリンクに育てる方針で、太字はその暫定マーカー */
.article-body em { font-style: normal; font-weight: 800; }

/* 引用 */
.article-body blockquote {
  margin: 30px 0;
  padding: 16px 22px;
  background: var(--card-bg);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 15.5px;
  line-height: 1.95;
  color: var(--ink);
}
.article-body blockquote p:last-child { margin-bottom: 0; }

/* ポイントボックス（SUMMARY・かんたん要約など） */
.point-box {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 26px 30px;
  margin: 32px 0;
  position: relative;
  overflow: hidden;
}
.point-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--accent);
  opacity: 0.85;
}
.point-box .point-title {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.point-box .point-title .jp {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0.04em;
}
.point-box .point-title .sep {
  color: var(--line-strong);
  font-weight: 400;
}
.point-box p {
  font-size: 15px;
  line-height: 1.95;
  margin-bottom: 14px;
}
.point-box p:last-child { margin-bottom: 0; }

/* 本文末の関連記事 */
.related-articles {
  margin: 64px 0 0;
  padding: 28px 0 0;
  border-top: 1px solid var(--line);
}
.related-articles h2 {
  font-size: 20px;
  font-weight: 900;
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.related-articles h2::before {
  content: "";
  flex-shrink: 0;
  width: 8px;
  height: 22px;
  background: var(--accent);
  border-radius: 4px;
}
.related-articles ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.related-articles li { margin: 0; padding: 0; border: none; }
.related-articles a {
  display: block;
  padding: 14px 18px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 14.5px;
  color: var(--ink);
  text-decoration: none;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.related-articles a:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  color: var(--accent);
}

/* ========== 図版 ========== */
.article-figure {
  margin: 32px 0;
  text-align: center;
}
.article-figure img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.article-figure.portrait img {
  width: min(100%, 360px);
}
.article-figure figcaption {
  font-size: 13px;
  color: var(--mute);
  margin-top: 10px;
  line-height: 1.6;
}

/* ========== 年表 ========== */
.nenpyo-section-title {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 900;
  color: var(--ink);
  margin: 56px 0 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.nenpyo-section-title::before {
  content: "";
  flex-shrink: 0;
  width: 10px;
  height: 26px;
  background: var(--accent);
  border-radius: 5px;
}
.nenpyo-section-title:first-of-type { margin-top: 24px; }
.nenpyo-section-lead {
  font-size: 14.5px;
  color: var(--mute);
  margin: 0 0 20px;
  line-height: 1.7;
}
.nenpyo-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 48px;
  box-shadow: var(--shadow-soft);
}
.nenpyo-table th {
  background: color-mix(in srgb, var(--accent) 6%, var(--card-bg));
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 800;
  padding: 13px 16px;
  text-align: left;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--line);
}
.nenpyo-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: top;
  transition: background 0.15s ease;
}
.nenpyo-table tr:last-child td { border-bottom: none; }
/* 薄い縞模様で行を追いやすくする。hover の強調は縞より後に置いて優先させる */
.nenpyo-table tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--paper) 55%, transparent);
}
.nenpyo-table tbody tr:hover td { background: var(--accent-tint); }
.nenpyo-table .year {
  font-family: var(--serif);
  font-weight: 900;
  white-space: nowrap;
  color: var(--accent-dark);
  font-size: 16px;
  width: 100px;
}
.nenpyo-table .era-col {
  color: var(--mute);
  font-size: 11px;
  letter-spacing: 0.08em;
  width: 110px;
  font-weight: 700;
}
.nenpyo-table .event { font-size: 14.5px; }
.nenpyo-table .event a { font-weight: 700; }

.rekidai-table .year { width: 48px; font-size: 15px; text-align: right; }
.rekidai-table .party-col { width: auto; }
.rekidai-table .term-col { width: 160px; }
.rekidai-table .event { white-space: nowrap; }
.rekidai-table .party {
  font-size: 13.5px;
  white-space: nowrap;
}
.rekidai-table td:last-child {
  font-size: 13.5px;
  color: var(--mute);
  white-space: nowrap;
}
@media (max-width: 720px) {
  .rekidai-table { display: block; overflow-x: auto; white-space: nowrap; }
  .rekidai-table th, .rekidai-table td { padding: 10px 8px; }
  .rekidai-table .year { width: 36px; font-size: 13.5px; }
  .rekidai-table .event { font-size: 13.5px; }
  .rekidai-table .party { font-size: 12.5px; }
  .rekidai-table td:last-child { font-size: 12px; }
}

/* ========== フッター ========== */
#footer {
  background: var(--footer-bg);
  color: var(--footer-fg);
  text-align: center;
  padding: 48px 24px;
  font-size: 13px;
  margin-top: 80px;
  clear: both;
  border-top: 6px solid var(--accent);
}
#footer a { color: var(--footer-link); text-decoration: none; }
#footer a:hover { color: var(--accent); }

#footer.footer-v2 {
  text-align: left;
  padding: 56px 24px 28px;
}
#footer.footer-v2 .footer-grid {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr 1fr 2fr;
  gap: 56px;
  align-items: start;
}
#footer.footer-v2 .footer-grid.footer-grid-2col {
  grid-template-columns: 2fr 1fr;
  gap: 64px;
}
#footer.footer-v2 .footer-col h4 {
  font-size: 12px;
  letter-spacing: 0.12em;
  margin: 0 0 14px;
  color: var(--footer-fg-muted);
  font-weight: 800;
  text-transform: uppercase;
}
#footer.footer-v2 .footer-col p {
  margin: 0 0 10px;
  line-height: 1.8;
  font-size: 13px;
  opacity: 0.85;
}
#footer.footer-v2 .footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
#footer.footer-v2 .footer-col ul li { margin-bottom: 8px; }
#footer.footer-v2 .footer-col ul li a {
  font-size: 13px;
  text-decoration: none;
  opacity: 0.9;
}
#footer.footer-v2 .footer-col ul li a:hover { opacity: 1; color: var(--accent); }
#footer.footer-v2 .footer-brand {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
#footer.footer-v2 .footer-copy {
  max-width: 1080px;
  margin: 36px auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--footer-divider);
  font-size: 12px;
  opacity: 0.65;
  text-align: center;
  letter-spacing: 0.05em;
}

/* ========== 読書プログレスバー（記事ページ、theme.js が注入） ========== */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--era-tsushi));
  transform: scaleX(0);
  transform-origin: left;
  z-index: 2000;
  pointer-events: none;
}

/* ========== ページの先頭へ戻るボタン（theme.js が注入） ========== */
.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--card-bg);
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  color: var(--accent);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.25s ease, visibility 0.25s ease,
              transform 0.25s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  z-index: 900;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}
.back-to-top svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (max-width: 768px) {
  .back-to-top { right: 14px; bottom: 14px; width: 44px; height: 44px; }
}

/* ========== ハンバーガーメニュー（モバイル） ========== */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-direction: column;
  gap: 5px;
  margin-right: 10px;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }
body:not(:has(#sub)) .hamburger { display: none !important; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
}
.sidebar-overlay.active { display: block; }

/* ========== ヘッダー検索（theme.js が注入） ========== */
.header-search {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  position: relative;
  z-index: 1001;
}
.header-search .search-toggle {
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  padding: 6px 8px;
  font-size: 16px;
  line-height: 1;
  border-radius: 8px;
}
.header-search .search-toggle:hover { color: var(--accent); }
.header-search .search-close {
  display: none;
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  padding: 6px 8px;
  font-size: 18px;
  line-height: 1;
}
.header-search .search-close:hover { color: var(--accent); }
.header-search .search-input {
  width: 0;
  padding: 0;
  border: 1px solid transparent;
  opacity: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  border-radius: var(--radius-pill);
  transition: width .25s ease, opacity .2s ease, padding .25s ease, border-color .25s ease;
}
.header-search.open .search-input {
  width: 200px;
  padding: 8px 16px;
  opacity: 1;
  border-color: var(--line);
  margin-right: 6px;
}
/* ブラウザ標準の検索クリア（✕）は非表示。閉じるボタンと紛らわしいため */
.header-search .search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}
.header-search .search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 280px;
  max-height: 360px;
  overflow-y: auto;
  box-shadow: var(--shadow-hover);
  z-index: 1002;
  display: none;
}
.header-search.open .search-results.visible { display: block; }
.header-search .search-results a {
  display: block;
  padding: 11px 16px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.header-search .search-results a:last-child { border-bottom: none; }
.header-search .search-results a:hover {
  background: var(--accent-tint);
  color: var(--accent);
}
.header-search .search-results a .era {
  font-size: 11px;
  color: var(--mute);
  margin-left: 8px;
}
.header-search .search-results .empty {
  padding: 14px;
  color: var(--mute);
  font-size: 13px;
}

/* デスクトップ（769px以上）: 検索窓は常時表示、🔍トグルは非表示 */
@media (min-width: 769px) {
  .header-search .search-toggle { display: none; }
  .header-search .search-input {
    width: 190px;
    padding: 8px 16px;
    opacity: 1;
    border-color: var(--line);
    background: var(--card-bg);
    margin-right: 6px;
  }
  .header-search .search-input:focus { border-color: var(--accent); }
  .header-search .search-results.visible { display: block; }
}

/* ========== SVG・ロゴアイコン ========== */
.nav-icon,
.logo-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.nav-icon {
  stroke: currentColor;
  fill: none;
  width: 14px;
  height: 14px;
  margin-right: 2px;
  position: relative;
  top: -1px;
}
.logo-icon {
  width: 22px;
  height: 22px;
  margin-right: 4px;
  position: relative;
  top: -2px;
  border-radius: 22%;
}
#footer .logo-icon {
  width: 18px;
  height: 18px;
  top: -1px;
}

/* ========== レスポンシブ ========== */

/* タブレット（769〜1024px）: サイドバーを少し細く */
@media (max-width: 1024px) and (min-width: 769px) {
  #sub { width: 190px; padding: 18px 16px; }
  #inner { margin-left: 190px; padding-left: 24px; }
  #container { padding: 28px 14px 56px; }
}

/* モバイル（〜768px）: ハンバーガードロワー */
@media (max-width: 768px) {
  html { scroll-padding-top: 70px; }

  #container {
    display: flex;
    flex-direction: column;
    overflow: visible;
    padding: 18px 14px 36px;
  }
  #container:has(.hero-home) { padding: 0 0 44px; }
  #container:has(.hero-home) #sub { display: block; }
  #container:has(.hero-home) #inner > .section-title,
  #container:has(.hero-home) #inner > .card-grid,
  #container:has(.hero-home) #inner > .more-link-wrap,
  #container:has(.hero-home) #inner > .point-box,
  #container:has(.hero-home) #inner > .home-news {
    width: min(100% - 28px, 1180px);
  }

  .hamburger { display: flex; }

  /* サイドバー：左からスライドのドロワー */
  #sub {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    overflow-y: auto;
    background: var(--paper);
    z-index: 200;
    padding: 72px 24px 32px;
    border: none;
    border-right: 1px solid var(--line);
    border-radius: 0;
    margin-top: 0;
    float: none;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  #sub.open { transform: translateX(0); }
  #sub h3 { font-size: 12.5px; margin: 18px 0 8px; }
  #sub h3:first-child { margin-top: 0; }
  #sub ul li { font-size: 13.5px; }

  /* 記事エリア：全幅 */
  #inner {
    margin-left: 0;
    padding-left: 0;
  }

  /* ヘッダー */
  #header {
    position: relative;
    top: auto;
    background: var(--card-bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  #header .inner-header { height: 56px; padding: 0 12px; }
  #header .logo { font-size: 17px; }
  #header .logo .logo-icon { width: 19px; height: 19px; }
  /* PCナビのリンクはハンバーガー＆サイドバーで代替。
     nav.pc 自体は theme-toggle / 検索の注入先なので残す */
  #header nav.pc > a { display: none; }
  #header nav.pc {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
  }
  .header-search { margin-left: 4px; position: static; }
  .header-search .search-toggle { font-size: 18px; padding: 6px; }

  /* ヒーロー */
  .hero-home,
  #inner > .hero-home {
    grid-template-columns: 1fr;
    gap: 28px;
    margin-bottom: 36px;
    padding: 40px 18px 36px;
    background: var(--hero-bg) !important;
    background-image: none !important;
  }
  .hero-home .hero-eyebrow,
  .hero-home h1,
  .hero-home .tagline,
  .hero-home .hero-search,
  .hero-home .hero-actions,
  .hero-home .hero-stats,
  .hero-home .hero-feature {
    animation: none;
  }
  .hero-home h1,
  #inner > .hero-home h1 {
    font-size: clamp(34px, 11vw, 48px);
    gap: 12px;
    white-space: nowrap;
  }
  .hero-home h1 .logo-icon { width: 38px; height: 38px; }
  .hero-home .tagline,
  #inner > .hero-home .tagline {
    font-size: 14.5px;
    line-height: 1.85;
    margin-bottom: 22px;
  }
  .hero-search input { min-height: 46px; font-size: 16px; /* iOS自動ズーム抑止 */ }
  .hero-search button { min-height: 46px; padding: 0 18px; }
  .hero-actions { margin-top: 16px; }
  .hero-stats { margin-top: 18px; gap: 8px; }
  .hero-stats div { min-height: 38px; padding: 7px 12px; }
  .hero-stats dd { font-size: 20px; }
  .btn-primary, .btn-secondary { padding: 11px 22px; font-size: 13px; }

  .hero-feature { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .hero-feature-card { min-height: 104px; padding: 14px 28px 14px 14px; border-left-width: 5px; }
  .hero-feature-card strong { font-size: 18px; }
  .hero-feature-card span { font-size: 12px; line-height: 1.5; }

  /* お知らせ */
  .home-news {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 36px;
    padding: 20px 18px;
  }
  .news-item,
  .news-empty {
    grid-template-columns: auto 1fr;
    gap: 8px 12px;
    padding: 14px 0;
  }
  .news-item strong,
  .news-body { grid-column: 1 / -1; }

  /* セクション見出し */
  .section-title { font-size: 21px; margin: 44px 0 18px; }
  .section-title::before { width: 8px; height: 22px; }
  .part-title { font-size: 22px; margin: 48px 0 16px; padding: 12px 16px; border-left-width: 6px; }

  /* カード（1列に） */
  .card-grid { grid-template-columns: 1fr; gap: 14px; margin-bottom: 40px; }
  .card { padding: 22px 18px 18px; }
  #container:has(.hero-home) #inner > .card-grid > .card { min-height: 0; }
  .card h3 { font-size: 21px; margin-bottom: 10px; }
  .card p { font-size: 13px; margin-bottom: 14px; -webkit-line-clamp: 6; }
  .index-list { grid-template-columns: 1fr; gap: 9px; }
  .index-item a,
  .index-empty {
    grid-template-columns: 1fr auto;
    min-height: 58px;
    padding: 11px 12px 11px 14px;
  }
  .index-title { font-size: 16px; }
  .index-reading { grid-column: 1; }
  .index-era { grid-column: 2; grid-row: 1 / span 2; }
  .index-alias { grid-column: 1 / -1; }

  /* 記事ページ */
  .article-header { margin-bottom: 32px; padding-bottom: 22px; }
  .article-header h1 { font-size: 27px; line-height: 1.25; }
  .article-header .subtitle { font-size: 15px; }
  .article-body h2 { font-size: 22px; margin: 40px 0 16px; }
  .article-body h3 { font-size: 18px; margin: 26px 0 10px; }
  .article-body p,
  .article-body ul,
  .article-body ol { font-size: 15px; }

  /* ポイントボックス */
  .point-box { padding: 20px 18px; margin: 24px 0; }

  /* 年表テーブル */
  .nenpyo-table th,
  .nenpyo-table td { padding: 10px 10px; font-size: 13px; }
  .nenpyo-table .year { font-size: 14px; width: 70px; }
  .nenpyo-table .era-col { font-size: 10px; width: 78px; }
  .nenpyo-table .event { font-size: 13.5px; }
  .nenpyo-section-title { font-size: 21px; }

  /* フッター */
  #footer { padding: 36px 18px; font-size: 12px; margin-top: 48px; }
  #footer.footer-v2 .footer-grid { grid-template-columns: 1fr; gap: 32px; }

  /* テーマトグルを小さく */
  #theme-toggle { font-size: 9px; padding: 5px 9px; margin-left: 4px; }
}

/* 小型スマホ（〜400px） */
@media (max-width: 400px) {
  .hero-home h1, #inner > .hero-home h1 { font-size: 30px; }
  .article-header h1 { font-size: 24px; }
  .section-title { font-size: 19px; }
  .card h3 { font-size: 19px; }
  .article-body h2 { font-size: 20px; }
  .hero-feature { grid-template-columns: 1fr; }
}

/* ========== モバイル検索：開いたらヘッダーごと検索バーに ========== */
@media (max-width: 768px) {
  .header-search { position: static; }
  .header-search.open {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0 8px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-sizing: border-box;
    z-index: 1100;
  }
  .header-search.open .search-toggle {
    flex: 0 0 auto;
    font-size: 18px;
    padding: 6px;
  }
  .header-search.open .search-input {
    position: static;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 8px 4px;
    font-size: 16px; /* iOS Safari の自動ズーム抑止 */
    opacity: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--ink);
  }
  .header-search.open .search-close {
    display: block;
    flex: 0 0 auto;
  }
  .header-search .search-results {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    width: auto;
    min-width: 0;
    max-width: 100%;
    max-height: calc(100vh - 56px);
    box-sizing: border-box;
    border-left: none;
    border-right: none;
    border-radius: 0;
    z-index: 1099;
    text-align: left;
  }
}

/* ========== 印刷スタイル ========== */
@media print {
  #header, #sub, #footer, .breadcrumb, .sidebar-overlay, .hamburger, #theme-toggle, .header-search, .back-to-top, .reading-progress { display: none !important; }
  body { background: #fff; color: #000; }
  #container { display: block; max-width: 100%; margin: 0; padding: 0; }
  #inner { margin: 0; padding: 0; }
  .article-header, .article-body { max-width: 100%; }
  .article-body { font-size: 11pt; line-height: 1.7; }
  .article-body h2, .article-body h3 { page-break-after: avoid; }
  .article-body p, .article-body li { orphans: 3; widows: 3; }
  a { color: #000; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; word-break: break-all; }
  .point-box, .card { border: 1px solid #000; background: #fff !important; box-shadow: none; }
}
