/* ja-contracts.css — jp-ui-contracts (media + saas profile)
 * 日本語組版の契約 CSS。:lang(ja) に絞って既存 CSS を上書きせず追加する。
 * Kit: ~/Claude/assets/jp-ui-contracts/
 * Profile: media（メイン）+ saas（products/product-selector.html 領域）
 * Docs: see ./DESIGN.md
 *
 * このファイルに普通の見た目調整（色・フォント・サイズ等）を足さないこと。
 * 日本語組版の破綻防止（word-break / line-break / overflow-wrap / mixed-script）に限定する。
 *
 * ウィザード（psw__*）の密度ルールが既存側にある場合、ja-contracts はそれを尊重する。
 * ja-contracts の fallback 値より具体度の高い psw__ セレクタは CSS 詳細度で自然に優先される。
 */

/* ---- 1. ja-text: html:lang(ja) と本文要素の既定 --------------------- */
html:lang(ja) {
  line-break: strict;
  word-break: normal;
  overflow-wrap: anywhere;
  font-kerning: auto;
  font-feature-settings: normal;
}

:lang(ja) p,
:lang(ja) li,
:lang(ja) dd {
  line-break: strict;
  word-break: normal;
  overflow-wrap: anywhere;
}

/* reading width（本文コンテナに限定。既存の .container / .iso-container 系は触らない） */
:lang(ja) :where(article, .prose, .content) p {
  max-width: 42em;
}

/* ---- 2. headings: 見出しの折り返し戦略 ------------------------------- */
:lang(ja) h1,
:lang(ja) h2,
:lang(ja) h3,
:lang(ja) h4 {
  line-break: strict;
  word-break: normal;
  overflow-wrap: anywhere;
  font-kerning: auto;
}

:lang(ja) h1 { line-height: 1.35; }
:lang(ja) h2 { line-height: 1.4; }
:lang(ja) h3 { line-height: 1.45; }

/* ---- 3. mixed-script: 和欧混植 ---------------------------------------
 * IsoAcoustics は製品名（GAIA I/II/III, OREA, zaZen, DELOS, Aperta 等）が
 * 日本語本文に高頻度で混在する前提。
 */
html:lang(ja) {
  text-autospace: normal;
}

:lang(ja) em,
:lang(ja) strong,
:lang(ja) a,
:lang(ja) .latin,
:lang(ja) .product-name {
  word-break: normal;
  overflow-wrap: anywhere;
}

/* 見出しは auto-phrase で文節ベースに折る（対応ブラウザのみ、未対応は normal にフォールバック） */
:lang(ja) h1,
:lang(ja) h2,
:lang(ja) h3 {
  word-break: auto-phrase;
}

/* ---- 4. forms: 本文ルールからの分離 ----------------------------------
 * product-selector.html のウィザード（psw__*）にも効くが、密度を重視する
 * 既存 psw__ 固有ルールは詳細度で優先される（ここは汎用フォールバック）。
 */
:lang(ja) label,
:lang(ja) input,
:lang(ja) textarea,
:lang(ja) select,
:lang(ja) button {
  line-break: strict;
  word-break: normal;
}

:lang(ja) input,
:lang(ja) textarea,
:lang(ja) select {
  line-height: 1.5;
}

:lang(ja) .form-help,
:lang(ja) .form-error {
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* ---- 5. long-form reading line-height（media profile） -----------------
 * 実測ベースライン:
 *   style.css:148 の ":lang(ja) { line-height: var(--leading-jp) }" により
 *   --leading-jp=1.8 がページ全体の基底 line-height になる。長文 p/li も
 *   :lang(ja) を直接マッチして 1.8（詳細度 0,1,0 が継承より強い）。
 *
 * 例外:
 *   .iso-hero__subtitle は style.css:781 で line-height:var(--leading-normal)
 *   = 1.5 にクランプされ、media profile 推奨域 (1.7–2.0) を下回る。
 *   他の長文セレクタ（.iso-section__desc=1.7, .iso-summary-list=1.8,
 *   .pp-intro__body / .pp-text-section__body は :lang(ja) 継承 1.8）は
 *   既に適正なので触らない（触ると回帰する）。
 *
 * psw__ は非対象（詳細度で重ならない個別クラスのみ列挙）。
 * :root 変更は回避（saas/psw__ 密度に波及するため）。
 */
:lang(ja) :where(.iso-hero__subtitle) {
  line-height: 1.7;
}
