:root{
  /* 空きの段：基準 1rem、比 1.5（欧文の行の高さの目安 1.5 と同じ比。和文の本文の行送りは 1.9 で、縦の空きは下の --u を使う）。Refactoring UI の 4〜768 の表と近い帯 */
  --ratio:1.5;
  --s-2:calc(var(--s-1) / var(--ratio));
  --s-1:calc(var(--s0) / var(--ratio));
  --s0:1rem;
  --s1:calc(var(--s0) * var(--ratio));
  --s2:calc(var(--s1) * var(--ratio));
  --s3:calc(var(--s2) * var(--ratio));
  --s4:calc(var(--s3) * var(--ratio));
  --s5:calc(var(--s4) * var(--ratio));
  /* 一行の長さ。欧文 50ch（下の注）。和文は 30 字＝30ic（ic＝全角「水」の幅。ch は「0」の幅で全角の約半分しかなく、
     30ch は 15〜20 字にしかならない：研究/ウェブ_Bringhurst_組版の原則_要点.md）。ic が使えない時は 30em */
  /* 欧文は 50ch（実際の欧文の書体で 62〜70 字。60ch は 74〜84 字で上限 75 字を超えた） */
  --measure:50ch;
  --measure-ja:30em;
  --border-thin:1px;
  --gutter:var(--s1);
  /* 縦の単位＝本文の行送り（2026.10.31 なおさん「右で入れる」：layout/compare-u.html）。
     縦の空き・見出しの行の高さ・本文の横の写真の窓・段の間は、すべて --u の整数倍にする（Grid Systems・Bringhurst）。
     半行の空きは入れない（隣の欄の行がずれる）。--s の段は横の空きと枠の内側に使う */
  --u:calc(1rem * 1.9);
  --sec:calc(var(--u) * 5);              /* 段の間 5 行（16px で 152px） */
  --lh-head:calc(var(--u) * 2);          /* 見出し 1 行＝2 行ぶん */
  --lh-cap:calc(var(--u) * 2 / 3);       /* キャプション 3 行で本文 2 行 */
}
@supports (inline-size:1ic){:root{--measure-ja:30ic}}
@supports (inline-size:1rlh){:root{--u:1rlh}}   /* 根の行送りに付いて動く（サイトが line-height を変えても揃う） */
:where(html){line-height:1.9;font-synthesis:none}  /* 読み込んでいない太さ・斜体をブラウザに作らせない */
:where(em,i):lang(ja){font-style:normal}           /* 和文に斜体は無い */
*,*::before,*::after{box-sizing:border-box}
img,video{max-inline-size:100%;display:block}

/* 全部の字のかたまりに行の長さの上限。例外を外す方式（付け漏れが無い） */
:where(p,h1,h2,h3,h4,h5,h6,li,figcaption,blockquote){max-inline-size:var(--measure)}
/* 要素自身の言語で見る（:lang(ja) を祖先に書くと、和文の頁の中の <p lang="en"> まで和文の幅に縮む） */
:where(p,li,figcaption,blockquote):lang(ja){max-inline-size:var(--measure-ja)}

/* ---------- 和文の組版（2026.11.01 なおさん「推しどおり全部」：layout/compare-k.html の右） ----------
   出典：研究/組版_エディタースクール_文字組版_要点.md §4 の K1〜K5（Chrome 156・WebKit で測って確かめた） */
