/* グラフと図（scripts/charts.mjs・insights.mjs・figures.mjs が書き出す）。しゃぼん玉のデザインの台紙の上に載せる */
:root { --c-seq: #2F7BD0; --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c-mute: #c9d6e2; --c-grid: #e3ecf4; }
@media (prefers-color-scheme: dark) { :root { --c-seq: #74B6F0; --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c-mute: #3a4f64; --c-grid: #24364a; } }
.c1 { background: var(--c1); } .c2 { background: var(--c2); } .c3 { background: var(--c3); } .mute { background: var(--c-mute); }
.ek0 { background: var(--acid); } .ek1 { background: var(--acid2); } .ek2 { background: var(--neu); } .ek3 { background: var(--alk2); } .ek4 { background: var(--alk); }

/* 図の枠 */
.fig { margin: 16px 0; padding: 14px 14px 12px; border-radius: var(--r); background: var(--surface); box-shadow: var(--sheet-sh); }
.fig figcaption { margin: 0 0 10px; }
.fig figcaption b { display: block; font-family: "M PLUS Rounded 1c", sans-serif; font-size: 1rem; line-height: 1.45; }
.fig figcaption span { display: block; font-size: .78rem; color: var(--muted); margin-top: 2px; }
.fig-src { margin: 10px 0 0; font-size: .7rem; color: var(--muted); }
.figs { display: grid; gap: 12px; }
@media (min-width: 720px) { .figs.two { grid-template-columns: 1fr 1fr; } .figs.two .fig { margin: 0; } }

/* 大きな数字 */
.fstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.fstat { padding: 10px 8px; border-radius: var(--r-s); background: var(--surface-2); text-align: center; }
.fstat b { display: block; font: 800 1.6rem/1.1 "M PLUS Rounded 1c", sans-serif; color: var(--ink); font-variant-numeric: tabular-nums; }
.fstat b em { font-style: normal; font-size: .55em; margin-left: 1px; }
.fstat span { display: block; font-size: .74rem; font-weight: 700; margin-top: 4px; }
.fstat small { display: block; font-size: .66rem; color: var(--muted); }

/* 横棒 */
.hb { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hb li { display: grid; grid-template-columns: minmax(6.5em, 34%) 1fr auto; gap: 8px; align-items: center; font-size: .8rem; }
.hb-l { overflow-wrap: anywhere; line-height: 1.35; }
.hb-l a { color: var(--ink); text-decoration: none; }
.hb-b { height: 12px; border-radius: 0 6px 6px 0; background: var(--c-grid); overflow: hidden; }
.hb-b i { display: block; height: 100%; background: var(--c-seq); border-radius: 0 6px 6px 0; opacity: .55; }
.hb li.hi .hb-b i { opacity: 1; }
.hb li.hi .hb-l { font-weight: 800; }
.hb-v { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 3.4em; text-align: right; }
/* 名前の長い横棒（界面活性剤の名前など）：名前を棒の上に出す */
.hb.hb-stack { gap: 9px; }
.hb.hb-stack li { grid-template-columns: 1fr auto; row-gap: 3px; }
.hb.hb-stack .hb-l { grid-column: 1 / -1; }
/* 行ごとの棒の長さをそろえる（値の文字の幅で棒がずれないように） */
@supports (grid-template-columns: subgrid) {
  .hb { grid-template-columns: minmax(6.5em, 34%) 1fr auto; column-gap: 8px; }
  .hb li { grid-column: 1 / -1; grid-template-columns: subgrid; }
  .hb.hb-stack { grid-template-columns: 1fr auto; }
  .hb.hb-stack li { grid-template-columns: subgrid; }
}

/* 内訳の帯 */
.stk { display: flex; height: 18px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--surface); }
.stk i { display: block; height: 100%; }
.stk-l { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .78rem; }
.stk-l li { display: inline-flex; align-items: center; gap: 5px; }
.stk-l i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.stk-l b { font-variant-numeric: tabular-nums; }
.stk-l span { color: var(--muted); font-size: .7rem; }

/* 分布の柱 */
.hs-cols { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 96px; border-bottom: 1.5px solid var(--c-grid); }
.hs-cols i { flex: 1; background: var(--c-seq); opacity: .4; border-radius: 4px 4px 0 0; min-height: 1px; }
.hs-m { position: absolute; bottom: -7px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--c2); border: 2px solid var(--surface); }
.hs-n { display: flex; gap: 2px; margin-top: 11px; font-size: .64rem; line-height: 1.2; color: var(--muted); font-variant-numeric: tabular-nums; }
.hs-n span { flex: 1; min-width: 0; text-align: center; }
.hs-n + .hs-ax { margin-top: 3px; }
.hs-cols:has(.hs-m) + .hs-n { margin-top: 14px; }
.hs-ax { display: flex; justify-content: space-between; font-size: .68rem; color: var(--muted); margin-top: 8px; }
.hs-k { margin: 6px 0 0; font-size: .72rem; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.hs-mk { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c2); }

/* 2つを並べる */
.pr2-k { display: flex; gap: 16px; margin: 0 0 8px; font-size: .8rem; font-weight: 700; }
.pr2-k i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.pr2-r { padding: 8px 0; border-top: 1px solid var(--c-grid); }
.pr2-r > b { display: block; font-size: .8rem; margin-bottom: 4px; }
.pr2-b { display: grid; grid-template-columns: 1fr 4.6em; gap: 8px; align-items: center; margin: 3px 0; }
.pr2-b i { display: block; height: 11px; border-radius: 0 6px 6px 0; min-width: 0; }
.pr2-b span { font-size: .78rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* 説明の図（scripts/figures.mjs の SVG）。文字は端末の文字で、色はここの決まりに合わせる */
.dg { display: block; width: 100%; height: auto; max-width: 640px; margin: 0 auto; }
.dg text { font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif; fill: var(--ink); }
.dg .mut { fill: var(--muted); }
.dg .ln { stroke: var(--ink); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dg .lnm { stroke: var(--muted); fill: none; stroke-width: 1.5; stroke-dasharray: 4 4; }
.dg .f1 { fill: var(--c1); } .dg .f2 { fill: var(--c2); } .dg .f3 { fill: var(--c3); } .dg .fs { fill: var(--surface-2); } .dg .fp { fill: var(--primary-soft); }
.dg .s1 { stroke: var(--c1); } .dg .s2 { stroke: var(--c2); } .dg .s3 { stroke: var(--c3); }
/* 読みものの冒頭の絵 */
.g-hero { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r); background: #fff; box-shadow: var(--sheet-sh); margin: 12px 0 4px; }
