/* public/style.css */

/* 全体のリセットと基本設定 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", sans-serif;
  line-height: 1.8;
  color: #333;
  background-color: #fafafa;
}

header {
  background-color: #2c3e50;
  color: #fff;
  padding: 1.5rem;
  text-align: center;
}

header h1 {
  font-size: 1.5rem;
}

header p {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-top: 5px;
}

/* リンクの色 */
a {
  color: #3498db;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.home-link {
  color: #fff;
}

/* メインコンテンツ枠 */
main {
  max-width: 800px;
  margin: 30px auto;
  padding: 0 20px;
}

/* トップページのリスト */
section {
  margin-bottom: 40px;
}

h2 {
  border-bottom: 2px solid #2c3e50;
  margin-top: 20px;
  padding-bottom: 5px;
  margin-bottom: 15px;
}

h3 {
  margin-bottom: 10px;
  color: #555;
}

.post-list {
  list-style: none;
}

.post-list li {
  margin-bottom: 10px;
}

.post-list a {
  display: block;
  background: #fff;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  color: #333;
  transition: background 0.2s;
}

.post-list a:hover {
  background: #f0f8ff;
  text-decoration: none;
}

.badge {
  background: #eee;
  color: #555;
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 5px;
}

/* 記事ページのデザイン */
.article-header {
  margin-bottom: 15px;
}

article h2 {
  border-bottom: none;
  font-size: 1.8rem;
  margin-bottom: 20px;
}

/* 問題の枠 */
.question-box {
  background: #fff;
  border-left: 5px solid #e74c3c;
  padding: 15px 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* 解説の枠 */
.answer-box {
  background: #fff;
  border-left: 5px solid #3498db;
  padding: 15px 20px;
  margin-bottom: 30px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.final-answer {
  background: #fdf2f2;
  padding: 10px;
  border-radius: 4px;
  margin-top: 15px;
  text-align: right;
  font-size: 1.2rem;
  color: #c0392b;
}

.final-answer img {
  vertical-align: top;
}

/* 記述問題用の外枠（右寄せを解除して枠を確保） */
.final-answer-block {
  background: #fdf2f2;
  border: 1px solid #f5c6cb;
  border-radius: 6px;
  padding: 15px;
  margin-top: 20px;
  text-align: left;
  /* 左寄せに戻す */
}

/* 「【模範解答】」の見出し */
.final-answer-title {
  display: block;
  font-weight: bold;
  color: #c0392b;
  margin-bottom: 10px;
  font-size: 1rem;
}

/* 内側の答案カード（白背景） */
.answer-statement {
  background-color: #ffffff;
  border: 1px solid #e0e0e0;
  /* der-left: 4px solid #c0392b; */
  border-radius: 4px;
  padding: 15px 20px;
  color: #2c3e50;
  line-height: 1.9;
}

.answer-statement p {
  margin-bottom: 8px;
}

.answer-statement p:last-child {
  margin-bottom: 0;
}

.back-nav {
  margin-top: 40px;
  text-align: center;
}

footer {
  background-color: #2c3e50;
  color: #fff;
  padding: 1.5rem;
  margin-top: 40px;
  text-align: center;
  font-size: 0.9rem;
}

/* フッター内のナビゲーション（リンク部分） */
footer nav {
  margin-bottom: 10px;
}

/* リンクの色と装飾 */
footer a {
  color: #ffffff;
  text-decoration: none;
  margin: 0 8px;
}

/* マウスホバー時に少し薄くして押しやすくする */
footer a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* コピーライト表示（ヘッダーのpと同じトーン） */
footer p {
  color: #fff;
  opacity: 0.8;
  margin-top: 5px;
  font-size: 0.85rem;
}

/* アコーディオン（展開ボタン）のカスタマイズ */
.answer-details {
  margin-bottom: 30px;
}

.toggle-btn {
  background-color: #3498db;
  color: white;
  padding: 12px 20px;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  list-style: none;
  /* デフォルトのアローアイコンを消す */
  display: inline-block;
  transition: background-color 0.2s;
  user-select: none;
}

.toggle-btn:hover {
  background-color: #2980b9;
}

/* 独自のトグル用矢印マーク */
.toggle-btn::before {
  content: "▶ ";
  font-size: 0.8em;
  margin-right: 5px;
}

/* 開いた状態のスタイル */
.answer-details[open] .toggle-btn {
  background-color: #2c3e50;
  margin-bottom: 10px;
}

.answer-details[open] .toggle-btn::before {
  content: "▼ ";
}

/* 開いた中身のスタイル（枠線の左側を整える） */
.answer-box {
  background: #fff;
  border-left: 5px solid #3498db;
  padding: 15px 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* --- 画像挿入用スタイル --- */
.question-image {
  margin: 15px auto;
  text-align: center;
  /* 画像とキャプションを中央揃え */
}

.question-image img {
  max-width: 100%;
  /* 画面幅を超えないように自動縮小 */
  height: auto;
  /* 縦横比を維持 */
  border: 1px solid #e0e0e0;
  /* 薄い枠線（背景が白い画像の見分け用） */
  border-radius: 4px;
  /* 角を少し丸く */
  background-color: #fff;
  padding: 5px;
}

.question-image figcaption {
  font-size: 0.85rem;
  color: #666;
  margin-top: 5px;
}

/* --- 直線囲み用スタイル --- */
.solidbox {
  display: block;
  width: fit-content;
  position: relative; /* 子要素の位置基準にする */
  margin: 20px auto;
  padding: 20px;
  border: 1px solid; /* 囲み線 */
  /* border-radius: 4px; */
}

/* --- テキスト囲み用スタイル --- */
.solidtextbox {
  padding: 0 15px;
  margin: 0 5px;
  border: 1px solid; /* 囲み線 */
}

/* --- 点線囲み用スタイル --- */
.dotbox {
  position: relative; /* 子要素の位置基準にする */
  margin: 20px 50px;
  padding: 20px;
  border: 3px dotted; /* 囲み線 */
  /* border-radius: 4px; */
}

/* --- 中央に点線を表示 --- */
.dotline {
  display: inline-block;
  vertical-align: middle;
  width: 2em;
  border-top: 1px dashed;
  height: 0;
}

.box-title {
  position: absolute; /* 枠線に対して絶対配置 */
  top: -14px; /* 上の枠線に重なるよう調整 */
  left: 10px; /* 左からの距離 */
  padding: 0 5px; /* 左右の余白 */
  background-color: #fafafa; /* 背景色を入れて下の線を隠す */
  font-weight: bold;
  /* font-size: 14px;
  color: #333; */
}

/* --- ローマ数字のフォント --- */
.roman-numeral {
  /* font-family: 'Cinzel', 'Georgia', 'Times New Roman', serif; */
  font-family: serif;
  font-weight: bold;
  letter-spacing: 0.05em;
}

/* --- テーブル --- */
table {
  border-collapse: collapse;
}
table th, table td {
  border: none;
  vertical-align: top; 
}

/* --- 下線 --- */
.sub-line {
  display: inline-block;
  border-bottom: 2px solid;
  line-height: 0;
  display: inline-block;
  padding-bottom: 1px;
}

.sub-line::before {
  content: attr(data-label); /* HTMLのdata-labelの文字を表示 */
  font-size: 0.6em;          /* 文字を小さく（元のサイズの60%） */
  vertical-align: 0.1em;     /* 少し上付きにする（中央に合わせるなら middle） */
  margin-right: 0.3em;       /* 下線との間の隙間 */
  display: inline-block;
}