/* ===== TESTEA.NET COMPATIBLE DESIGN =====
 * docs/samples/sample01.html (大宮開成中学校 2025年度 入試傾向と対策) より移植
 * 移植 SoT: 2026-05-06 user request「sample01.html を流用してデザイン反映」
 *
 * apps/backend/predeploy 等で apps/backend/public/public.css にコピーされ、
 * Cloudflare Workers Static Assets として配信される。
 * renderHtmlShell が <link rel="stylesheet" href="/public.css"> でこのファイルを参照。
 */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --testea-teal: #009e8a;
  --testea-teal-dark: #007a6b;
  --testea-dark: #333333;
  --testea-pink: #e91e8c;
  --testea-bg: #f5f7f6;
  --testea-border: #e0e0e0;
}

body {
  font-family:
    游ゴシック体, "Yu Gothic", YuGothic, "ヒラギノ角ゴ Pro",
    "Hiragino Kaku Gothic Pro", メイリオ, Meiryo, "MS Pゴシック", sans-serif;
  color: var(--testea-dark);
  background: var(--testea-bg);
  line-height: 1.8;
  font-size: 14px;
}

/* ===== HEADER ===== */
.header {
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.header_top {
  border-bottom: 1px solid #eee;
}
.header_top_row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  max-width: 1000px;
  margin: 0 auto;
}
.header_logo a {
  display: flex;
  align-items: center;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--testea-teal-dark);
  letter-spacing: 0.04em;
}

/* ===== PAGE TITLE / HERO (ttl_main) ===== */
.ttl_main {
  background: linear-gradient(
    110deg,
    var(--testea-teal) 0%,
    var(--testea-teal-dark) 55%,
    #005a4e 100%
  );
  padding: 32px 0 24px;
  color: #fff;
}
.ttl_main .row {
  display: flex;
  align-items: center;
  gap: 20px;
}
.single_ttl {
  font-size: clamp(1.2rem, 2.8vw, 1.85rem);
  font-weight: 900;
  color: #fff;
  line-height: 1.4;
  margin-bottom: 10px;
}
.brecrumb ul {
  display: flex;
  list-style: none;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.8);
}
.brecrumb ul li + li::before {
  content: " ＞ ";
  margin: 0 4px;
}
.brecrumb ul li a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
}
.brecrumb ul li a:hover {
  text-decoration: underline;
}

/* ===== LAYOUT ===== */
.row {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}
.main_wrap {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 20px;
}
.main_wrap_ct {
  flex: 1;
  min-width: 0;
}

/* ===== TOC BAR ===== */
.toc-bar {
  background: #fff;
  border-top: 3px solid var(--testea-teal);
  border-bottom: 1px solid var(--testea-border);
  margin-bottom: 24px;
  overflow-x: auto;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.toc-bar-inner {
  display: flex;
}
.toc-bar a {
  display: block;
  padding: 10px 13px;
  font-size: 0.8rem;
  color: var(--testea-dark);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 600;
  border-right: 1px solid #eee;
}
.toc-bar a:hover {
  background: var(--testea-teal);
  color: #fff;
}

/* ===== ARTICLE INTRO BOX ===== */
.article-intro {
  background: #f0faf8;
  border-left: 4px solid var(--testea-teal);
  padding: 16px 20px;
  margin-bottom: 28px;
  font-size: 0.9rem;
  line-height: 1.9;
  border-radius: 0 6px 6px 0;
}
.article-intro strong {
  color: var(--testea-teal);
}

/* ===== M-7 Round 2: partial-grounding mode disclaimer ===== */
.partial-aside {
  background: #fff8e1;
  border-left: 4px solid #f9a825;
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 0.88rem;
  border-radius: 0 6px 6px 0;
}
.partial-aside p:first-child {
  font-weight: 700;
  color: #b26500;
  margin-bottom: 6px;
}
.partial-aside p {
  margin: 0;
}

/* ===== M11: 学校基本情報インフォボックス (deterministic) ===== */
.info-box {
  background: #f3f8f7;
  border: 1px solid var(--testea-border);
  border-left: 4px solid var(--testea-teal);
  padding: 16px 20px;
  margin-bottom: 24px;
  border-radius: 0 6px 6px 0;
  font-size: 0.92rem;
}
.info-box-list {
  margin: 0;
}
.info-box-list + .info-box-list {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--testea-border);
}
.info-box-row {
  display: flex;
  gap: 12px;
  padding: 4px 0;
}
.info-box-label {
  flex: 0 0 7em;
  font-weight: 700;
  color: var(--testea-teal);
  margin: 0;
}
.info-box-value {
  margin: 0;
  line-height: 1.7;
}

