/* KANAU WORKS 記事共通スタイル（2026-09-12）
   方針: 公的文書の文法。紙の白・墨の文字・青い下線リンク・罫線の表・目次。
   カード/角丸/グラデーション/英字ラベルは使わない。
   書体は BIZ UDPGothic（モリサワUD・公的機関や教科書で使われる可読性重視の書体）。 */

:root {
  --paper: #ffffff;
  --paper2: #f6f7f8;
  --ink: #1f2328;
  --ink2: #3b4451;
  --sub: #5f6b7a;
  --rule: #d5dae0;
  --rule2: #b9c0c8;
  --link: #0b57c2;
  --brand: #12324f;
  --brand-ink: #ffffff;
  --mark: #b23a1d;
  --bg: var(--paper);
  --card: var(--paper);
  --border: var(--rule);
  --text: var(--ink);
  --accent: var(--brand);
  --muted: var(--sub);
  --shadow: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #16191d;
    --paper2: #1e2226;
    --ink: #e8eaed;
    --ink2: #c5cad1;
    --sub: #9aa3ae;
    --rule: #343a42;
    --rule2: #4a525c;
    --link: #7fb0ff;
    --brand: #dfe6ee;
    --brand-ink: #16191d;
    --mark: #f08a6a;
  }
}
:root[data-theme="dark"] {
  --paper: #16191d;
  --paper2: #1e2226;
  --ink: #e8eaed;
  --ink2: #c5cad1;
  --sub: #9aa3ae;
  --rule: #343a42;
  --rule2: #4a525c;
  --link: #7fb0ff;
  --brand: #dfe6ee;
  --brand-ink: #16191d;
  --mark: #f08a6a;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "BIZ UDPGothic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.9;
  font-size: 16px;
  font-feature-settings: "palt" 0;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 680px; margin: 0 auto; padding: 0 20px 72px; }

/* ── サイト帯（記事はここだけが共通のブランド面） ── */
.siteband {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0 12px; border-bottom: 1px solid var(--rule); margin-bottom: 28px;
}
.siteband a { color: var(--ink); text-decoration: none; }
.siteband .wordmark { font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.siteband .wordmark small { font-weight: 400; color: var(--sub); margin-left: 8px; font-size: 12px; }
.siteband .cluster { font-size: 13px; color: var(--sub); }
.siteband .cluster a { color: var(--sub); border-bottom: 1px solid var(--rule2); }

.crumb { font-size: 12.5px; color: var(--sub); margin-bottom: 14px; line-height: 1.6; }
.crumb a { color: var(--sub); text-decoration: none; border-bottom: 1px solid var(--rule2); }
.eyebrow { display: none; }

h1 {
  font-size: 25px; font-weight: 700; line-height: 1.5; margin: 0 0 12px;
  letter-spacing: 0; text-wrap: balance;
}
.meta { color: var(--sub); font-size: 13px; margin-bottom: 22px; line-height: 1.7; font-family: inherit; }
.meta time { font-variant-numeric: tabular-nums; }

/* リード（旧 .hero の置き換え） */
.hero, .lead {
  background: none; border: 0; border-radius: 0; padding: 0; margin: 0 0 22px;
  color: var(--ink2); font-size: 16.5px; font-weight: 400; position: static; overflow: visible;
}
.hero::after { content: none; }
.hero p, .lead p { color: var(--ink2); font-size: 16.5px; font-weight: 400; margin: 0; }
.hero .big, .lead .big { display: block; font-size: 18px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }

/* 目次 */
.toc {
  border: 1px solid var(--rule); background: var(--paper2);
  padding: 16px 20px 14px; margin: 0 0 34px;
}
.toc > p { font-size: 13px; font-weight: 700; color: var(--sub); margin: 0 0 6px; letter-spacing: .04em; }
.toc ol { margin: 0; padding-left: 1.6em; }
.toc li { font-size: 14.5px; line-height: 1.75; padding: 2px 0; }
.toc a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule2); }
.toc a:hover { color: var(--link); border-color: var(--link); }

/* 本文 */
.card { background: none; border: 0; border-radius: 0; padding: 0; margin: 0; box-shadow: none; }
h2 {
  font-size: 21px; font-weight: 700; line-height: 1.5; margin: 48px 0 16px;
  padding: 0 0 8px; border: 0; border-bottom: 2px solid var(--ink); border-left: 0;
  scroll-margin-top: 16px;
}
h2:first-child { margin-top: 0; }
h3 { font-size: 17px; font-weight: 700; margin: 28px 0 8px; line-height: 1.6; }
h3::before { content: ""; display: inline-block; width: 4px; height: 1em; background: var(--ink); vertical-align: -0.15em; margin-right: 10px; }
h4 { font-size: 16px; font-weight: 700; margin: 20px 0 6px; }
p, li { font-size: 16px; color: var(--ink); }
p { margin: 0 0 14px; }
ul, ol { padding-left: 1.5em; margin: 6px 0 16px; }
li { margin: 4px 0; }
li::marker { color: var(--sub); }
strong, b { font-weight: 700; }
a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
.note { color: var(--sub); font-size: 14px; }
small { font-size: 13px; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 32px 0; }