/* K1 強い禁則：行頭に小書きのかな（ゃゅょっ）と長音（ー）を置かない。既定（auto）は両方のブラウザとも置く */
:where(p,li,dt,dd,figcaption,blockquote,h1,h2,h3,h4,h5,h6,th,td):lang(ja){line-break:strict}
/* 和文を語の途中で折らない決まりは、ここではなく wrap/wrap.css（html.l-wbr の keep-all）と wrap/wbr.py の組。layout.css だけ読んで keep-all をセレクタごとに書き足さないこと（尚真 2026.11.12：本文・li・dd・td に効かず 164 か所で語の途中が折れた） */
/* K2 和欧の間：和文と英数字の間に 1/8 字（四分ではない）。手で空白を打たない */
:where(html):lang(ja){text-autospace:normal}
/* K2 本文はベタ。詰め（palt）は見出し・札・短い説明に付ける .l-palt だけ */
:where(p,li,dd,figcaption,blockquote):lang(ja){font-feature-settings:normal}
.l-palt{font-feature-settings:"palt"}
/* K2+ 本文を本当のベタに：ヒラギノは既定でかなにも kern を掛ける（20 字の行が 2px 前後短い）。和文の段落の中の英字の詰めも止まる */
:where(p,li,dd,figcaption,blockquote):lang(ja){font-kerning:none}

/* Stack：縦に空きを入れる。margin は親の文脈で決める（最後の余白が二重にならない） */
.l-stack{display:flex;flex-direction:column;justify-content:flex-start}
.l-stack>*{margin-block:0}
.l-stack>*+*{margin-block-start:var(--space,var(--u))}
.l-stack.l-recursive *+*{margin-block-start:var(--space,var(--u))}
/* 行に乗る字の型：見出しは 2 行ぶん、キャプションは写真から 1/3 行空けて 2/3 行の送り（下の余りは snap.js が足して次を行に戻す） */
/* K4（2026.11.01）：snap.js が動くと（html.l-snap）見出しは自然な行送り 1.4 で組み、帯を u の整数倍に切り上げて余りを上下に半分ずつ。
   2 行の見出しが 1 行ずつ 2u に間延びしない。1 行の見出しは今までどおり 2u の帯の真ん中。snap.js が無い時は 1 行＝2u のまま */
.l-head{line-height:var(--lh-head)}
html.l-snap .l-head{line-height:1.4}
.l-lead{line-height:var(--u)}
.l-cap{line-height:var(--lh-cap)}
.l-stack>.l-cap{margin-block-start:calc(var(--u) / 3)}
.l-section{margin-block-start:var(--sec)}
.l-stack>.l-split{margin-block-end:auto}

/* Box：内側の余白と枠（四辺か無し）。.l-invert で明暗反転 */
.l-box{--color-light:#fff;--color-dark:#000;padding:var(--box-pad,var(--s1));border:var(--border-thin) solid;
  outline:var(--border-thin) solid transparent;outline-offset:calc(var(--border-thin) * -1);
  color:var(--color-dark);background-color:var(--color-light)}
.l-box *{color:inherit}
.l-box.l-invert{color:var(--color-light);background-color:var(--color-dark)}
.l-box.l-borderless{border-width:0}

/* Center：幅の上限で中央の列。左右に最小の余白 */
.l-center{box-sizing:content-box;max-inline-size:var(--measure);margin-inline:auto;padding-inline:var(--gutter)}
.l-center.l-intrinsic{display:flex;flex-direction:column;align-items:center}

/* K5 行の長さを字の整数倍に（親が 30 字より狭い時、右にだけ残る 1 字未満の余りを消す）。左揃えの本文の欄には付けない（左の線が動く）。
   .l-ic：どこにでも付けられる丸め。
   .l-box（和文）：中の字のかたまりを丸めた幅にし、余りを左右に半分ずつ（箱の左右の余白がそろう）。ずらしは根の字の幅 1ric で測るので、見出しと本文の左の線は同じ。
   .l-center（和文）：欄そのものの幅を字の整数倍に丸めて真ん中へ（中の字は左揃えのまま） */
.l-ic{max-inline-size:var(--measure-ja)}
@supports (max-inline-size:round(down, 100%, 1ric)){
  .l-ic{max-inline-size:min(var(--measure-ja), round(down, 100%, 1ic))}
  :where(.l-box):lang(ja)>:where(p,h1,h2,h3,h4,h5,h6,figcaption,blockquote,ul,ol,dl){margin-inline-start:calc((100% - round(down, 100%, 1ric)) / 2)}
  :where(.l-box):lang(ja)>:where(p,figcaption,blockquote,ul,ol,dl){max-inline-size:min(var(--measure-ja), round(down, 100%, 1ric))}
  .l-center:lang(ja){max-inline-size:round(down, min(var(--measure), 100% - var(--gutter) * 2), 1ic)}
}

