/* =========================================================
   article-base.css — 記事HTML が読み込む共通スタイル
   記事側は <link rel="stylesheet" href="../assets/article-base.css"> の1行でよい。
   教科色は記事の <body data-subject="算数"> で切り替わる。
   ========================================================= */

:root {
  --ink: #22313f;
  --ink-soft: #5d7184;
  --line: rgba(34, 49, 63, .10);
  --shadow: 0 8px 24px rgba(34, 49, 63, .07);
  --sc: #6B7280;        /* subject color */
  --sc-light: #f1f3f5;
  --sc-deep: #3f4750;
}

body[data-subject="国語"]   { --sc: #E8544B; --sc-light: #FDEDEC; --sc-deep: #9c2f28; }
body[data-subject="算数"]   { --sc: #3B82D6; --sc-light: #E8F1FE; --sc-deep: #1d4f8c; }
body[data-subject="理科"]   { --sc: #2FAE6B; --sc-light: #E6F7EE; --sc-deep: #1a6b41; }
body[data-subject="社会"]   { --sc: #E89A2B; --sc-light: #FDF3E3; --sc-deep: #96600f; }
body[data-subject="生活"]   { --sc: #E56A9B; --sc-light: #FDEEF4; --sc-deep: #a13565; }
body[data-subject="英語"]   { --sc: #8B5CF6; --sc-light: #F1EBFE; --sc-deep: #5b32b8; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Hiragino Sans", "Meiryo", sans-serif;
  font-size: 18px;
  line-height: 1.95;
  color: var(--ink);
  background: #f6f8fb;
}

.page { max-width: 860px; margin: 0 auto; padding: 22px 16px 56px; }

/* ---- 見出し ---- */
.hero {
  background: linear-gradient(135deg, var(--sc-light), #fff);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  font-size: .85rem; font-weight: 800;
  color: #fff; background: var(--sc);
  border-radius: 999px; padding: 4px 14px;
}
.chip.plain { background: #fff; color: var(--sc-deep); border: 2px solid var(--sc-light); }

h1 {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 4.5vw, 2.2rem);
  line-height: 1.4;
  color: var(--sc-deep);
}
.lead { margin: 0; font-size: 1.02rem; color: var(--ink); }

section {
  background: #fff;
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
h2 {
  margin: 0 0 14px;
  font-size: 1.3rem;
  color: var(--sc-deep);
  padding-bottom: 8px;
  border-bottom: 3px solid var(--sc-light);
}
h3 { margin: 20px 0 8px; font-size: 1.08rem; color: var(--sc-deep); }
p  { margin: 0 0 14px; }
p:last-child { margin-bottom: 0; }

/* ---- 部品 ---- */
.note {
  background: var(--sc-light);
  border-left: 6px solid var(--sc);
  border-radius: 14px;
  padding: 14px 18px;
  margin: 16px 0;
}
.note.warn { background: #fff4e5; border-left-color: #e8912b; }
.note.tip  { background: #e9f7ef; border-left-color: #2fae6b; }
.note p:last-child { margin-bottom: 0; }
.note .label { font-weight: 800; display: block; margin-bottom: 4px; color: var(--sc-deep); }
.note.warn .label { color: #96600f; }
.note.tip  .label { color: #1a6b41; }

ul, ol { margin: 0 0 14px; padding-left: 1.4em; }
li { margin-bottom: 8px; }

.steps { list-style: none; padding: 0; counter-reset: st; }
.steps > li {
  position: relative;
  counter-increment: st;
  background: #fff;
  border: 2px solid var(--sc-light);
  border-radius: 14px;
  padding: 14px 16px 14px 56px;
  margin-bottom: 10px;
}
.steps > li::before {
  content: counter(st);
  position: absolute;
  left: 14px; top: 12px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--sc);
  color: #fff;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}

.calc {
  font-family: "Consolas", "Courier New", monospace;
  background: #f8fafc;
  border: 2px solid var(--sc-light);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 1.05rem;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
  margin: 12px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: .96rem;
}
.table-wrap { overflow-x: auto; }
th, td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; }
th { background: var(--sc-light); color: var(--sc-deep); font-weight: 800; }

.qa {
  border: 2px dashed var(--sc);
  border-radius: 16px;
  padding: 16px 18px;
  margin: 14px 0;
  background: #fff;
}
.qa .q { font-weight: 800; color: var(--sc-deep); margin-bottom: 6px; }
.qa .a { margin: 0; }

.summary-box { background: linear-gradient(180deg, #fff, var(--sc-light)); }

ruby rt { color: var(--ink-soft); font-size: .58em; font-weight: 400; }

@media (max-width: 599px) {
  body { font-size: 17px; }
  .page { padding: 14px 12px 32px; }
  .hero, section { padding: 17px; border-radius: 16px; }
}
