/*
Theme Name: とろマンガッ！
Theme URI: https://girls-eromanga.com
Description: 女性向けエロ漫画サイト「とろマンガッ！」専用テーマ
Version: 2.2.0
Author: TEN MEDIA
Text Domain: toromanga
*/

/* ─── リセット & ベース ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #ffffff;
  --bg-card: #ffffff;
  --fg: #333333;
  --fg-muted: #777777;
  --fg-light: #aaaaaa;
  --accent: #e85b81;
  --accent-dark: #c94a6e;
  --accent-light: #fce4ec;
  --header-bg: #fff5f7;
  --border: #f0e0e6;
  --bl: #5b7be8;
  --bl-light: #e4ecfc;
  --tl: #e85b81;
  --tl-light: #fce4ec;
  --tag-bg: #fce4ec;
  --tag-text: #c94a6e;
  --gold: #d4a017;
  --silver: #8a8a8a;
  --bronze: #a0622e;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --font: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color-scheme: light;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-dark);
}

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

/* ─── レイアウト ─── */
.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

/* 作品ページ用ナロー */
.wrap-narrow {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-main {
  padding-top: 0;
  padding-bottom: 40px;
}

/* ─── ヘッダー ─── */
.site-header {
  background: var(--header-bg);
  border-bottom: 2px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

/* ロゴ中央・ナビ右。1fr auto 1fr の3カラムで、
   左の空トラックが右ナビと同じ幅を確保 → ロゴが真ん中に来る。
   ナビが長くて入らない場合は右トラックが min-content まで優先され
   ロゴが左にずれるだけで、重なりは起きない。 */
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
  height: 60px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 12px;
}

.header-right {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-logo {
  grid-column: 2;
  justify-self: center;
  min-width: 0;
}

.site-logo a {
  display: block;
  line-height: 0;
}

.site-logo-img {
  height: 36px;
  width: auto;
  max-width: 100%;
}

/* Desktop navigation */
.header-nav {
  display: flex;
  gap: 16px;
  font-size: 13px;
  font-weight: 500;
}

.header-nav a {
  color: var(--fg-muted);
  transition: color 0.2s;
  /* 日本語は文字単位で改行できるため、これが無いと
     幅が狭いときに「ランキ/ング」のように折り返してヘッダーが2段になる */
  white-space: nowrap;
}

.header-nav a:hover,
.header-nav a.current {
  color: var(--accent);
}

/* Hamburger button (3-line → X) */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  position: relative;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--fg);
  border-radius: 1px;
  transition: all 0.25s;
}

.menu-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle.open span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile drawer nav */
.mobile-nav {
  display: none;
  position: absolute;
  top: 100%;          /* ヘッダー高さに自動追従（固定値にすると高さ変更でズレる） */
  left: 0;
  right: 0;
  background: #fff;
  border-bottom: 2px solid var(--accent);
  box-shadow: var(--shadow);
  flex-direction: column;
  padding: 12px 0;
  z-index: 99;
}

.mobile-nav.open {
  display: flex;
}

.mobile-nav a {
  display: block;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.mobile-nav a:last-child {
  border-bottom: none;
}

.mobile-nav a:hover {
  background: var(--accent-light);
  color: var(--accent);
}

/* ─── セクション見出し ─── */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}

.section-head h2 {
  font-size: 18px;
  font-weight: 900;
}