/* ===== M14 構造化テーブル (倍率/合格最低点 推移・偏差値・タグ比較) =====
   info-box と同系のトーンで、article table の基本スタイルを再利用する。
   <th scope="row"> (metric ラベル) は列見出しと差別化して左寄せ・淡色背景にする。 */
.m14-section {
  margin: 24px 0;
}
.m14-section .m14-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.85rem;
}
.m14-caption {
  text-align: left;
  font-weight: 700;
  color: var(--testea-teal-dark);
  padding: 6px 0;
  caption-side: top;
}
/* 視覚的には隠すが a11y / SEO 向けに DOM には残す caption。 */
.m14-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.m14-table th[scope="col"] {
  background: var(--testea-teal);
  color: #fff;
  padding: 8px 12px;
  text-align: left;
  font-weight: 700;
  border: 1px solid var(--testea-border);
}
.m14-table th[scope="row"] {
  background: #f3f8f7;
  color: var(--testea-teal-dark);
  padding: 8px 12px;
  text-align: left;
  font-weight: 700;
  border: 1px solid var(--testea-border);
  white-space: nowrap;
}
.m14-table td {
  padding: 8px 12px;
  border: 1px solid var(--testea-border);
  vertical-align: top;
}
.m14-table tbody tr:nth-child(even) td {
  background: #f8fdfb;
}

/* ===== M15 過去5年 出題テーマ/題材 表 (教科別) =====
   M14 構造化テーブルと同系のトーン。<th scope="row"> (教科ラベル) を列見出しと差別化する。
   題材セルは text なので折り返し許容 (white-space は既定のまま)。 */
.m15-section {
  margin: 24px 0;
}
.m15-section .m15-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.85rem;
}
/* 視覚的には隠すが a11y / SEO 向けに DOM には残す caption。 */
.m15-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.m15-table th[scope="col"] {
  background: var(--testea-teal);
  color: #fff;
  padding: 8px 12px;
  text-align: left;
  font-weight: 700;
  border: 1px solid var(--testea-border);
}
.m15-table th[scope="row"] {
  background: #f3f8f7;
  color: var(--testea-teal-dark);
  padding: 8px 12px;
  text-align: left;
  font-weight: 700;
  border: 1px solid var(--testea-border);
  white-space: nowrap;
}
.m15-table td {
  padding: 8px 12px;
  border: 1px solid var(--testea-border);
  vertical-align: top;
}
.m15-table tbody tr:nth-child(even) td {
  background: #f8fdfb;
}

/* ===== ARTICLE CONTENT ===== */
article {
  background: #fff;
  padding: 28px 28px 24px;
  border: 1px solid var(--testea-border);
}
article h2 {
  background: var(--testea-teal);
  color: #fff;
  padding: 10px 18px;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 32px -28px 20px;
  border-radius: 0;
}
article h3 {
  color: var(--testea-dark);
  font-size: 1rem;
  font-weight: 700;
  padding: 8px 0 8px 14px;
  border-left: 4px solid var(--testea-teal);
  border-bottom: 1px solid #e8e8e8;
  margin: 24px 0 14px;
}
article h4 {
  color: var(--testea-teal-dark);
  font-size: 0.95rem;
  font-weight: 700;
  margin: 18px 0 10px;
  padding-left: 10px;
  border-left: 3px solid var(--testea-teal);
}
article p {
  margin-bottom: 14px;
  line-height: 1.85;
  font-size: 0.92rem;
}
article ul,
article ol {
  padding-left: 22px;
  margin-bottom: 14px;
}
article li {
  margin-bottom: 6px;
  font-size: 0.9rem;
  line-height: 1.8;
}
article table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.85rem;
}
article th {
  background: var(--testea-teal);
  color: #fff;
  padding: 8px 12px;
  text-align: left;
  font-weight: 700;
}
article td {
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  vertical-align: top;
}
article tr:nth-child(even) td {
  background: #f8fdfb;
}
article strong {
  color: var(--testea-teal-dark);
}
article a {
  color: var(--testea-teal);
  text-decoration: none;
}
article a:hover {
  text-decoration: underline;
}

