/* style.css — スマホ優先(375px前後を基準)。PCでは中央寄せの1カラム。
   雰囲気: 柔らかいミニマル。背景は法被(石畳の柄)のイメージ。柄はページの両端だけに見せ、
   文字や部品は、両側に襟のような太い帯を持つ無地のカラム(.page)の上に載せる。
   色: 水色 #A6C4D5 を主役に、濃い青みグレー(ボタン・見出し)と暖色(ハイライト)を補助に使う。
   書体: 本文 = Zen Kaku Gothic New(400のみ) / 見出し・太字 = Zen Maru Gothic(700のみ)。
   読み込む太さを増やすと転送量が増えるため、太字は必ず Zen Maru Gothic 700 にそろえる。 */

:root {
  --accent: #A6C4D5;        /* 主役の水色 */
  --accent-soft: #E3EDF3;   /* 水色の淡い面 */
  --accent-faint: #F3F8FA;
  --ink: #3B5568;           /* 濃い青みグレー(ボタン・強い面) */
  --on-accent: #2A3F4E;     /* 水色の上に載せる文字(コントラスト5:1以上) */
  --warm: #F5D098;          /* 暖色(ハイライト・バッジ) */
  --on-warm: #4A3A10;
  --title-red: #DC0000;     /* タイトルの「父」のみ */

  --pattern-line: #2A3A7A;  /* 柄の線: 少し青みのある紺(法被の写真から採色) */
  --collar: #1C2A50;        /* 襟の帯の色 */
  --collar-width: 10px;
  --plain: #F3F8FA;         /* カラムの無地の色(白いカードが浮いて見える淡い水色) */
  --outer: 12px;            /* 柄が見える、ページ外側の余白 */
  --block: 36px;            /* 柄の1ブロックの大きさ */

  --text: #222222;
  --muted: #566573;
  --border: #D9E2E8;
  --bg: #FFFFFF;

  --shadow: 0 2px 10px rgba(59, 85, 104, 0.14);
  --radius: 16px;
  --max-width: 640px;
  --gutter: 12px;
  --tap-min: 44px;

  --font-body: "Zen Kaku Gothic New", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-head: "Zen Maru Gothic", "Zen Kaku Gothic New", "Hiragino Maru Gothic ProN", "Hiragino Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

/* hidden属性は、個別要素の display 指定より必ず優先する */
[hidden] {
  display: none !important;
}

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

/* 背景: 石畳(網代)の柄。横長の長方形が2つ並ぶブロックと、縦長の長方形が2つ並ぶブロックが、市松状に交互に並ぶ。
   画像ファイルは使わず、CSSに埋め込んだ小さなSVG(96×96・2px線)を敷き詰めている。 */
body {
  margin: 0;
  min-height: 100vh;
  background-color: #FFFFFF;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96'%3E%3Cg fill='%232A3A7A'%3E%3Crect x='0' y='0' width='2' height='96'/%3E%3Crect x='48' y='0' width='2' height='96'/%3E%3Crect x='0' y='0' width='96' height='2'/%3E%3Crect x='0' y='48' width='96' height='2'/%3E%3Crect x='0' y='23' width='48' height='2'/%3E%3Crect x='72' y='0' width='2' height='48'/%3E%3Crect x='24' y='48' width='2' height='48'/%3E%3Crect x='48' y='71' width='48' height='2'/%3E%3C/g%3E%3C/svg%3E");
  background-size: calc(var(--block) * 2) calc(var(--block) * 2);
  background-position: center top;
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.7;
}

/* 無地のカラム。両側の太い帯は、法被の襟のイメージ。この中には柄を入れない */
.page {
  width: calc(100% - var(--outer) * 2);
  max-width: 732px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--plain);
  border-left: var(--collar-width) solid var(--collar);
  border-right: var(--collar-width) solid var(--collar);
}

a {
  color: var(--ink);
}

button,
input {
  font: inherit;
}

/* フォーカス表示はキーボード操作のために残す */
:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ページ内の各ブロックは、同じ幅・左右の余白に揃える */
.wrap,
.search-bar,
.filter-panel,
.active-filters,
.latest-banner,
main,
.site-footer {
  width: min(calc(100% - var(--gutter) * 2), var(--max-width));
  margin-left: auto;
  margin-right: auto;
}

/* ---------- ヘッダー ---------- */
.header-band {
  padding: 24px var(--gutter) 8px;
  text-align: center;
}

.site-title {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1.3;
  letter-spacing: 0.03em;
  color: #000000;
}

