/* まなびの予定帳 — 予定表・受験票・教材の期限を扱う実務的な帳面 */
:root {
  --paper: #FFFEF8;
  --ink: #22282A;
  --ink-soft: #3E4649;
  --muted: #5B6468;
  --line: #D7DDD7;
  --line-strong: #AEB8B0;
  --accent: #B64B2C;        /* 朱茶: 期限・未確認・別費用・フォーカス */
  --accent-ink: #9A3E23;    /* 朱茶の文字用（紙色に対して十分なコントラスト） */
  --planned: #E9F0EA;       /* 予定済み・入力済み */
  --organizer: #EDF2F4;     /* 試験主催者の事実 */
  --error: #A1122B;
  --error-bg: #FBEDEF;
  --radius: 4px;
  --container: 1080px;
  --font: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", Meiryo, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink);
  background: var(--paper);
  overflow-wrap: anywhere;
}
img, svg { max-width: 100%; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3 { line-height: 1.45; letter-spacing: 0; font-weight: 700; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.125rem); margin: 0 0 16px; }
h2 { font-size: 1.375rem; margin: 48px 0 16px; padding-top: 16px; border-top: 1px solid var(--line); }
h3 { font-size: 1.125rem; margin: 32px 0 8px; }
p { margin: 0 0 16px; }

.mono, time, .num { font-family: var(--mono); font-size: .94em; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.page { max-width: 800px; margin: 0 auto; padding: 24px 24px 72px; }
.page-wide { max-width: var(--container); margin: 0 auto; padding: 24px 24px 72px; }

.skip-link { position: absolute; left: 8px; top: -60px; background: var(--ink); color: var(--paper); padding: 8px 16px; z-index: 100; }
.skip-link:focus { top: 8px; }

/* ===== Header ===== */
.site-header { background: var(--paper); border-bottom: 1px solid var(--ink); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; min-height: 44px; color: var(--ink); }
.logo-mark { width: 30px; height: 30px; color: var(--accent); flex: none; }
.logo-text { font-weight: 700; font-size: 1.05rem; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0 4px; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; text-decoration: none; color: var(--ink-soft); font-size: .95rem; border-bottom: 3px solid transparent; }
.site-nav a:hover { color: var(--ink); border-bottom-color: var(--line-strong); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.nav-toggle { display: none; }

@media (max-width: 880px) {
  .js .nav-toggle {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 0 12px;
    background: transparent; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--ink); font: inherit; font-size: .9rem; cursor: pointer;
  }
  .nav-toggle-bars { display: grid; gap: 4px; }
  .nav-toggle-bars span { display: block; width: 18px; height: 2px; background: var(--ink); }
  .js .site-nav { display: none; width: 100%; flex-direction: column; padding: 0 0 8px; border-top: 1px solid var(--line); }
  .js .site-nav.open { display: flex; }
  .site-nav a { border-bottom: 1px solid var(--line); padding: 0 4px; }
  .site-nav a[aria-current="page"] { border-bottom-color: var(--line); box-shadow: inset 3px 0 0 var(--accent); padding-left: 12px; }
}

/* ===== Breadcrumb ===== */
.breadcrumb { padding-top: 12px; font-size: .85rem; color: var(--muted); }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.breadcrumb li + li::before { content: "／"; margin: 0 6px; color: var(--line-strong); }
.breadcrumb a { color: var(--muted); display: inline-block; padding: 10px 0; }

/* ===== Page head ===== */
.page-head { margin-bottom: 24px; }
.eyebrow { font-size: .85rem; color: var(--muted); margin: 0 0 4px; }
.lead { font-size: 1.05rem; color: var(--ink-soft); }
.page-dates { font-size: .85rem; color: var(--muted); margin: 0 0 16px; }
.fact-labels { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 24px; padding: 0; list-style: none; }
.fact-labels li { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 4px 10px; font-size: .88rem; background: var(--paper); }
.fact-labels li.is-organizer { background: var(--organizer); }
.fact-labels li.is-flag { border-color: var(--accent); color: var(--accent-ink); }

/* ラベル: 色だけに頼らず語で区別する */
.tag { display: inline-block; font-size: .78rem; line-height: 1.4; padding: 1px 6px; border: 1px solid currentColor; border-radius: 2px; white-space: nowrap; vertical-align: .1em; }
.tag-flag { color: var(--accent-ink); }
.tag-done { color: var(--muted); }
.tag-org { color: #36505C; background: var(--organizer); border-color: #A9BCC4; }

/* ===== Home ===== */
.home-hero { padding: 40px 0 16px; }
.home-hero h1 { max-width: none; }
.entry-rows { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); margin: 24px 0 0; }
.entry-row { display: grid; grid-template-rows: auto 1fr auto; gap: 4px; padding: 20px 24px 20px 0; text-decoration: none; color: var(--ink); min-height: 44px; }
.entry-row + .entry-row { border-left: 1px solid var(--line); padding-left: 24px; }
.entry-row .entry-kicker { font-size: .85rem; color: var(--muted); }
.entry-row .entry-title { font-size: 1.15rem; font-weight: 700; }
.entry-row .entry-desc { color: var(--ink-soft); margin: 0; }
.entry-row .entry-go { justify-self: start; font-weight: 700; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }
.entry-row:hover .entry-go { text-decoration-thickness: 2px; }
.entry-note { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: .95rem; color: var(--ink-soft); }
.entry-note a { display: inline-block; padding: 10px 0; }

.week-band { margin: 40px 0 0; border: 1px solid var(--ink); border-radius: var(--radius); padding: 20px 24px; }
.week-band-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 24px; }
.week-band-head h2 { border: 0; padding: 0; margin: 0; font-size: 1.15rem; }
.week-band-note { font-size: .88rem; color: var(--muted); margin: 0; }
.week-figure { margin: 16px 0; }
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-left: 1px solid var(--line); }
.week-grid div { border-right: 1px solid var(--line); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; }
.week-grid .d { display: block; font-family: var(--mono); font-size: .9rem; padding: 4px 0; border-bottom: 1px dashed var(--line); background: var(--planned); }
.week-grid .v { display: block; font-family: var(--mono); color: var(--muted); padding: 10px 0; }
.week-figure figcaption { font-size: .85rem; color: var(--muted); margin-top: 8px; }

