/* EngNotes 共通スタイル
   意匠: 図面・データシートの体裁。角丸と影を使わず、細い罫線と等幅数字で組む。
   レイアウト: 単一カラム 920px。表題欄 → 章番号付きの節 → 改訂履歴 の順。 */

:root {
  --paper: #f1f1ef;
  --sheet: #ffffff;
  --sheet-2: #e9e9e5;
  --ink: #1a1a19;
  --ink-2: #4e4e49;
  --rule: #c2c2bb;
  --rule-strong: #84847d;
  --accent: #9c3326;          /* 朱。図面の赤入れ */
  --accent-soft: #f5e9e7;
  --on-accent: #ffffff;       /* 朱を背景に敷いたときの文字色 */
  --ok: #276048;
  --warn: #8a5600;
  --warn-soft: #f7efdf;

  --font-ui: "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #17171a;
    --sheet: #1e1e22;
    --sheet-2: #26262b;
    --ink: #e8e8e4;
    --ink-2: #aeaea7;
    --rule: #3c3c43;
    --rule-strong: #65656c;
    --accent: #e8897a;
    --accent-soft: #33221f;
    --on-accent: #1a1118;
    --ok: #74c49e;
    --warn: #d9a45c;
    --warn-soft: #2d2518;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #17171a;
  --sheet: #1e1e22;
  --sheet-2: #26262b;
  --ink: #e8e8e4;
  --ink-2: #aeaea7;
  --rule: #3c3c43;
  --rule-strong: #65656c;
  --accent: #e8897a;
  --accent-soft: #33221f;
  --on-accent: #1a1118;
  --ok: #74c49e;
  --warn: #d9a45c;
  --warn-soft: #2d2518;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.8;
}
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ---- ヘッダー ---- */
.sitebar { border-bottom: 1px solid var(--rule-strong); background: var(--sheet); }
.sitebar .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 20px;
  padding-block: 11px;
}
.brand {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .08em;
  text-decoration: none;
  color: var(--ink);
}
.brand span { color: var(--accent); }
.sitenav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  font-size: 13px;
  margin-left: auto;
  font-family: var(--font-mono);
}
.sitenav a { color: var(--ink-2); text-decoration: none; }
.sitenav a:hover { color: var(--accent); text-decoration: underline; }
.sitenav .current { color: var(--accent); }

/* ---- 表題欄（図面の体裁） ---- */
.titleblock {
  border: 1px solid var(--rule-strong);
  background: var(--sheet);
  margin-block: 26px 4px;
  display: grid;
  grid-template-columns: 1fr 210px;
}
@media (max-width: 560px) { .titleblock { grid-template-columns: 1fr; } }
.tb-main { padding: 15px 17px; border-right: 1px solid var(--rule); min-width: 0; }
@media (max-width: 560px) { .tb-main { border-right: none; border-bottom: 1px solid var(--rule); } }
.tb-main h1 {
  font-size: clamp(21px, 4.6vw, 27px);
  line-height: 1.35;
  margin: 0;
  letter-spacing: .05em;
}
.tb-main .site-sub { margin: 3px 0 0; color: var(--ink-2); font-size: 14px; letter-spacing: .08em; }
.tb-meta { display: grid; grid-template-columns: auto 1fr; margin: 0; font-size: 12px; font-family: var(--font-mono); }
.tb-meta dt {
  padding: 5px 9px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--rule);
  background: var(--sheet-2);
  white-space: nowrap;
}
.tb-meta dd {
  margin: 0;
  padding: 5px 10px;
  border-bottom: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
.tb-meta dt:last-of-type, .tb-meta dd:last-of-type { border-bottom: none; }

/* ---- 節 ---- */
section { padding-block: 26px 4px; }
h2 {
  font-size: 16px;
  margin: 0 0 14px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--rule-strong);
  letter-spacing: .06em;
}
h2 .num { font-family: var(--font-mono); color: var(--accent); margin-right: 10px; font-weight: 400; }
h3 { font-size: 14.5px; margin: 22px 0 6px; letter-spacing: .04em; }
h3::before { content: "— "; color: var(--accent); }
p { margin: 0 0 12px; max-width: 68ch; }

header.page { padding-block: 26px 4px; }
header.page h1 { font-size: clamp(21px, 4.6vw, 28px); line-height: 1.35; margin: 0 0 8px; letter-spacing: .04em; }
.standard-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 1px 7px;
  margin-bottom: 10px;
}
.lede { color: var(--ink-2); max-width: 62ch; margin: 0; }

/* ---- 表 ---- */
.table-scroll { overflow-x: auto; border: 1px solid var(--rule-strong); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; background: var(--sheet); }
caption { caption-side: bottom; font-size: 12px; color: var(--ink-2); text-align: left; padding: 7px 10px; }
th, td { padding: 7px 12px; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; }
thead th {
  background: var(--sheet-2);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--ink-2);
  border-bottom: 1px solid var(--rule-strong);
}
tbody th { text-align: left; font-weight: 400; }
tbody td { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: none; }