/* Cluster：折り返す並び（ボタン・タグ・ヘッダーのロゴとナビ） */
.l-cluster{display:flex;flex-wrap:wrap;gap:var(--space,var(--s1));justify-content:var(--justify,flex-start);align-items:var(--align,center)}

/* Sidebar：横の小さな列。主が 50% 以下になる幅で、自分から縦に折り返す（ブレークポイント無し） */
.l-with-sidebar{display:flex;flex-wrap:wrap;gap:var(--gutter)}
.l-with-sidebar>:first-child{flex-basis:var(--side-width,20rem);flex-grow:1}
.l-with-sidebar>:last-child{flex-basis:0;flex-grow:999;min-inline-size:var(--content-min,50%)}
.l-with-sidebar.l-side-right>:first-child{flex-basis:0;flex-grow:999;min-inline-size:var(--content-min,50%)}
.l-with-sidebar.l-side-right>:last-child{flex-basis:var(--side-width,20rem);flex-grow:1}
.l-with-sidebar.l-no-stretch{align-items:flex-start}

/* Switcher：同格の物を、横一列か縦一列のどちらかに（しきい値は親の幅。5 個以上は常に縦） */
.l-switcher{display:flex;flex-wrap:wrap;gap:var(--gutter);--threshold:30rem}
.l-switcher>*{flex-grow:1;flex-basis:calc((var(--threshold) - 100%) * 999)}
.l-switcher>:nth-last-child(n+5),.l-switcher>:nth-last-child(n+5)~*{flex-basis:100%}

/* Cover：画面を覆い、主役を縦の中央に。上・下の要素は有っても無くても崩れない */
.l-cover{display:flex;flex-direction:column;min-block-size:var(--cover-min,100svh);padding:var(--space,var(--s1))}
.l-cover>*{margin-block:var(--s1)}
.l-cover>:first-child:not(.l-centered){margin-block-start:0}
.l-cover>:last-child:not(.l-centered){margin-block-end:0}
.l-cover>.l-centered{margin-block:auto}
/* 上寄り（2026.11.01）：主役の上と下の空きを 2:3（下が上の 1.5 倍）に分け、版面をやや上に寄せる（Bringhurst 8.4・8.5）。
   1440×900 で主役の中心が上から 44%、390×844 で 43%（layout/compare-cover.html）。比は --high-top・--high-bot で変えられる（1:2 で 40%前後） */
.l-cover.l-high{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(var(--s1),var(--high-top,2fr)) auto minmax(var(--s1),var(--high-bot,3fr)) auto}
.l-cover.l-high>*{margin-block:0}
.l-cover.l-high>:first-child:not(.l-centered){grid-row:1}
.l-cover.l-high>.l-centered{grid-row:3}
.l-cover.l-high>:last-child:not(.l-centered){grid-row:5}

/* Grid：auto-fit＋min()。親が狭くてもはみ出さない */
.l-grid{display:grid;gap:var(--gutter);--minimum:20ch}
@supports (width:min(var(--minimum),100%)){
  .l-grid{grid-template-columns:repeat(auto-fit,minmax(min(var(--minimum),100%),1fr))}
}