.section-head .more {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.section-block {
  margin-bottom: 32px;
}

/* ─── TL / BL 切り替えタブ（トップのランキング・新着） ─── */
.cat-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.cat-tab {
  flex: 1;
  padding: 11px 0;
  border: 0;
  border-radius: 2px;
  background: #f0f0f0;
  color: var(--fg-light);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.cat-tab:hover {
  color: var(--fg-muted);
}

.cat-tab.active {
  color: #fff;
  background: var(--accent);
}

.cat-tab.active.cat-tab-tl {
  background: var(--tl);
}

.cat-tab.active.cat-tab-bl {
  background: var(--bl);
}

.cat-panel[hidden] {
  display: none;
}

/* ─── ヒーロー（トップページ） ─── */
.hero {
  margin-top: 24px;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: 20px;
  font-weight: 900;
  line-height: 1.4;
  margin-bottom: 4px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero-sub {
  font-size: 13px;
  color: var(--fg-muted);
}

/* ─── 人気タグ（横スクロール） ─── */
.tag-chips-wrap {
  margin-bottom: 28px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tag-chips-wrap::-webkit-scrollbar {
  display: none;
}

.tag-chips {
  display: flex;
  gap: 8px;
  padding-bottom: 4px;
  width: max-content;
}

.tag-chip {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--fg);
  transition: all 0.2s;
}

.tag-chip:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ─── 作品カード＆グリッド（統一コンポーネント） ───
   見せ方はキュンイキ（girls-adult.com）の .video-card に揃える：
   サムネ（上）→ タイトル → タグ → 日付。カード全体が1つのリンク。
   PC：5列 × 3行 / SP：3列 × 5行 = 1ページ15件（toromanga_per_page()）。
   件数を変えるときは列数の倍数にすること。 */
.work-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px 12px;
}

.work-card {
  min-width: 0;            /* グリッド内で長いタイトルに引っ張られて列が広がるのを防ぐ */
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.25s, transform 0.25s;
}

.work-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  transform: translateY(-2px);
}

.work-card > a {
  display: block;
  color: inherit;
}

.work-thumb {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--accent-light);
}

.work-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.work-card:hover .work-thumb img {
  transform: scale(1.05);
}

/* 順位（左上） */
.work-rank {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  min-width: 26px;
  height: 26px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  color: #fff;
  background: rgba(0,0,0,0.55);
  font-variant-numeric: tabular-nums;
}

.work-rank.rank-1 { background: var(--gold); }
.work-rank.rank-2 { background: var(--silver); }
.work-rank.rank-3 { background: var(--bronze); }

/* TL / BL（右上） */
.work-cat {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  padding: 2px 7px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  color: #fff;
}

.work-cat.cat-tl { background: var(--tl); }
.work-cat.cat-bl { background: var(--bl); }

/* ページ数（右下） */
.work-pages {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 2;
  padding: 1px 6px;
  border-radius: 2px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.work-info {
  padding: 10px 10px 12px;
}

.work-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--fg);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.work-card:hover .work-title {
  color: var(--accent);
}

/* タグは折り返しを許しつつ2行ぶんで切る（行単位で切れるので中途半端に欠けない） */
.work-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 40px;
  overflow: hidden;
  margin-bottom: 6px;
}

.work-tags span {
  font-size: 10px;
  line-height: 1;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 3px 7px;
  border-radius: 2px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.work-meta {
  display: flex;
  align-items: center;
}

.work-date {
  font-size: 11px;
  color: var(--fg-muted);
}

/* toromanga_category_badge() が出力するバッジ。
   現在テンプレートからは未使用だが、使われた際に無スタイルに
   ならないよう定義しておく。 */
.category-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}

.category-badge.cat-tl { background: var(--tl); }
.category-badge.cat-bl { background: var(--bl); }

/* ─── タグアコーディオン（トップページ＆タグ一覧） ─── */
.tag-section {
  margin-bottom: 32px;
}

.tag-group {
  border-bottom: 1px solid var(--border);
}

/* 軸名の見出しラッパー（h2/h3）。ブラウザ既定の文字サイズ・余白を打ち消す */
.tag-group-head {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  margin: 0;
}

.tag-group-btn {
  width: 100%;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 700;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tag-group-btn::after {
  content: "▾";
  font-size: 12px;
  color: var(--fg-muted);
  transition: transform 0.2s;
}

.tag-group-btn.open::after {
  transform: rotate(180deg);
}

.tag-group-list {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 14px;
}

.tag-group-list.open {
  display: flex;
}

.tag-group-list a {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 100px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--fg);
  transition: all 0.2s;
}

.tag-group-list a:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* タグアイテム（カウント付き — タグ一覧ページ用） */
.tag-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 13px;
  padding: 5px 16px;
  border-radius: 100px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--fg);
  transition: all 0.2s;
}

.tag-item:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.tag-item .count {
  font-size: 10px;
  color: var(--fg-light);
  font-weight: 500;
}

.tag-item:hover .count {
  color: rgba(255,255,255,0.7);
}

/* ─── サイト説明（折りたたみ） ─── */
.site-desc {
  background: var(--header-bg);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 40px;
  font-size: 13px;
  line-height: 1.9;
  color: var(--fg-muted);
  border-radius: 4px;
}

.site-desc-toggle {
  display: inline;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  margin-left: 4px;
}

.site-desc-full {
  display: none;
  margin-top: 8px;
}

