/* U&U AI ── 共通の地。
 *
 * 色は釉薬から取っている。素地・白磁・青磁・飴・墨。
 * ⚠️ **飴色（--ame）は「聞かずにやる」ところにしか出さない。**装飾に使うと意味が消える。
 * 囲い（--frame）は枠そのもの ── 既定の囲いが無い器は、枠が開く。
 */

:root {
  --soji:      #d9dcd5;   /* 素地 ── 地の色 */
  --soji-fuka: #c8ccc4;   /* 素地の陰 ── 罫・境 */
  --haku:      #f8f9f6;   /* 白磁 ── 面 */
  --sumi:      #1c2220;   /* 墨 ── 字 */
  --sumi-usu:  #5c6663;   /* 薄墨 ── 添え字 */
  --seiji:     #3f6d64;   /* 青磁 ── 主 */
  --seiji-usu: #a9c3ba;   /* 青磁の薄 */
  --seiji-kage:#eaf0ed;   /* 青磁の影 ── 面の淡い塗り */
  --ame:       #a4522a;   /* 飴 ── 聞かずにやる、囲いが無い、承認が無い */
  --ame-kage:  #f6ebe4;

  --mincho: "Hiragino Mincho ProN", "Yu Mincho", YuMincho, "Noto Serif JP", serif;
  --gothic: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", YuGothic,
            "Noto Sans JP", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;

  --w: 1120px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--soji);
  color: var(--sumi);
  font-family: var(--gothic);
  font-size: 15px;
  line-height: 1.85;
  font-feature-settings: "palt";
  text-underline-offset: .2em;
}

code {
  font-family: var(--mono);
  font-size: .88em;
  background: #0000000d;
  padding: .1em .35em;
  border-radius: 2px;
}

a { color: var(--seiji); }
b { font-weight: 700; }

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

/* ------------------------------------------------------------------ 骨 */

.wrap { max-width: var(--w); margin: 0 auto; padding: 0 24px; }

/* 見出しの上の細い札。**その節が何の話かを一語で置く** */
.rail {
  font-size: 11px;
  letter-spacing: .22em;
  color: var(--seiji);
  font-weight: 700;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.rail::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--soji-fuka);
}

h1, h2, h3 { font-weight: 400; margin: 0; }

h2.title {
  font-family: var(--mincho);
  font-size: clamp(24px, 3.4vw, 34px);
  line-height: 1.45;
  letter-spacing: .01em;
  margin: 0 0 6px;
}

.lede {
  color: var(--sumi-usu);
  max-width: 62ch;
  margin: 0 0 28px;
}

section { padding: 56px 0; border-top: 1px solid var(--soji-fuka); }
section:first-of-type { border-top: 0; }

/* --------------------------------------------------------------- 背表紙 */
/* 左端に立てた2枚の背。**2枚だから縦に並ぶ** ── タブもピルも「N枚ある」ための道具で、
 * 2枚には過剰だった。増えたら破綻するが、そのとき作り直す判断が強制されるのは、
 * 黙って10枚まで伸びる帯より良い。
 * ⚠️ **本文が下へ潜らないよう、body に同じ幅の余白を持たせる。** */

body { padding-left: 40px; }

.spine {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 40px;
  z-index: 40;
  background: var(--haku);
  border-right: 1px solid var(--soji-fuka);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
}
.spine .mark {
  writing-mode: vertical-rl;
  font-family: var(--mincho);
  font-size: 14px;
  letter-spacing: .12em;
  text-decoration: none;
  color: var(--sumi);
  white-space: nowrap;
}
.spine nav {
  margin: auto 0;              /* 残りの空きのちょうど真ん中へ */
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.spine nav a {
  writing-mode: vertical-rl;
  text-orientation: upright;   /* 日本語は倒さず立てる。倒すと背表紙ではなく回転した帯になる */
  font-size: 13px;
  letter-spacing: .1em;
  text-decoration: none;
  color: var(--seiji);
  background: #fff;
  border: 1px solid var(--seiji-usu);
  border-radius: 3px;
  padding: 12px 4px;
  white-space: nowrap;
}
.spine nav a:hover { border-color: var(--seiji); background: var(--seiji-kage); }
/* いま居る頁は**塗りで**示す。2枚だと上下の位置は手がかりにならない */
.spine nav a[aria-current] {
  background: var(--seiji);
  border-color: var(--seiji);
  color: var(--haku);
  font-weight: 700;
}

/* ------------------------------------------------------------------ 面 */

.card {
  background: var(--haku);
  border: 1px solid var(--soji-fuka);
  border-radius: 3px;
}

/* ---- 囲い。**枠が「既定の囲い」そのもの** ---------------------------- */

.frame { position: relative; border: 1.5px solid var(--seiji); border-radius: 3px; }
/* 囲いが無い器は、枠の上辺が抜ける。飾りではなく、抜けていることが値 */
.frame.is-open {
  border-color: var(--ame);
  border-top-style: dashed;
  border-top-color: #0000;
  background-image: linear-gradient(90deg, var(--ame) 0 18px, #0000 18px calc(100% - 18px),
                                    var(--ame) calc(100% - 18px) 100%);
  background-size: 100% 1.5px;
  background-repeat: no-repeat;
  background-position: top;
}

/* ---- 門。聞くなら閉じ、聞かないなら開く ------------------------------ */

.gate {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.gate i {
  width: 13px;
  height: 13px;
  flex: none;
  border: 1.5px solid var(--seiji);
  border-radius: 2px;
  position: relative;
}
.gate i::after {
  content: "";
  position: absolute;
  inset: 2px;
  background: var(--seiji);
  border-radius: 1px;
}
.gate.is-open i { border-color: var(--ame); border-left-color: #0000; }
.gate.is-open i::after { display: none; }
.gate.is-open { color: var(--ame); font-weight: 700; }
.gate.is-vague i { border-color: var(--soji-fuka); border-style: dotted; }
.gate.is-vague i::after { display: none; }
.gate.is-vague { color: var(--sumi-usu); }

/* ------------------------------------------------------------------ 表 */

.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* 横に続いていることは、言わないと分からない。**溢れている時だけ出す** */
.more {
  font-size: 11px;
  letter-spacing: .16em;
  color: var(--seiji);
  margin: 7px 0 0;
  text-align: right;
}

table.tbl {
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.7;
  min-width: 100%;
}
.tbl th, .tbl td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--soji-fuka);
}
/* ⚠️ **見出しを sticky にしない。**`.scroll` が横スクロールのために独自のスクロール容器に
 * なるので、`top` は画面ではなく**その枠の上端**から測られる ── 見出しが表の中へ
 * 押し下がって1行目を隠す。行数が12までの表なので、追従させる必要も無い */
.tbl thead th {
  background: var(--seiji-kage);
  border-bottom: 1.5px solid var(--seiji-usu);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--seiji);
  white-space: nowrap;
  vertical-align: bottom;
}
/* 束の見出し。**罫で括らず、字だけで示す** ── 線を足すと表が檻になる */
.tbl thead tr.grp th {
  background: var(--haku);
  border-bottom: 0;
  padding: 12px 12px 2px;
  font-size: 10px;
  letter-spacing: .2em;
  color: var(--sumi-usu);
  font-weight: 700;
  box-shadow: inset 0 -1px 0 var(--soji-fuka);
}
.tbl thead tr.grp th:empty { box-shadow: none; }