/* ツール索引 */
.index-table td, .index-table th { text-align: left; }
.index-table td.no { font-family: var(--font-mono); color: var(--ink-2); width: 1%; }
.index-table th[scope="row"] { font-weight: 700; }
.index-table th[scope="row"] a { text-decoration: none; }
.index-table th[scope="row"] a:hover { text-decoration: underline; }
.index-table .basis { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); white-space: normal; }
.index-table .state { font-family: var(--font-mono); font-size: 12px; width: 1%; }
.index-table tr.pending th[scope="row"], .index-table tr.pending td { color: var(--ink-2); }
.index-table tr.live td.state { color: var(--accent); }
@media (max-width: 620px) { .col-field { display: none; } }

dl.specs { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 5px 18px; font-size: 14px; }
dl.specs dt { color: var(--ink-2); font-family: var(--font-mono); }
dl.specs dd { margin: 0; }

/* ---- 計算パネル ---- */
.calc {
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.inputs { padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.results {
  padding: 20px;
  background: var(--sheet-2);
  border-left: 1px solid var(--rule-strong);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
}
@media (max-width: 680px) {
  .calc { grid-template-columns: 1fr; }
  .results { border-left: none; border-top: 1px solid var(--rule-strong); }
}
.field-label {
  display: block;
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: .06em;
  color: var(--ink-2);
  margin-bottom: 4px;
}
input[type="number"], select {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 16px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: 0;
}
input[type="number"]:focus-visible, select:focus-visible, .seg input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.pair { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 7px; }
.pair .times { color: var(--ink-2); padding-bottom: 9px; font-family: var(--font-mono); }

.seg { display: flex; border: 1px solid var(--rule-strong); }
.seg label { flex: 1; min-width: 0; position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block;
  text-align: center;
  padding: 8px 4px;
  font-size: 13.5px;
  cursor: pointer;
  background: var(--sheet);
  border-right: 1px solid var(--rule);
}
.seg label:last-child span { border-right: none; }
.seg input:checked + span { background: var(--accent); color: var(--on-accent); font-weight: 700; }

.readout-label { font-size: 12px; font-family: var(--font-mono); letter-spacing: .06em; color: var(--ink-2); }
.readout-main {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(32px, 8.5vw, 44px);
  font-weight: 500;
  line-height: 1.15;
  color: var(--ink);
  word-break: break-all;
}
.readout-main .unit { font-size: .42em; font-weight: 400; color: var(--ink-2); margin-left: 6px; }
.sub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 11px;
  border-top: 1px solid var(--rule);
  padding-top: 13px;
}
.readout-sub { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 16px; }

.note { font-size: 13px; padding: 9px 11px; line-height: 1.7; border-left: 3px solid currentColor; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.ok { background: transparent; color: var(--ok); }
.note.info { background: var(--accent-soft); color: var(--accent); }

figure.xsec { margin: 0; }
figure.xsec svg { display: block; width: 100%; height: auto; max-width: 100%; }
figcaption { font-size: 12px; color: var(--ink-2); margin-top: 3px; }

.formula {
  font-family: var(--font-mono);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  padding: 13px 15px;
  font-size: 14px;
  overflow-x: auto;
  margin: 0 0 13px;
}

/* ---- 改訂履歴 ---- */
.revision td, .revision th { white-space: normal; }
.revision td.rev, .revision td.date { white-space: nowrap; font-family: var(--font-mono); width: 1%; }

/* ---- その他 ---- */
.adslot {
  border: 1px dashed var(--rule-strong);
  padding: 20px 14px;
  text-align: center;
  color: var(--ink-2);
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: .14em;
  background: var(--sheet);
  margin-block: 26px 0;
}
.disclaimer {
  font-size: 13px;
  color: var(--ink-2);
  border: 1px solid var(--rule-strong);
  border-top: 3px solid var(--accent);
  padding: 13px 15px;
  background: var(--sheet);
}
.disclaimer strong { color: var(--ink); }

footer.site { border-top: 1px solid var(--rule-strong); background: var(--sheet); margin-top: 30px; }
footer.site .wrap { padding-block: 20px 30px; }
footer.site p { font-size: 13px; color: var(--ink-2); }
footer.site a { color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* 分野の小見出し（索引の区切り） */
h3.genre {
  font-size: 13px;
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: .12em;
  color: var(--ink-2);
  margin: 26px 0 7px;
  padding-bottom: 3px;
  border-bottom: 1px dotted var(--rule-strong);
}
h3.genre::before { content: none; }
h3.genre .code { color: var(--accent); margin-right: 10px; }
h3.genre.first { margin-top: 0; }