@charset "UTF-8";

/*
 * seihonet main.css
 *
 * 第六段階で新規作成。旧 style.css / custom.css / font-awesome.css /
 * normalize.css は参照しない（10年前の設計・外部依存削減方針と逆行するため）。
 * 方針の詳細と理由は design.md 「11. デザイン方針」を参照。
 *
 * 外部フレームワーク・Webフォント・アイコンフォント・JavaScript を使わない。
 */

:root {
    --text: #222;          /* 本文（黒に近いグレー） */
    --muted: #666;         /* 区分など控えめな要素 */
    --line: #cccccc;       /* 罫線・枠線 */
    --line-strong: #999999;
    --accent: #b3141b;     /* アクセント赤（ページ見出し .page-title と解答ボタンのみ） */
    --accent-hover: #8f0f15;
    --emphasis: #cc0000;   /* 本文強調 .red 用（アクセント赤とは別用途） */
    --answer-bg: #f4f4f4;  /* 解答の背景 */
    --th-bg: #f0f0f0;
    --bg: #ffffff;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0 auto;
    padding: 16px;
    max-width: 700px;
    font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN",
        "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
    font-size: 16px;
    line-height: 1.8;
    color: var(--text);
    background: var(--bg);
}

/* ------- ページ見出し（赤） ------- */
/* h1 はヘッダのロゴ（サイト名）。ページ固有の見出しは各ページ本文の .page-title。 */
.page-title {
    margin: 0 0 24px;
    font-size: 1.35rem;
    line-height: 1.4;
    color: var(--accent);
}

/* ------- 枝（section） ------- */
section {
    margin: 0 0 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--line);
}

section:last-of-type {
    margin-bottom: 24px;
    padding-bottom: 0;
    border-bottom: none;
}

section p {
    margin: 0 0 12px;
}

/* ------- 区分（控えめ・小さめ） ------- */
p.meta {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--muted);
}

/* 区分ブロックの直後（問題文の先頭）に余白 */
p.meta + :not(p.meta) {
    margin-top: 16px;
}

/* ------- 解答（details / summary） ------- */
details {
    margin-top: 16px;
}

summary {
    display: inline-block;
    padding: 10px 20px;
    min-height: 44px;
    line-height: 24px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    list-style: none;
    -webkit-user-select: none;
    user-select: none;
}

summary::-webkit-details-marker {
    display: none;
}

summary::marker {
    content: "";
}

summary:hover,
summary:focus {
    background: var(--accent-hover);
}

details[open] summary {
    margin-bottom: 12px;
}

/* 解答の中身（本文と区別） */
.answer {
    padding: 12px 16px;
    background: var(--answer-bg);
    border-left: 4px solid var(--line-strong);
    border-radius: 2px;
}

.answer > :first-child {
    margin-top: 0;
}

.answer > :last-child {
    margin-bottom: 0;
}

/* 正誤の判定（色分けしない・濃いグレーの太字） */
p.verdict {
    font-weight: 700;
    color: var(--text);
}

/* ------- 計算問題の表 ------- */
/*
 * table 自体は display: table のまま保ち、列幅の自動調整を効かせる。
 * 狭い画面ではみ出す場合は、Kei=3 の Qk を囲む .table-wrap を横スクロールさせる。
 * DB が出力する HTML（table の中身）は書き換えない。
 */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    margin: 12px 0;
    border-collapse: collapse;
    font-size: 0.95rem;
}

th,
td {
    padding: 6px 12px;
    border: 1px solid var(--line-strong);
    text-align: center;
}

th {
    background: var(--th-bg);
}

/* .table-wrap 内の表（計算問題の平均余命表）だけ列を詰めて横スクロールさせる。
   通常の表は折り返し可にする（design.md 11.6 / senmon design.md 14.5）。 */
.table-wrap th,
.table-wrap td {
    white-space: nowrap;
}

/* ------- ナビゲーション（前へ / 次へ） ------- */
/*
 * 「前へ」を左、「次へ」を右。狭くて2つ並ばないときは折り返す。
 * 片方だけのページでは、「次へ」のみ → 右寄せ（.next の margin-left:auto）、
 * 「前へ」のみ → 左寄せ（既定）。
 */
nav:not(.breadcrumb) {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

nav:not(.breadcrumb) a {
    flex: 0 0 auto;
    max-width: 100%;
    padding: 14px 16px;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--text);
    text-align: center;
    text-decoration: none;
}

nav:not(.breadcrumb) a.next {
    margin-left: auto;
}

nav:not(.breadcrumb) a:hover,
nav:not(.breadcrumb) a:focus {
    border-color: var(--line-strong);
}

/* ------- パンくずリスト（header.php の直後・h2 の前） ------- */
/* 本文より小さく控えめに。赤は使わない。インライン要素なのでスマホ幅で自然に折り返す。 */
.breadcrumb {
    margin: 0 0 16px;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--muted);
}

.breadcrumb a {
    color: var(--muted);
}

.breadcrumb-sep {
    margin: 0 0.4em;
    color: var(--line-strong);
}

/* ------- サイトヘッダ（ロゴ = h1） ------- */
.site-header {
    margin-bottom: 20px;
}

/* ロゴを包む h1。既定の見出しスタイル（サイズ・余白・赤字）を打ち消す。 */
.site-title {
    margin: 0;
    font: inherit;
    color: inherit;
}

.site-header img {
    display: block;
    width: 300px;      /* 実寸。縮小のみ許可（下の max-width） */
    max-width: 100%;
    height: auto;      /* width/height 属性から縦横比を保つ */
}

/* ------- サイトフッタ ------- */
.site-footer {
    margin-top: 40px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 0.85rem;
    color: var(--muted);
}

.site-footer p {
    margin: 0 0 8px;
}

.site-footer p:last-child {
    margin-bottom: 0;
}

.site-footer a {
    color: var(--muted);
}

/* ------- 記事ページ本文（index.php 等） ------- */
.content h2 {
    margin: 0 0 16px;
    font-size: 1.3rem;
    line-height: 1.4;
}

.content h3 {
    margin: 28px 0 8px;
    font-size: 1.1rem;
    line-height: 1.4;
}

/* リード文（静的ページの見出し直後の概要。旧 blogbox 相当。h2 より目立たせない・赤は使わない） */
.content .lead {
    margin: 0 0 20px;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.6;
}

.content .lawdate {
    margin: 0 0 20px;
    font-size: 0.9rem;
}

/* h4（sitemap.php の「第N回」「大区分名」の見出し。h3 より階層が下） */
.content h4 {
    margin: 20px 0 6px;
    font-size: 1rem;
    line-height: 1.4;
}

.content p {
    margin: 0 0 14px;
}

.content ul {
    margin: 0 0 16px;
    padding-left: 1.4em;
}

.content li {
    margin: 4px 0;
}

.content .waku {
    margin: 20px 0;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 4px;
}

.content .waku p:last-child {
    margin-bottom: 0;
}

/* waku 内が <ul> で終わる場合（tokutyo.php）も枠内の余白を残さない */
.content .waku > :last-child {
    margin-bottom: 0;
}

/* 本文中の強調（旧サイトの .red を踏襲。色はアクセント赤とは別） */
.red {
    color: var(--emphasis);
    font-weight: 700;
}

/* ------- 広告（AdSense） ------- */
/* .ad-block の上下余白で本文と区別。.splink（「スポンサーリンク」）は控えめに。赤は使わない。 */
.ad-block {
    margin: 28px 0;
}

.splink {
    margin: 0 0 4px;
    font-size: 0.8rem;
    color: var(--muted);
}