.site-desc-full.open {
  display: block;
}

/* ─── パンくずリスト ─── */
.breadcrumb {
  font-size: 12px;
  color: var(--fg-muted);
  margin: 16px 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.breadcrumb a {
  color: var(--fg-muted);
}

.breadcrumb a:hover {
  color: var(--accent);
}

.breadcrumb .sep {
  margin: 0 2px;
  color: var(--fg-light);
}

/* ─── ページタイトル（アーカイブ） ─── */
.page-title {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 6px;
}

/* h1 の下に置く説明文（見出しではないので p で出力）。
   font-weight を明示しておき、将来タグを変えても見た目が崩れないようにする。 */
.page-subtitle {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.7;
  color: var(--fg-muted);
  margin-bottom: 20px;
}

/* ─── ターム説明文（カテゴリ・タグ・作家ページ） ─── */
.term-desc {
  background: var(--header-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.8;
}

/* 既定は3行でクランプし、「続きを読む」で全文表示 */
.term-desc-body {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--fg);
}

.term-desc-body.open {
  display: block;
  overflow: visible;
}

.term-desc-body p + p {
  margin-top: 0.8em;
}

.term-desc-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.term-desc-toggle {
  margin-top: 8px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.term-desc-toggle:hover {
  color: var(--accent-dark);
}

/* ─── 検索バー ─── */
.search-bar {
  position: relative;
  margin-bottom: 20px;
}

.search-bar input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 14px;
  font-family: inherit;
  color: var(--fg);
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.search-bar input:focus {
  border-color: var(--accent);
}

.search-bar input::placeholder {
  color: var(--fg-light);
}

.search-bar-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--fg-light);
  pointer-events: none;
}

.search-no-result {
  text-align: center;
  padding: 24px 0;
  font-size: 13px;
  color: var(--fg-muted);
  display: none;
}

/* ─── 作家一覧 ─── */
.artist-group {
  margin-bottom: 24px;
}

.artist-group-label {
  font-size: 14px;
  font-weight: 900;
  color: var(--accent);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
  letter-spacing: 0.05em;
}

.artist-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.artist-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 13px;
  padding: 6px 16px;
  border-radius: 4px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--fg);
  transition: all 0.2s;
}

.artist-item:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.artist-item .count {
  font-size: 10px;
  color: var(--fg-light);
}

/* ─── 期間タブ（ランキング） ─── */
.period-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.period-tab {
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 700;
  color: var(--fg-muted);
  position: relative;
  transition: color 0.2s;
  white-space: nowrap;
}

.period-tab:hover {
  color: var(--fg);
}

.period-tab.active {
  color: var(--accent);
}

/* 選択中のタブに下線。border-bottom の上に重ねる */
.period-tab.active::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
}

/* ランキングの空状態 */
.ranking-empty {
  padding: 32px 0 8px;
  text-align: center;
}

.ranking-empty-lead {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}

.ranking-empty-note {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 20px;
}

.ranking-empty .notfound-actions {
  justify-content: center;
}

/* ─── 作品一覧フィルター ─── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}

.filter-btn {
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--fg);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* TL / BL を選んだときは、それぞれのカテゴリ色にする */
.filter-btn.active-tl {
  background: var(--tl);
  border-color: var(--tl);
}

.filter-btn.active-bl {
  background: var(--bl);
  border-color: var(--bl);
}

.filter-btn.active-bl:hover {
  background: var(--bl);
  color: #fff;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active:hover {
  background: var(--accent-dark);
  color: #fff;
}

.sort-select {
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  color: var(--fg);
  background: #fff;
  cursor: pointer;
}

/* ─── 単体記事ページ ─── */
.post-meta-block {
  margin-bottom: 20px;
}

.post-cat {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.post-cat.cat-tl { background: var(--tl); }
.post-cat.cat-bl { background: var(--bl); }

.post-title {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.4;
  margin-bottom: 10px;
}

.post-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 12px;
}

.post-info-item {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

/* 作品名は長くなりやすいので1行を占有させ、折り返しも許可する。
   横並びのままだと長いタイトルで横スクロールが発生する。 */
.post-official {
  flex-basis: 100%;
  flex-wrap: wrap;
  align-items: baseline;
  word-break: break-word;
}

.post-info-label {
  font-weight: 700;
  color: var(--fg);
  font-size: 12px;
}

.post-artist a {
  color: var(--accent);
  font-weight: 500;
}

.post-artist a:hover {
  text-decoration: underline;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.post-tags a {
  font-size: 12px;
  padding: 3px 12px;
  border-radius: 100px;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-weight: 500;
  transition: all 0.2s;
}

.post-tags a:hover {
  background: var(--accent);
  color: #fff;
}

/* ─── あらすじ（アコーディオン） ─── */
.synopsis {
  background: var(--header-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px 20px;
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--fg);
}

.synopsis-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}

.synopsis-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
}