.split-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; margin-top: 16px; }
.split-sections section h2 { font-size: 1.15rem; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { border-bottom: 1px solid var(--line); padding: 8px 0; }

/* ===== 行リンク（内部CTA 第1段階） ===== */
.row-links { list-style: none; padding: 0; margin: 16px 0; border-top: 1px solid var(--line); }
.row-links li { border-bottom: 1px solid var(--line); }
.row-links a { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 52px; padding: 8px 0; text-decoration: none; color: var(--ink); }
.row-links a::after { content: "→"; color: var(--accent); flex: none; }
.row-links a:hover .row-title { text-decoration: underline; text-decoration-color: var(--accent); }
.row-links .row-sub { display: block; font-size: .85rem; color: var(--muted); }

/* 機能CTA（第2段階）: 炭墨文字＋朱茶の左罫線 */
.tool-cta { display: flex; align-items: center; min-height: 52px; padding: 8px 16px; border-left: 4px solid var(--accent); background: var(--planned); color: var(--ink); font-weight: 700; text-decoration: none; margin: 16px 0; }
.tool-cta::after { content: "→"; margin-left: auto; padding-left: 16px; color: var(--accent); }
.tool-cta:hover { text-decoration: underline; }

/* ===== 定義表（受験票・講座条件） ===== */
.def-table { width: 100%; border-collapse: collapse; margin: 16px 0 24px; }
.def-table th, .def-table td { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 12px 10px 0; text-align: left; vertical-align: top; }
.def-table th { width: 9em; font-weight: 700; font-size: .92rem; color: var(--ink-soft); }
.def-table caption { text-align: left; font-weight: 700; padding-bottom: 8px; }
.ticket { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; border: 1px solid var(--ink); border-radius: var(--radius); padding: 8px 20px; background: var(--paper); }
.ticket .def-table { margin: 8px 0; }
.ticket .def-table tr:first-child th, .ticket .def-table tr:first-child td { border-top: 0; }
.ticket .def-table tr:last-child th, .ticket .def-table tr:last-child td { border-bottom: 0; }
.organizer-box { background: var(--organizer); border-radius: var(--radius); padding: 16px 20px; margin: 16px 0; }
.organizer-box > :last-child { margin-bottom: 0; }

.schedule-table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; }
.schedule-table th, .schedule-table td { border-bottom: 1px solid var(--line); padding: 8px 8px 8px 0; text-align: left; vertical-align: top; }
.schedule-table thead th { font-size: .85rem; color: var(--muted); font-weight: 400; border-bottom: 1px solid var(--ink); }
.schedule-table tr.is-past td { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* 年度照合タイムライン */
.timeline { list-style: none; padding: 0; margin: 24px 0; display: grid; grid-template-columns: repeat(4, 1fr); counter-reset: step; position: relative; }
.timeline::before { content: ""; position: absolute; left: 0; right: 0; top: 15px; border-top: 2px solid var(--ink); }
.timeline li { position: relative; padding: 36px 16px 0 0; counter-increment: step; }
.timeline li::before { content: counter(step); position: absolute; top: 0; left: 0; width: 32px; height: 32px; display: grid; place-items: center; background: var(--paper); border: 2px solid var(--ink); border-radius: 50%; font-family: var(--mono); font-weight: 700; }
.timeline .tl-title { display: block; font-weight: 700; }
.timeline .tl-desc { display: block; font-size: .9rem; color: var(--ink-soft); }

/* ===== 比較表 ===== */
.aligned-conditions { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 12px 20px; margin: 16px 0 24px; }
.aligned-conditions p { font-weight: 700; margin: 0 0 4px; }
.aligned-conditions ul { margin: 0; padding-left: 1.2em; }
.scroll-hint { display: none; font-size: .88rem; color: var(--ink-soft); margin: 0 0 8px; }
.comparison-scroll { overflow-x: auto; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.comparison-scroll:focus-visible { outline-offset: 4px; }
.comparison { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 720px; }
.comparison th, .comparison td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); background: var(--paper); font-size: .95rem; }
.comparison thead th { border-bottom: 1px solid var(--ink); vertical-align: bottom; }
.comparison .col-kind { display: block; font-size: .78rem; font-weight: 400; color: var(--muted); }
.comparison tbody th { font-weight: 700; color: var(--ink-soft); }
.comparison .item-col { position: sticky; left: 0; z-index: 1; width: 9.5em; min-width: 9.5em; border-right: 1px solid var(--line); }
.comparison tr:last-child th, .comparison tr:last-child td { border-bottom: 0; }
.comparison .row-organizer th, .comparison .row-organizer td { background: var(--organizer); }
.after-table-note { border-bottom: 1px solid var(--line); padding: 10px 0; margin: 0 0 24px; }