/* Frame：比率の窓。子は 1 つ（img／video／何でも） */
.l-frame{--n:16;--d:9;aspect-ratio:var(--n) / var(--d);overflow:hidden;display:flex;justify-content:center;align-items:center}
.l-frame>img,.l-frame>video{inline-size:100%;block-size:100%;object-fit:cover;object-position:var(--focus,50% 50%)}
.l-frame.l-4x5{--n:4;--d:5}.l-frame.l-1x1{--n:1;--d:1}.l-frame.l-21x9{--n:21;--d:9}
.l-frame.l-2x3{--n:2;--d:3}.l-frame.l-3x2{--n:3;--d:2}   /* 2:3＝完全 5 度・35mm の形（2026.11.01） */
/* 本文の横に並べる窓は、高さを行の数で決める（幅が変わっても上下が行に乗る）。全幅の写真は比のままでよい。
   --rows は 1 枠 m 行・n 枠またぎなら n×m＋(n−1)。例：6 行の枠を 2 つ＝13 */
.l-frame.l-rows{aspect-ratio:auto;block-size:calc(var(--u) * var(--rows,9))}
/* K3（2026.11.01）：写真と本文が横に並ぶ所だけに付ける印。写真の上辺・下辺を、隣の本文の字の頭・字の足にそろえる（字面でそろえる）。
   窓を半行間ずつ内側へ：高さ＝(行数−1)×u＋1 字、上下に半行間。外側の高さは rows×u のままなので、本文も後ろの段も行の線に乗ったまま。
   1em は本文の字の大きさ（窓の font-size を本文と同じに）。Sidebar・grid の行の中で使い、Stack の直下には置かない（Stack の空きと重なる） */
.l-frame.l-rows.l-trim{block-size:calc(var(--u) * (var(--rows,9) - 1) + 1em);margin-block:calc((var(--u) - 1em) / 2)}

/* Reel：横にスクロールする列（使うなら 1 か所。右端を切って見せる） */
.l-reel{display:flex;block-size:var(--reel-height,auto);overflow-x:auto;overflow-y:hidden;--item-width:25ch}
.l-reel>*{flex:0 0 var(--item-width)}
.l-reel>*+*{margin-inline-start:var(--space,var(--s0))}
.l-reel>img{block-size:100%;flex-basis:auto;inline-size:auto}
.l-reel.l-no-bar{scrollbar-width:none}.l-reel.l-no-bar::-webkit-scrollbar{display:none}

/* Imposter：重ねる。寸法を知らずに中央に置ける。z-index に頼らずソース順 */
.l-imposter{position:var(--positioning,absolute);inset-block-start:50%;inset-inline-start:50%;transform:translate(-50%,-50%)}
.l-imposter.l-contain{--margin:0px;overflow:auto;max-inline-size:calc(100% - var(--margin) * 2);max-block-size:calc(100% - var(--margin) * 2)}
.l-imposter.l-fixed{--positioning:fixed}

/* Icon：字と並ぶ SVG。大文字の高さに合わせ、ベースラインに置く */
.l-icon{inline-size:.75em;block-size:.75em;inline-size:1cap;block-size:1cap}
.l-with-icon{display:inline-flex;align-items:baseline}
.l-with-icon>.l-icon{margin-inline-end:var(--space,.5em)}

/* Container：コンテナクエリの足場（@container は最後の逃げ道） */
.l-container{container-type:inline-size}

/* 欧文組版（2026.11.05 なおさん「欧文組版の書籍…今制作中の全サイトに及ぼせ」。高岡昌生『欧文組版』の要点 研究/ウェブ_欧文組版_要点.md §9 の T-2〜T-4）
   英文は lang="en" を付けた所だけに効く。小文字の字間は触らない（p.31）ので letter-spacing は指定しない */
:where(p,li,dd,figcaption):lang(en){font-variant-numeric:oldstyle-nums proportional-nums;hyphens:auto;text-wrap:pretty}   /* 本文の数字はオールドスタイル（書体が持つ時だけ効く）p.94。段落の末尾 1 語を避ける p.99 */
:where(table,.l-num,[data-num]){font-variant-numeric:lining-nums tabular-nums}   /* 表・価格・年表は等幅のライニング p.95 */
:where(h1,h2,h3,h4,h5,h6):lang(en){hyphens:manual}   /* 見出しをハイフンで分けない p.87・p.119 */