/* タイトルをタップすると最初の画面に戻る(リンクに見えないよう、色・下線は付けない) */
.site-title a {
  display: inline-block;
  min-height: var(--tap-min);
  padding: 8px;
  color: inherit;
  text-decoration: none;
}

.title-red {
  color: var(--title-red);
}

.intro {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  line-height: 1.75;
  color: var(--muted);
}

.intro p {
  margin: 0;
}

.intro p + p {
  margin-top: 8px;
}

.intro strong {
  color: var(--text);
  font-weight: 700;
}

/* ---------- 検索欄(画面上部に固定) ---------- */
.search-bar {
  position: sticky;
  top: 8px;
  z-index: 10;
  margin-top: 16px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.search-bar > * + * {
  margin-top: 8px;
}

.search-bar input[type="search"] {
  width: 100%;
  min-height: var(--tap-min);
  padding: 8px 14px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--accent-faint);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.search-bar input[type="search"]:hover,
.search-bar input[type="search"]:focus {
  border-color: var(--accent);
  background: var(--bg);
}

/* 適用中の絞り込み(ラジオネーム・放送回)。解除ボタン付きのチップを並べる */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 4px 3px 12px;
  background: var(--accent);
  border-radius: 999px;
  color: var(--on-accent);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.8rem;
}

.active-chip-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.active-chip-clear {
  flex: none;
  min-height: 36px;
  padding: 2px 12px;
  border: none;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}

/* ラジオネーム欄と、その右に並ぶリセットボタン(リセットは検索・絞り込み中だけ表示) */
.search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-row input[type="search"] {
  flex: 1;
  min-width: 0;
}

.reset-btn {
  flex: none;
  min-height: var(--tap-min);
  padding: 6px 16px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-head);
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.reset-btn:hover {
  background: var(--accent-soft);
}

.reset-btn:active {
  transform: scale(0.97);
}

/* ---------- 絞り込みパネル(折りたたみ式) ---------- */
.filter-panel {
  margin-top: 12px;
  padding: 0 16px;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.filter-panel summary {
  min-height: var(--tap-min);
  display: flex;
  align-items: center;
  cursor: pointer;
  font-family: var(--font-head);
  font-weight: 700;
  padding: 8px 0;
  list-style: none;
}

.filter-panel summary::-webkit-details-marker {
  display: none;
}

.filter-panel summary::before {
  content: "";
  width: 0;
  height: 0;
  margin-right: 10px;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent var(--ink);
  transition: transform 0.15s ease;
}

.filter-panel[open] summary::before {
  transform: rotate(90deg);
}

.filter-panel-body {
  padding-bottom: 14px;
}

.filter-group {
  margin-bottom: 12px;
}

#sheet-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-btn {
  min-height: var(--tap-min);
  padding: 6px 14px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.filter-btn:hover {
  background: var(--accent-soft);
}

.filter-btn:active {
  transform: scale(0.97);
}

.filter-btn.is-active {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  box-shadow: inset 0 0 0 1.5px var(--ink);
}

/* シートを選んだときだけ現れる、追加の絞り込み(お眼鏡賞のみ表示、正解で絞り込む、など) */
.sub-filter {
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--accent);
}

.sub-filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.sub-filter-group:last-child {
  margin-bottom: 0;
}

.sub-filter-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.filter-btn-sub {
  font-size: 0.82rem;
  padding: 4px 12px;
}

.episode-range {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.episode-range input {
  width: 6em;
  min-height: var(--tap-min);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--accent-faint);
}

/* ---------- 最新回バナー ---------- */
.latest-banner {
  margin-top: 16px;
  padding: 18px 20px 20px;
  text-align: left;
  background: linear-gradient(135deg, #FFFFFF 0%, var(--accent-soft) 100%);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.latest-label {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.latest-banner p {
  margin: 0;
}

/* 回番号を大きな数字で見せる */
.latest-no {
  margin-top: 4px !important;
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}

.latest-num {
  font-size: 4rem;
  letter-spacing: 0.01em;
}

.latest-unit {
  margin-left: 6px;
  font-size: 1.75rem;
}

.latest-title {
  margin-top: 6px !important;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.45;
}

.latest-date {
  margin-top: 4px !important;
  font-size: 0.8rem;
  color: var(--muted);
}

.latest-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin-top: 14px;
  border-radius: 999px;
  background: var(--ink);
  color: #FFFFFF;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.latest-btn:hover {
  background: #2F4555;
}