.synopsis-text.open {
  display: block;
  -webkit-line-clamp: unset;
}

.synopsis-toggle {
  display: inline-block;
  margin-top: 8px;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

.synopsis-toggle:hover {
  text-decoration: underline;
}

/* ─── 漫画ビューア ─── */
.viewer-section {
  margin-bottom: 32px;
}

.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}

.viewer-header h2 {
  font-size: 16px;
  font-weight: 900;
}

.viewer-page-info {
  font-size: 12px;
  color: var(--fg-muted);
  font-weight: 500;
}

.viewer-pages {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #f5f5f5;
  border: 1px solid var(--border);
  padding: 2px;
}

/* 比率を固定しない。漫画は見開き・縦長などページごとに比率が異なるため、
   aspect-ratio を固定すると白帯が入り縮小表示になってしまう。
   min-height は読み込み前の高さ確保（CLS緩和）用。 */
.viewer-page {
  width: 100%;
  position: relative;
  min-height: 200px;
  background: #fff;
}

.viewer-page img {
  width: 100%;
  height: auto;
  display: block;
  background: #fff;
}

/* ─── タグブロック（ビューア下） ─── */
.all-tags-block {
  margin-bottom: 32px;
}

.all-tags-head {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.all-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.all-tags-list a {
  font-size: 12px;
  padding: 4px 14px;
  border-radius: 100px;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-weight: 500;
  transition: all 0.2s;
}

.all-tags-list a:hover {
  background: var(--accent);
  color: #fff;
}

/* ─── 戻るリンク ─── */
.back-link {
  text-align: center;
  margin: 24px 0;
}

.back-link a {
  display: inline-block;
  padding: 10px 32px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  transition: all 0.2s;
}

.back-link a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── ページネーション ─── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin: 28px 0;
}

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  transition: all 0.2s;
}

.pagination a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination .current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
}

.pagination .dots {
  border: none;
  color: var(--fg-light);
  min-width: 24px;
}

/* ─── 固定ページ（ポリシー・運営者情報など） ─── */
.static-page {
  margin-bottom: 32px;
}

.page-meta {
  font-size: 12px;
  color: var(--fg-light);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* エディタで入力した本文。
   テーマのリセットが全要素の margin を0にしているため、
   ここで明示的に余白と見出しスタイルを与える必要がある。 */
.page-content {
  font-size: 15px;
  line-height: 1.9;
}

.page-content > * + * {
  margin-top: 1.1em;
}

.page-content h2 {
  font-size: 18px;
  font-weight: 900;
  margin-top: 2em;
  margin-bottom: 0.6em;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  text-wrap: balance;
}

.page-content h3 {
  font-size: 15px;
  font-weight: 700;
  margin-top: 1.8em;
  margin-bottom: 0.4em;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
  text-wrap: balance;
}

.page-content h4 {
  font-size: 14px;
  font-weight: 700;
  margin-top: 1.5em;
  margin-bottom: 0.3em;
}

.page-content ul,
.page-content ol {
  padding-left: 1.5em;
}

.page-content li + li {
  margin-top: 0.4em;
}

.page-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}

.page-content strong {
  font-weight: 700;
}

.page-content blockquote {
  padding: 12px 16px;
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  font-size: 14px;
}

.page-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.page-content th,
.page-content td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.page-content th {
  background: var(--header-bg);
  font-weight: 700;
  white-space: nowrap;
}

/* 幅の広い表だけ横スクロールさせ、ページ全体は横スクロールさせない */
.page-content .table-scroll {
  overflow-x: auto;
}

.page-content img {
  border-radius: 4px;
}

.page-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin-top: 2em;
  margin-bottom: 2em;
}

/* ─── 404ページ ─── */
.notfound-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.notfound-btn {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 700;
  background: #fff;
  border: 1px solid var(--accent);
  color: var(--accent);
  transition: all 0.2s;
}