/* Highlight / advice / info boxes (markdown-it custom blocks 等で使用想定) */
.highlight-box,
.advice-box,
.info-box,
.warning-box,
.success-box,
.teacher-advice {
  padding: 16px 20px;
  border-radius: 6px;
  margin: 18px 0;
  font-size: 0.88rem;
  line-height: 1.85;
}
.highlight-box {
  background: #f0faf8;
  border: 1px solid #b2dfdb;
}
.advice-box,
.teacher-advice {
  background: #e8f5e9;
  border-left: 4px solid var(--testea-teal);
}
.info-box {
  background: #e3f2fd;
  border-left: 4px solid #1976d2;
}
.warning-box {
  background: #fff3e0;
  border-left: 4px solid #f57c00;
}
.success-box {
  background: #f0faf8;
  border-left: 4px solid var(--testea-teal);
}

/* Section styling */
section {
  margin-bottom: 32px;
}

/* ===== FAQ (P0 SEO fix 2026-05-06) ===== */
.faq-list {
  margin-top: 8px;
}
.faq-item {
  margin-bottom: 18px;
}
.faq-q {
  background: #f0faf8;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 0.92rem;
  border-left: 3px solid var(--testea-teal);
  color: var(--testea-teal-dark);
}
.faq-a {
  background: #fff;
  padding: 12px 16px;
  font-size: 0.9rem;
  border: 1px solid #e8e8e8;
  border-top: none;
  line-height: 1.85;
  margin: 0;
}

/* Article nav */
.article-nav {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--testea-border);
}
.article-nav a {
  display: inline-block;
  padding: 10px 18px;
  font-size: 0.82rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 700;
  background: var(--testea-teal);
  color: #fff;
}
.article-nav a:hover {
  background: var(--testea-teal-dark);
}
.nav-top {
  background: var(--testea-dark) !important;
}

/* Index / top page (/posts) */
.school-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 16px 0;
}
.school-card {
  background: #fff;
  border: 1px solid var(--testea-border);
  border-radius: 4px;
  padding: 14px 16px;
  font-size: 0.85rem;
}
.school-card h3 {
  font-size: 0.95rem;
  color: var(--testea-teal-dark);
  margin-bottom: 8px;
  border: none;
  padding: 0;
}
/* 2026-07-07: card 全体を <a> にしたため、default link 装飾 (下線/青) を打ち消し、
   本文は本文色・hover で clickable と分かるようにする (testea design token 内で最小追加)。 */
a.school-card {
  display: block;
  text-decoration: none;
  color: var(--testea-dark);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
a.school-card:hover {
  border-color: var(--testea-teal);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.school-card p {
  margin: 0;
  color: var(--testea-dark);
}

/* ===== RELATED ARTICLES (P2 SEO fix 2026-05-06: internal linking) ===== */
.related-articles {
  background: #fff;
  border: 1px solid var(--testea-border);
  padding: 20px 24px;
  margin: 0 auto 24px;
  max-width: 1000px;
}
.related-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--testea-teal-dark);
  border-bottom: 2px solid var(--testea-teal);
  padding-bottom: 8px;
  margin-bottom: 16px;
}
.related-block {
  margin-bottom: 14px;
}
.related-block h3 {
  font-size: 0.9rem;
  color: var(--testea-dark);
  font-weight: 700;
  margin-bottom: 8px;
  padding-left: 10px;
  border-left: 3px solid var(--testea-teal);
}
.related-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.related-list li a {
  display: block;
  padding: 8px 12px;
  background: #f8fdfb;
  border: 1px solid var(--testea-border);
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--testea-teal-dark);
  text-decoration: none;
}
.related-list li a:hover {
  background: var(--testea-teal);
  color: #fff;
}

/* ===== FOOTER ===== */
.footer {
  margin-top: 0;
  border-top: 1px solid var(--testea-border);
  background: #fff;
}
.footer_top {
  padding: 24px 0 16px;
  text-align: center;
}
.footer_top p {
  font-size: 0.8rem;
  color: #555;
}
.footer_bottom {
  background: #3a3a3a;
  color: #fff;
  text-align: center;
  padding: 24px 20px 32px;
}
.footer_bottom p {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.65);
  margin: 4px 0;
}
.footer_copyright {
  font-size: 0.73rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 10px !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .main_wrap {
    flex-direction: column;
    padding: 16px;
  }
  article {
    padding: 18px;
  }
  article h2 {
    margin: 24px -18px 16px;
  }
  .single_ttl {
    font-size: 1.1rem;
  }
}