/* ===== 講座個別 ===== */
.meta-line { display: flex; flex-wrap: wrap; gap: 4px 20px; list-style: none; padding: 0; margin: 8px 0 24px; font-size: .9rem; color: var(--ink-soft); }
.meta-line b { font-weight: 700; color: var(--ink); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 16px 0 8px; }
.two-col section { border-top: 2px solid var(--ink); padding-top: 8px; }
.two-col section.is-open { border-top-color: var(--accent); }
.two-col h2 { border: 0; margin: 0 0 8px; padding: 0; font-size: 1.05rem; }
.two-col ul { margin: 0; padding-left: 1.2em; }
.official-box { border: 1px solid var(--ink); border-radius: var(--radius); padding: 16px 20px; margin: 40px 0 16px; }
.official-box h2 { border: 0; padding: 0; margin: 0 0 8px; font-size: 1.1rem; }
.official-box ul { margin: 8px 0 0; padding-left: 1.2em; }
.official-box li { padding: 4px 0; }
.official-box li { padding: 0; }
.official-box a { display: inline-flex; align-items: center; min-height: 44px; }

/* ===== 出典 ===== */
.sources { font-size: .9rem; color: var(--ink-soft); margin-top: 40px; }
.sources h2 { font-size: 1rem; }
.sources ol { padding-left: 1.4em; }
.sources li { margin-bottom: 0; }
.sources li a { display: inline-block; padding: 10px 0; }