.notfound-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ─── フッター ─── */
.site-footer {
  background: var(--header-bg);
  border-top: 2px solid var(--accent);
  margin-top: 40px;
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 16px 24px;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  margin-bottom: 24px;
}

.footer-col {
  flex: 1 1 200px;
  min-width: 0;
}

.footer-head {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.footer-col ul {
  list-style: none;
}

.footer-col li + li {
  margin-top: 7px;
}

.footer-col a {
  font-size: 13px;
  color: var(--fg);
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-notice {
  font-size: 11px;
  line-height: 1.7;
  color: var(--fg-muted);
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-bottom: 10px;
}

.footer-copy {
  font-size: 12px;
  color: var(--fg-light);
  text-align: center;
}

/* ─── レスポンシブ ─── */
/* ナビをハンバーガーに切り替える幅。
   ロゴを中央に保ったまま6本のナビが収まる限界が約924pxなので、
   それを下回る前（コンテナ幅と同じ960px）で切り替える。
   768pxまで引っ張るとナビが潰れてヘッダーが2段になる。 */
@media (max-width: 959px) {
  .header-nav {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }
}

/* スマホ：3列 × 5行。サムネを主役にして、キュンイキのSP表示と同様に
   カードの枠・影を外し、タイトル・タグを小さく詰める。 */
@media (max-width: 767px) {
  .work-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 8px;
  }

  .work-card {
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  .work-card:hover {
    box-shadow: none;
    transform: none;
  }

  .work-thumb {
    border-radius: 6px;
  }

  .work-rank {
    top: 4px;
    left: 4px;
    min-width: 22px;
    height: 22px;
    font-size: 11px;
    border-radius: 4px;
  }

  .work-cat {
    top: 4px;
    right: 4px;
    padding: 1px 5px;
    font-size: 9px;
  }

  .work-pages {
    right: 4px;
    bottom: 4px;
    padding: 1px 5px;
    font-size: 10px;
    line-height: 1.5;
  }

  .work-info {
    padding: 6px 1px 0;
  }

  .work-title {
    font-size: 11.5px;
    line-height: 1.45;
    font-weight: 600;
    margin-bottom: 4px;
  }

  /* タグは1行ぶん・2個まで */
  .work-tags {
    max-height: 17px;
    margin-bottom: 3px;
  }

  .work-tags span {
    font-size: 9.5px;
    padding: 3px 5px;
  }

  .work-tags span:nth-child(n+3) {
    display: none;
  }

  .work-date {
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .period-tab {
    padding: 9px 0;
    font-size: 13px;
    flex: 1;
    text-align: center;
  }

  .hero h1 {
    font-size: 17px;
  }

  .section-head h2 {
    font-size: 16px;
  }

  .page-title {
    font-size: 18px;
  }

  .post-title {
    font-size: 18px;
  }
}

/* ─── カテゴリ・タグから探す（トップ・ランキングの上） ───
   カテゴリ：PC 6個横並び / SP 3列×2段。押すと下にタグが開き、複数選択できる。
   選択したタグはカテゴリ色＋丸いチェックで表示。件数・ボタンは選択があるときだけ出す。
   動作は js/main.js の initTagFinder。 */
.tag-finder {
  --tf-pink: #dd4b80;
  --tf-line: #ecdfe5;
  max-width: 760px;
  margin: 0 auto 32px;
  background: #fff;
  border: 1px solid var(--tf-line);
  border-radius: 18px;
  box-shadow: 0 12px 40px #6746550b;
  overflow: hidden;
}

.tf-title {
  margin: 0;
  padding: 18px 24px 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.4;
}

.tf-categories {
  padding: 12px 18px 14px;
}

.tf-category-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  max-width: 700px;
  margin: 0 auto;
}

.tf-category {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  width: 100%;
  min-width: 0;
  min-height: 64px;
  padding: 5px 3px;
  border: 1px solid #dddbe0;
  border-radius: 6px;
  background: #fff;
  box-shadow: 2px 3px 6px rgba(69, 54, 65, 0.12);
  color: #453c42;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
}

.tf-category:hover {
  background: #fcf9fa;
  border-color: var(--icon-color);
}

.tf-category.active {
  background: color-mix(in srgb, var(--icon-color) 17%, white);
  border: 2px solid var(--icon-color);
  color: var(--icon-color);
  box-shadow: 2px 3px 8px color-mix(in srgb, var(--icon-color) 28%, transparent),
              inset 0 -3px 0 var(--icon-color);
}

.tf-category svg {
  width: 23px;
  height: 23px;
  color: var(--icon-color);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tf-category:focus-visible,
.tf-tag:focus-visible,
.tf-show-more:focus-visible,
.tf-primary:focus-visible,
.tf-clear:focus-visible {
  outline: 3px solid #bd3974;
  outline-offset: 2px;
}

/* タグ領域：閉じているときは高さ0、カテゴリを押すと開く */
.tf-tag-area {
  --tag-color: var(--tf-pink);
  max-height: 0;
  padding: 0 20px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-7px);
  transition: max-height 0.3s ease, opacity 0.22s ease, transform 0.3s ease, padding 0.3s ease;
}

.tf-tag-area.open {
  max-height: 1200px;
  padding: 15px 20px 18px;
  opacity: 1;
  transform: translateY(0);
  border-top: 1px solid var(--tf-line);
}

.tf-tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tf-tag {
  padding: 6px 10px;
  border: 1px solid #e7dce1;
  border-radius: 10px;
  background: #fff;
  color: #51454b;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
  cursor: pointer;
  transition: 0.12s;
}

.tf-tag:hover {
  border-color: var(--tag-color);
  background: color-mix(in srgb, var(--tag-color) 12%, white);
  color: var(--tag-color);
}

/* 選択中：カテゴリ色の塗り＋丸いチェック */
.tf-tag.selected {
  background: var(--tag-color);
  border-color: var(--tag-color);
  color: #fff;
}

.tf-tag.selected::before {
  content: "✓";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-right: 5px;
  border-radius: 50%;
  background: #fff;
  color: var(--tag-color);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  vertical-align: middle;
}

.tf-show-more {
  display: block;
  margin: 12px auto 0;
  padding: 8px 20px;
  border: 1px solid #efc7d7;
  border-radius: 99px;
  background: #fff8fa;
  color: #b44171;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.tf-show-more:hover {
  background: #ffeaf1;
}

.tf-show-more[hidden] {
  display: none;
}

/* 件数・ボタン（タグを1つ以上選んだときだけ表示） */
.tf-selection {
  padding: 18px 30px 24px;
  background: linear-gradient(180deg, #fff 0%, #fff3f7 100%);
  border-top: 1px solid var(--tf-line);
}

.tf-selection:not(.has-selection) {
  display: none;
}

.tf-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 420px;
  margin: 0 auto;
}

.tf-count {
  margin: 0;
  color: #51444c;
  font-size: 13px;
  font-weight: 700;
}

.tf-count::before {
  content: "✦";
  margin-right: 7px;
  color: #d6af55;
}

.tf-count strong {
  color: #df4c85;
  font-size: 23px;
  font-weight: 900;
}

.tf-primary {
  display: block;
  width: 100%;
  padding: 11px 24px;
  border-radius: 99px;
  background: linear-gradient(100deg, #f77aa9, #e83d82);
  box-shadow: 0 6px 14px #e83d8233;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.tf-primary:hover {
  color: #fff;
  filter: brightness(0.96);
}

/* 0件のとき：押せない見た目にする */
.tf-primary.is-disabled {
  background: #d9d2d6;
  box-shadow: none;
  cursor: not-allowed;
  filter: none;
}

.tf-clear {
  padding: 2px 10px;
  border: 0;
  background: none;
  color: #81757b;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
}

.tf-clear:hover {
  text-decoration: underline;
}

@media (max-width: 767px) {
  .tf-title {
    padding: 14px 14px 0;
    font-size: 16px;
  }

  .tf-categories {
    padding: 8px 10px 10px;
  }

  /* スマホは3列×2段 */
  .tf-category-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .tf-category {
    min-height: 62px;
    padding: 4px 2px;
    font-size: 11px;
  }

  .tf-category svg {
    width: 20px;
    height: 20px;
  }

  .tf-tag-area {
    padding: 0 14px;
  }

  .tf-tag-area.open {
    padding: 12px 14px 15px;
  }

  .tf-tag {
    padding: 6px 8px;
  }

  .tf-selection {
    padding: 14px 16px 17px;
  }

  .tf-count {
    font-size: 12px;
  }

  .tf-primary {
    padding: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tf-tag-area {
    transition: none;
  }
}

/* ─── タグ組み合わせ検索結果ページ ─── */
.tag-search-back {
  margin: 8px 0 32px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}