/* 単位は見出しの2行目に落とす。**軸の名前と単位は別のもの** */
.tbl thead th u {
  display: block;
  font-weight: 400;
  font-size: 10px;
  letter-spacing: .06em;
  color: var(--sumi-usu);
  text-decoration: none;
}
.tbl tbody tr:hover { background: #ffffffb3; }
.tbl td:first-child, .tbl th:first-child {
  position: sticky;
  left: 0;
  background: var(--haku);
  font-weight: 700;
  font-size: 13.5px;
  z-index: 1;
  box-shadow: 1px 0 0 var(--soji-fuka);
}
.tbl thead th:first-child { background: var(--seiji-kage); z-index: 3; }
.tbl tbody tr:hover td:first-child { background: #fff; }
.tbl td.num {
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.tbl .none { color: var(--soji-fuka); }

/* 軸の読み方を開く見出し */
.tbl thead th button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: flex-end;
  gap: 5px;
  text-align: left;
}
.tbl thead th button > span { display: block; }
.tbl thead th button::after {
  content: "?";
  width: 13px;
  height: 13px;
  border: 1px solid var(--seiji-usu);
  border-radius: 999px;
  font-size: 9px;
  line-height: 11px;
  text-align: center;
  flex: none;
}
.tbl thead th button:hover::after { background: var(--seiji); color: var(--haku); }

/* 値の札 */
.pill {
  display: inline-block;
  font-size: 10.5px;
  line-height: 1.65;
  padding: 0 6px;
  border: 1px solid var(--seiji-usu);
  border-radius: 999px;
  color: var(--seiji);
  background: #fff;
  margin: 1px 2px 1px 0;
  white-space: nowrap;
}
.pill.is-open { border-color: var(--ame); color: var(--ame); background: var(--ame-kage); }

/* ------------------------------------------------------------------ 軸の読み方 */

.reading {
  margin: 0;
  padding: 18px 20px;
  background: var(--seiji-kage);
  border-left: 2px solid var(--seiji);
  font-size: 13.5px;
  line-height: 1.9;
}
.reading[hidden] { display: none; }
.reading .who {
  display: block;
  font-size: 11px;
  letter-spacing: .18em;
  color: var(--seiji);
  font-weight: 700;
  margin-bottom: 4px;
}

.notes { margin: 22px 0 0; padding: 0; list-style: none; }
.notes li {
  font-size: 13px;
  color: var(--sumi-usu);
  line-height: 1.9;
  padding-left: 16px;
  border-left: 1px solid var(--soji-fuka);
  margin-bottom: 12px;
}
.notes b { color: var(--sumi); }

/* ------------------------------------------------------------------ 下 */

.foot {
  border-top: 1px solid var(--soji-fuka);
  padding: 36px 0 60px;
  font-size: 12.5px;
  color: var(--sumi-usu);
}
.foot a { color: var(--seiji); }

/* ------------------------------------------------------------------ 小さい画面 */

@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .wrap { padding: 0 16px; }
  section { padding: 40px 0; }
  .tbl th, .tbl td { padding: 9px 10px; }

  /* 縦に立てる幅が無いので、**下端の横帯へ倒す。**縦組みは解除する */
  body { padding-left: 0; padding-bottom: 54px; }
  .spine {
    top: auto; right: 0; bottom: 0;
    width: auto; height: 54px;
    flex-direction: row;
    justify-content: space-between;
    padding: 0 14px;
    border-right: 0;
    border-top: 1px solid var(--soji-fuka);
  }
  .spine .mark, .spine nav a { writing-mode: horizontal-tb; text-orientation: mixed; }
  .spine .mark { font-size: 15px; letter-spacing: .04em; }
  .spine nav { margin: 0; flex-direction: row; gap: 6px; }
  .spine nav a { padding: 5px 13px; border-radius: 999px; }
}

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