/* ===== ツール ===== */
.study-form { margin: 24px 0 8px; }
.study-form fieldset { border: 1px solid var(--ink); border-radius: var(--radius); margin: 0; padding: 8px 20px 16px; }
.study-form legend { font-weight: 700; padding: 0 8px; }
.day-row { display: grid; grid-template-columns: 2.5em 96px 1.5em 1fr; align-items: center; gap: 4px 8px; min-height: 56px; border-bottom: 1px solid var(--line); padding: 6px 0; }
.day-row:last-of-type { border-bottom: 0; }
.day-row label { font-family: var(--mono); font-size: 1.1rem; font-weight: 700; }
.day-row input {
  width: 96px; min-height: 44px; font: inherit; font-family: var(--mono); font-size: 1.05rem; text-align: right;
  padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; color: var(--ink);
}
.day-row input[aria-invalid="true"] { border: 2px solid var(--error); background: var(--error-bg); }
.day-row .unit { font-size: .95rem; }
.day-row .day-state { font-size: .85rem; color: var(--muted); }
.day-row .day-state.is-entered { color: var(--ink); }
.day-row .field-error { grid-column: 2 / -1; color: var(--error); font-size: .88rem; margin: 0; }
.day-row .field-error:empty { display: none; }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0 0; }
.btn { min-height: 48px; padding: 0 20px; font: inherit; font-weight: 700; border-radius: var(--radius); cursor: pointer; }
.btn-primary { background: var(--ink); color: var(--paper); border: 1px solid var(--ink); }
.btn-secondary { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); }
.btn:disabled { cursor: not-allowed; opacity: .55; }
.result-band { border: 2px solid var(--ink); border-radius: var(--radius); padding: 12px 20px; margin: 16px 0; min-height: 64px; }
.result-band[data-status="idle"] { border-style: dashed; border-width: 1px; color: var(--muted); }
.result-band[data-status="error"] { border-color: var(--error); }
.result-heading { font-family: var(--mono); font-size: 1.15rem; font-weight: 700; margin: 0 0 4px; }
.result-band[data-status="error"] .result-heading { font-family: var(--font); color: var(--error); }
.result-lines { margin: 0; padding: 0; list-style: none; font-size: .95rem; }
.formula { background: var(--planned); border-radius: var(--radius); padding: 12px 16px; }

