/* ============================================================
   tokens.css — Design Tokens (Single Source of Truth)
   聖書アプリ共通デザイントークン

   方針: 同じ役割のUIは同じトークンを参照する。
   既存画面には直接指定が残るため、役割と表示を確認しながら段階的に移行する。
   異なる役割の値は、数値が同じでも無理に一つへ統合しない。
   ============================================================ */
:root {
    /* ── Colors（アクセントは1種類のみ） ── */
    --bg:           #ffffff;
    --bg-panel:     #f3f1ec;
    --bg-inset:     #fafafa;
    --text:         #211f1a;
    --text-sub:     #57534a;
    --text-hint:    #8a8577;
    --accent:       #2c4f34;
    --accent-light: rgba(44,79,52,0.10);
    --accent-mid:   rgba(44,79,52,0.20);
    --border:       #e6e2d7;

    /* ── Font families: UI / Japanese prose / Greek ── */
    --font-ui:    'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    --font-prose: 'Noto Serif JP', serif;

    /* ── Typography: UI scale + long-form reading text ── */
    --text-caption:  0.75rem;
    --text-body:     0.9rem;
    --text-body-lg:  1rem;
    --text-title:    1.25rem;
    --text-headline: 1.5rem;
    --text-display:  2rem;
    --text-reading:  15px; /* 辞書・使用傾向など、長文を読む領域。既存サイズを維持 */
    --text-label:    13px; /* 辞書項目・語形候補などの小見出し */

    /* ── Typography roles: runtime mapping (values preserve current appearance) ── */
    --weight-regular:  400;
    --weight-medium:   500;
    --weight-semibold: 600;
    --weight-bold:     700;

    /* Line-height is role-specific: these are not a universal scale. */
    --line-height-reading-ja:      2.1;
    --line-height-reading-prose:   1.9;
    --line-height-dictionary:      1.8;
    --line-height-word-chip:       1.4;
    --line-height-greek-headword:  1.2;

    /* Tracking for continuous reading text; labels keep their own roles below. */
    --tracking-reading: 0.01em;

    /* ── Letter spacing: 役割別 ── */
    --tracking-label:   0.1em;
    --tracking-subsection: 0.08em;
    --tracking-reading-label: 0.045em;
    --tracking-section: 0.14em;

    /* ── Radii: 固定4段階（50%の真円/ドット形状はこの対象外） ── */
    --radius-s: 4px;
    --radius-m: 8px;
    --radius-l: 16px;
    --radius-pill: 999px;

    /* ── Opacity: 固定4段階 ── */
    --opacity-primary:   1;
    --opacity-secondary: 0.6;
    --opacity-tertiary:  0.3;
    --opacity-disabled:  0.15;

    /* ── Spacing ──
       「読書のリズム」3階層モデル。新規UIの基本リズムは5値を優先する。
       --space-3 / --space-7 / --space-8 は既存画面・Design Systemとの対応を保つ拡張値。
       ① micro  (word/chip/inline要素の連続性)        → --space-xs
       ② medium (word-card/list-item/resonance blockの意味単位) → --space-sm（縦）/ --space-md（横）
       ③ macro  (section/panel/StudyPanelブロックの思考の切り替え) → --space-lg / --space-xl */
    --space-xs:     4px;
    --space-sm:     8px;
    --space-3:      12px;
    --space-md:     16px;
    --space-lg:     24px;
    --space-xl:     32px;
    --space-7:      48px;
    --space-8:      64px;

    /* ── Rhythm aliases（3階層モデルの呼び方をコードに残す） ── */
    --rhythm-micro:     var(--space-xs);
    --rhythm-medium-y:  var(--space-sm);
    --rhythm-medium-x:  var(--space-md);
    --rhythm-macro-min: var(--space-lg);
    --rhythm-macro-max: var(--space-xl);

    /* ── Role Colors（Design Audit による追加・現時点では定義のみ） ──
       既存コードの生値を役割名で正典化したもの。値は現在最も代表的な
       使用値を採用（見た目の変更なし）。今後の新規UIはこのトークンを
       参照し、既存の生値は段階的に var() へ置換していく。 */

    /* Positive status
       成功・検証済み・高信頼度（現: components.css result-conf.high） */
    --color-positive: #4a7a5a;

    /* Caution status
       中間・注意・中信頼度（現: components.css result-conf.medium） */
    --color-caution:  #a09050;

    /* Negative status
       警告・エラー・低信頼度（現: components.css result-conf.low） */
    --color-negative: #b05050;

    /* Semantic domain
       意味領域・前置詞句などの構造マーカー。
       テーマ変更に追従しつつ、本文より淡いアクセントとして表示する。 */
    --color-domain:   var(--accent);

    /* Strong border
       強い境界線・下線（現: rgba(0,0,0,0.12) が代表。--border=0.07 より強い段） */
    --border-strong:  #cdc7b6;

    /* Hover veil
       ホバー時に被せる薄膜背景（現: rgba(0,0,0,0.04) が最頻） */
    --hover-veil:     rgba(0,0,0,0.04);

    /* Divider
       行区切りなど最弱の区切り線（現: rgba(0,0,0,0.04) が代表。
       hover-veil と同値だが役割が異なるため別トークンとして分離） */
    --divider:        rgba(0,0,0,0.04);

    /* ── Shadow ── */
    --shadow-card:  0 1px 2px rgba(33,32,28,0.05), 0 6px 20px rgba(33,32,28,0.07);

    /* ── Structural Reading Colors（3層の意味色 — H-7 確定・2026-09-29）── */
    --structural-function-fill:      #e3eddf;
    --structural-function-ink:       #375e2c;
    --structural-construction-fill:  #cce6db;
    --structural-construction-ink:   #2e5945;
    --structural-morphology-fill:    #e6f0ea;
    --structural-morphology-ink:     #316148;

    /* ── RK Reading Mode colors（Reed-Kellogg 構文図: 役割色 — Phase J）── */
    --core: #3730a3;
    --mod:  #0f766e;
    --adv:  #a16207;
    --link: #a21caf;
    --sub:  #5b6178;

    /* ── Focus ring（キーボードフォーカス輪郭）── */
    --focus-ring: var(--text);

    /* ── Motion: easingは1種類のみ。bounce（overshoot）は使用禁止。
       durationは3段階のみ。 ── */
    --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
    --duration-fast: 0.15s;
    --duration-base: 0.2s;
    --duration-slow: 0.3s;
    --transition-fast: var(--duration-fast) var(--ease-out);
    --transition-base: var(--duration-base) var(--ease-out);
    --transition-slow: var(--duration-slow) var(--ease-out);

    /* ── Aliases: backward compat for index.html / search-tool.html ── */
    --bg-paper:        var(--bg);
    --bg-sidebar:      var(--bg-inset);
    --bg-card:         var(--bg-panel);
    --bg-sub:          var(--bg-panel);
    --text-main:       var(--text);
    --accent-dark:     var(--text);
    --highlight:       var(--accent);
    --highlight-light: var(--accent-light);
    --border-soft:     var(--border);
    --ink:             var(--text);
    --ink-muted:       var(--text-sub);
    --ink-soft:        var(--text-hint);
    --font-greek:      'Gentium Plus', serif;
    --surface:         var(--bg-panel);
}