.latest-btn:active {
  transform: scale(0.98);
}

.latest-btn:focus-visible {
  outline-color: var(--on-accent);
}

/* ---------- 結果 ---------- */
main {
  padding: 16px 0 24px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 4px 4px 4px 16px;
  background: var(--bg);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
}

/* トップでは、この行が「最新回の投稿」を開閉するボタンになる */
.results-header.is-toggle {
  min-height: var(--tap-min);
  padding-right: 16px;
  justify-content: flex-start;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
}

.results-header.is-toggle:hover {
  background: var(--accent-soft);
}

.results-header.is-toggle::before {
  content: "";
  flex: none;
  width: 0;
  height: 0;
  margin-right: 2px;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent var(--ink);
  transition: transform 0.15s ease;
}

.results-header.is-toggle[aria-expanded="true"]::before {
  transform: rotate(90deg);
}

.results-header.is-toggle::after {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
}

.results-header.is-toggle[aria-expanded="false"]::after {
  content: "タップで開く";
}

.results-header.is-toggle[aria-expanded="true"]::after {
  content: "閉じる";
}

#sort-toggle {
  min-height: var(--tap-min);
  padding: 6px 16px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font-weight: 400;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

#sort-toggle:hover {
  background: var(--accent-soft);
}

#sort-toggle:active {
  transform: scale(0.97);
}

.error-banner {
  background: #FDECEA;
  border: 1px solid #E0A3A3;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.error-banner ul {
  margin: 4px 0 0;
  padding-left: 1.2em;
}

.latest-note,
.empty-message {
  margin: 0 0 12px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  color: var(--muted);
}

.latest-note {
  border-left: 5px solid var(--warm);
}

.empty-message {
  text-align: center;
}

.results-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* 投稿カード: 罫線を消して、淡い影で浮かせる */
.result-card {
  margin-bottom: 14px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-bottom: 10px;
  font-size: 0.85rem;
}

/* コーナー名・放送回・ラジオネームは、すべて同じ丸枠にそろえる */
.pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 30px;
  padding: 2px 12px;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1.4;
  text-align: left;
  overflow-wrap: anywhere;
}

/* 押せる丸枠(放送回・ラジオネーム)。見た目は変えず、タップ範囲だけ44px相当まで広げる */
button.pill {
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

button.pill::after {
  content: "";
  position: absolute;
  inset: -8px -2px;
}

button.pill:hover {
  background: var(--accent-soft);
}

button.pill:active {
  transform: scale(0.97);
}

.pill-label {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--muted);
}

/* 印列のバッジ(お眼鏡賞など) */
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 2px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
}

.badge-mark {
  background: var(--warm);
  color: var(--on-warm);
  font-weight: 700;
}

/* カード右下: この回をPodcastで聞く */
.card-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.podcast-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
  padding: 0 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.podcast-link:hover {
  text-decoration-thickness: 2px;
}

.card-body .field {
  margin: 0 0 8px;
}

.card-body .field:last-child {
  margin-bottom: 0;
}

.field-heading {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.05rem;
}

.field-normal .field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.field-normal .field-value {
  display: block;
}

/* 検索語のハイライト(暖色) */
mark {
  background: var(--warm);
  color: var(--text);
  border-radius: 4px;
  padding: 0 2px;
}

#load-more {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
  padding: 10px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font-weight: 700;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

#load-more:hover {
  background: var(--accent-soft);
}

#load-more:active {
  transform: scale(0.98);
}

/* ---------- フッター(クレジット) ---------- */
.site-footer {
  margin-top: 8px;
  margin-bottom: 0;
  padding: 20px 16px 24px;
  background: var(--bg);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow);
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.site-footer p {
  margin: 4px 0;
}

.site-footer a {
  color: var(--ink);
}

/* 一番下の「サイト作成」だけ、少し区切る */
.site-footer p:last-child {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* 太字の要素は、見出しと同じ Zen Maru Gothic 700 にそろえる(Zen Kaku Gothic New の太字は読み込まない) */
strong,
.badge,
.latest-label,
.latest-btn,
.filter-btn.is-active,
#load-more,
.results-header,
.podcast-link,
.field-normal .field-label {
  font-family: var(--font-head);
}

@media (min-width: 768px) {
  :root {
    --collar-width: 14px;
    --gutter: 14px;
    --block: 48px;
  }

  .site-title {
    font-size: 2.1rem;
    letter-spacing: 0.04em;
  }

  .header-band {
    padding: 32px var(--gutter) 12px;
  }
}