/* ===== 記事 ===== */
.article-list { list-style: none; padding: 0; margin: 16px 0; border-top: 1px solid var(--ink); }
.article-list li { border-bottom: 1px solid var(--line); padding: 16px 0; }
.article-list .q { display: block; font-size: .85rem; color: var(--muted); }
.article-list a.title { font-weight: 700; font-size: 1.1rem; display: inline-block; padding: 4px 0; }
.article-list .desc { margin: 4px 0 0; color: var(--ink-soft); font-size: .95rem; }
.byline { font-size: .9rem; color: var(--muted); }
.article-body h2 { scroll-margin-top: 16px; }
.article-body table { border-collapse: collapse; width: 100%; margin: 16px 0 24px; display: block; overflow-x: auto; }
.article-body th, .article-body td { border-bottom: 1px solid var(--line); padding: 8px 12px 8px 0; text-align: left; vertical-align: top; min-width: 7em; }
.article-body thead th { border-bottom: 1px solid var(--ink); }
.article-body blockquote { margin: 16px 0; padding: 8px 16px; border-left: 4px solid var(--accent); background: var(--planned); }
.article-body ol, .article-body ul { padding-left: 1.4em; }
.article-body li { margin-bottom: 6px; }
.article-body .steps, .steps { border: 1px solid var(--ink); border-radius: var(--radius); padding: 16px 20px 16px 2.4em; margin: 8px 0 24px; }
.steps li { margin-bottom: 6px; }
.steps li::marker { font-family: var(--mono); font-weight: 700; }
.faq-list details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq-list summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.faq-list details p { margin: 0 0 12px; color: var(--ink-soft); }
.related ul { list-style: none; padding: 0; }
.questions-list { counter-reset: q; list-style: none; padding: 0; margin: 8px 0 24px; }
.questions-list li { counter-increment: q; display: grid; grid-template-columns: 3em 1fr; border-bottom: 1px solid var(--line); padding: 10px 0; }
.questions-list li::before { content: "Q" counter(q, decimal-leading-zero); font-family: var(--mono); color: var(--accent-ink); font-weight: 700; }
.questions-group { margin-top: 24px; }
.questions-group h3 { margin-bottom: 0; }
.questions-group .to { font-size: .88rem; color: var(--muted); margin: 0; }

.note { font-size: .9rem; color: var(--muted); }
.info-table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; }
.info-table th, .info-table td { border-bottom: 1px solid var(--line); padding: 10px 12px 10px 0; text-align: left; vertical-align: top; }
.info-table th { width: 7em; color: var(--ink-soft); }

/* ===== Footer ===== */
.site-footer { border-top: 1px solid var(--ink); padding: 32px 0 24px; margin-top: 48px; font-size: .9rem; color: var(--ink-soft); }
.footer-top { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px 40px; }
.footer-name { font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.footer-desc, .footer-operator { margin-bottom: 8px; }
.footer-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; align-content: start; }
.footer-nav a { display: flex; align-items: center; min-height: 44px; color: var(--ink-soft); }
.footer-notice { border-top: 1px solid var(--line); padding-top: 12px; margin: 12px 0 0; }
.footer-copy { margin: 16px 0 0; color: var(--muted); }

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .container, .page, .page-wide { padding-left: 16px; padding-right: 16px; }
  h2 { font-size: 1.25rem; margin-top: 40px; }
  .entry-rows { grid-template-columns: 1fr; }
  .entry-row, .entry-row + .entry-row { padding: 16px 0; border-left: 0; }
  .entry-row + .entry-row { border-top: 1px solid var(--line); }
  .split-sections, .two-col, .ticket, .footer-top { grid-template-columns: 1fr; }
  .ticket { padding: 4px 16px; }
  .ticket .def-table + .def-table tr:first-child th, .ticket .def-table + .def-table tr:first-child td { border-top: 1px solid var(--line); }
  .timeline { grid-template-columns: 1fr; }
  .timeline::before { left: 15px; right: auto; top: 0; bottom: 0; border-top: 0; border-left: 2px solid var(--ink); }
  .timeline li { padding: 4px 0 16px 48px; }
  .scroll-hint { display: block; }
  .comparison .item-col { width: 6.5em; min-width: 6.5em; }
  .week-band { padding: 16px; }
  .def-table th { width: 7em; }
  .footer-nav { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .week-figure { display: none; }
  .study-form fieldset { padding: 8px 12px 16px; }
  .day-row { grid-template-columns: 2em 96px 1.4em minmax(0, 1fr); gap: 4px 6px; }
  .def-table th, .def-table td { display: block; width: auto; padding-right: 0; }
  .def-table th { border-bottom: 0; padding-bottom: 0; }
  .def-table td { border-top: 0; padding-top: 2px; }
}

@media print {
  .site-header, .site-footer, .breadcrumb, .skip-link { display: none; }
}

.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