/* 表 */
.tablewrap { overflow-x: auto; margin: 14px 0 18px; }
table {
  width: 100%; border-collapse: collapse; margin: 14px 0 18px; font-size: 14.5px; line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
th, td { border: 1px solid var(--rule2); padding: 9px 10px; text-align: left; vertical-align: top; }
th { background: var(--paper2); font-weight: 700; white-space: nowrap; }
td.num, th.num { text-align: right; }
table caption { text-align: left; font-size: 13px; color: var(--sub); margin-bottom: 4px; caption-side: top; }

/* 囲み: 結論・注意・計算例（角丸なし・塗りなし・罫線で区別） */
.point, .calc, .box, .warn, .say, .todo, .check, .today, .summary {
  background: var(--paper2); border: 1px solid var(--rule); border-left: 4px solid var(--ink);
  border-radius: 0; padding: 14px 18px; margin: 16px 0 20px; font-size: 15px; line-height: 1.8;
}
.warn { border-left-color: var(--mark); }
.calc { font-variant-numeric: tabular-nums; }
.calc b { color: var(--ink); }
.summary > p:first-child, .point > b:first-child { font-weight: 700; }
.ng { color: var(--mark); font-weight: 700; }
.figure { margin: 18px 0; }
figcaption { color: var(--sub); font-size: 12.5px; margin-top: 6px; text-align: left; }

/* 数式ブロック（既存記事の .formula を平らに） */
.fbox { border-radius: 0; border: 1px solid var(--rule2); background: var(--paper); font-weight: 700; }
.fbox.accent { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.fbox.accent small { color: var(--brand-ink); opacity: .85; }
.thresh { border-radius: 0; background: var(--paper2); border: 1px solid var(--rule); }
.thresh .hl { color: var(--mark); }

/* アプリ紹介（旧 .cta を包む） */
.appcard {
  display: grid; grid-template-columns: 64px 1fr; gap: 14px 16px; align-items: center;
  border: 1px solid var(--rule2); padding: 18px 18px 16px; margin: 30px 0 10px; background: var(--paper);
}
.appcard img { width: 64px; height: 64px; border-radius: 14px; border: 1px solid var(--rule); display: block; }
.appcard .appname { font-weight: 700; font-size: 16px; line-height: 1.4; margin: 0; }
.appcard .appdesc { font-size: 13.5px; color: var(--sub); margin: 2px 0 0; line-height: 1.6; }
.appcard .cta { grid-column: 1 / -1; margin: 6px 0 0; }
.cta {
  background: var(--brand); color: var(--brand-ink); display: block; text-align: center;
  padding: 13px 16px; border-radius: 6px; font-weight: 700; text-decoration: none; margin: 18px 0 6px; font-size: 15px;
}
.cta:hover { opacity: .92; text-decoration: none; }
.cta-sub { text-align: center; color: var(--sub); font-size: 12.5px; margin-bottom: 8px; }
.cta-sub a { color: var(--sub); }

/* 参考・関連 */
.refs li, .sources li, .src { font-size: 13.5px; color: var(--sub); word-break: break-all; line-height: 1.7; }
.refs a, .sources a { color: var(--sub); }
.related a, .arts a {
  display: block; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; background: none;
  padding: 12px 0; margin: 0; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 15px;
}
.related a small, .arts a small { display: block; color: var(--sub); font-weight: 400; font-size: 12.5px; }
.related a:hover, .arts a:hover { color: var(--link); }

/* 書き手 */
.author {
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: 16px 0; margin: 40px 0 8px; font-size: 13.5px; color: var(--sub); line-height: 1.8;
}
.author b { color: var(--ink); }
.author a { color: var(--sub); }

footer { margin-top: 28px; display: flex; gap: 8px 18px; flex-wrap: wrap; font-size: 13px; }
footer a { color: var(--sub); text-decoration: none; border-bottom: 1px solid var(--rule2); }

@media (max-width: 480px) {
  .wrap { padding: 0 16px 60px; }
  h1 { font-size: 22px; }
  h2 { font-size: 19px; margin-top: 40px; }
  p, li { font-size: 15.5px; }
  table { font-size: 13.5px; }
  th, td { padding: 8px 8px; }
  .appcard { grid-template-columns: 56px 1fr; }
  .appcard img { width: 56px; height: 56px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media print { .siteband, footer, .appcard, .toc { display: none; } a { color: inherit; text-decoration: none; } }

/* English pages */
html[lang="en"] body { font-family: "IBM Plex Sans", -apple-system, "Segoe UI", sans-serif; line-height: 1.7; }
html[lang="en"] h1 { font-size: 30px; line-height: 1.25; letter-spacing: -0.01em; }
html[lang="en"] h2 { font-size: 23px; }
html[lang="en"] h3::before { display: none; }
html[lang="en"] h3 { font-size: 18px; }
html[lang="en"] p, html[lang="en"] li { max-width: 68ch; }
html[lang="en"] blockquote { margin: 16px 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--rule2); color: var(--ink2); font-size: 15.5px; }
html[lang="en"] blockquote cite { display: block; font-style: normal; font-size: 13px; color: var(--sub); margin-top: 6px; }
@media (max-width: 480px) { html[lang="en"] h1 { font-size: 25px; } html[lang="en"] h2 { font-size: 20px; } }
@media (max-width: 480px) { .siteband .wordmark small { display: none; } }
