/* ==========================================================================
   04_canonical.css — ED-ARTICLE CANONICAL CSS v1.1
   Source of Truth: golden-master-tunisia.html + golden-master-attention-detox.html
                     （加工なしの実物。24_golden-master-diff.md に差分明記）
   優先順位: 03_CANONICAL_SPEC_v1.md に矛盾しないこと
   スコープ: .ed-article 配下に完全隔離
   AI向け注記: このファイルの数値をAIが独自判断で書き換えることを禁止する。
              変更してよいのは「B. テーマ変数（VARIABLE）」セクションに
              明示された変数の"値"のみ。プロパティの追加・削除・
              新規セレクタの作成は一切禁止。
   フォント注記: --ed-heading-font / --ed-body-font はLOCKED定数であり、
              AIが選択できるVARIABLEではない（Dela Gothic One / Noto Sans JP
              固定＝完全再現版Canonical）。このCSSはfont-familyの指定のみを
              行い、実際の書体データの読み込み（Google Fonts <link>）は
              含まない。<link>読み込みの正式手順は 05_canonical_wordpress.html
              の先頭、および 13_wordpress-safety.md「フォント読み込み」を見よ。
              高速表示優先のsystem-font版を使う場合のみ、この2変数を
              システムフォントスタックへ差し替えてよい（非Canonical運用として
              22_ai-generation-prompt.md に別途明記）。
   ========================================================================== */


/* ============================================================
   A. AIが絶対に変更してはいけないCSS（LOCKED）
   ============================================================ */

.ed-article {
  /* --- フォント：LOCKED定数（AIが選択するVARIABLEではない） ---
     完全再現版Canonicalは常にこの2書体を使用する。実際の書体データ読込は
     05_canonical_wordpress.html 先頭の<link>タグで行う（このCSS単体では
     font-familyの指定のみで、フォントファイルは読み込まれない）。
     高速表示優先のsystem-font版に切り替える場合のみ、この2行を
     22_ai-generation-prompt.mdの「OPTION: system-font版」の値に置き換える
     （その場合は本Canonicalではなく明示的な別運用として扱う）。 */
  --ed-heading-font: 'Dela Gothic One', "YuGothic","游ゴシック体","Hiragino Kaku Gothic ProN",sans-serif;
  --ed-body-font:    'Noto Sans JP', "YuGothic","游ゴシック体","Hiragino Kaku Gothic ProN",sans-serif;
  --ed-mono-font:    ui-monospace, "SFMono-Regular", Consolas, "Courier New", monospace;

  display: block;
  background: var(--ed-bg);
  color: var(--ed-ink);
  font-family: var(--ed-body-font);
  font-weight: 300;
  line-height: 1.9;
  font-size: 15px;
  overflow-x: hidden;
  word-break: normal;
  overflow-wrap: break-word;
  isolation: isolate; /* WordPressテーマのz-index/stacking-context汚染を遮断 */
}
.ed-article,
.ed-article * ,
.ed-article *::before,
.ed-article *::after { box-sizing: border-box; }

/* WordPressテーマ既定スタイルからの防御（all:initialは使わない。
   使うとフォント/lang/dir等ブラウザ既定値まで初期化され、
   日本語フォントレンダリングやアクセシビリティ属性が壊れるため。
   代わりに衝突が実際に起きやすいプロパティだけを明示的に上書きする） */
.ed-article h1, .ed-article h2, .ed-article h3,
.ed-article h4, .ed-article h5, .ed-article h6 {
  margin: 0; padding: 0; background: none; border: none;
  text-align: left; font-style: normal;
}
.ed-article p, .ed-article ul, .ed-article ol, .ed-article li,
.ed-article table, .ed-article blockquote, .ed-article figure {
  margin: 0; padding: 0; background: none; border: none; list-style: none;
}
.ed-article img { max-width: 100%; height: auto; display: block; border-radius: 0; box-shadow: none; }
.ed-article a { color: var(--ed-t1); text-decoration: underline; }
.ed-article table { border-collapse: collapse; }
.ed-list { display: grid; gap: 10px; margin: 20px 0; }
.ed-list li { position: relative; padding-left: 22px; color: var(--ed-text); }
.ed-list li::before { content: ""; position: absolute; left: 0; top: .82em; width: 9px; height: 3px; background: var(--ed-t1); }

/* --- TOPBAR --- */
.ed-topbar {
  background: var(--ed-ink);
  padding: 14px 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 3px solid var(--ed-t1);
  flex-wrap: wrap;
}
.ed-topbar--sticky { position: sticky; top: 0; z-index: 20; }
.ed-topbar__logo { font-family: var(--ed-heading-font); font-weight: 900; font-size: 16px; color: #fff; letter-spacing: .05em; }
.ed-topbar__logo em { font-style: normal; color: var(--ed-t1); }
.ed-topbar__tag { font-family: var(--ed-mono-font); font-size: 10px; letter-spacing: .14em; color: rgba(255,255,255,.35); text-transform: uppercase; }

/* --- HERO --- */
.ed-hero { background: var(--ed-ink); position: relative; overflow: hidden; padding: 72px 60px 64px; }
.ed-hero__motif {
  position: absolute; right: -40px; top: -40px;
  font-size: 380px; line-height: 1; opacity: .05;
  color: #fff; pointer-events: none; user-select: none; z-index: 0;
}
.ed-hero__grid {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 60px; align-items: center;
}
.ed-hero__main { position: relative; min-width: 0; }
.ed-hero__kicker {
  font-size: 10px; letter-spacing: .32em; color: var(--ed-t1);
  text-transform: uppercase; display: flex; align-items: center; gap: 12px;
  margin: 0 0 16px;
}
.ed-hero__kicker::before { content:""; width:20px; height:1px; background:var(--ed-t1); }
.ed-hero__title {
  font-family: var(--ed-heading-font); font-weight: 900;
  font-size: clamp(var(--ed-h1-min), var(--ed-h1-fluid), var(--ed-h1-max));
  color: #fff; line-height: 1.35; margin: 0 0 16px;
}
.ed-hero__title .ed-accent { color: var(--ed-t1); }
.ed-hero__lead { font-size: 15px; color: rgba(255,255,255,.6); line-height: 1.9; max-width: 480px; margin: 0 0 28px; }
.ed-hero__tags { display: flex; flex-wrap: wrap; gap: 10px; }
.ed-hero__spec { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ed-hero__spec-item { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-left: 3px solid var(--ed-t1); padding: 13px 18px; }
.ed-hero__spec-label { font-size: 9px; letter-spacing: .2em; color: var(--ed-t1); text-transform: uppercase; font-weight: 700; margin: 0 0 4px; }
.ed-hero__spec-value { font-size: 13px; color: rgba(255,255,255,.85); line-height: 1.5; }

/* --- MAIN / SECTION --- */
.ed-main { max-width: 880px; margin: 0 auto; padding: 72px 40px; }
.ed-section { margin-bottom: 80px; }
.ed-section:last-child { margin-bottom: 0; }
.ed-section__head { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; flex-wrap: wrap; }
.ed-section__line { flex: 1 1 60px; height: 1px; background: var(--ed-border); min-width: 24px; }
.ed-section__title { font-family: var(--ed-heading-font); font-weight: 900; font-size: clamp(20px,3vw,30px); line-height: 1.4; margin: 0 0 20px; }
.ed-section__title .ed-accent { color: var(--ed-t1); }

.ed-h3 { font-family: var(--ed-heading-font); font-weight: 900; font-size: 18px; margin: 32px 0 12px; display: flex; align-items: center; gap: 10px; }
.ed-h3::before { content:""; width:4px; height:18px; background: var(--ed-t2); flex-shrink:0; }

.ed-article p.ed-p { font-size: 15px; line-height: 1.95; margin: 0 0 16px; color: var(--ed-text); }
.ed-article p.ed-p:last-child { margin-bottom: 0; }
.ed-accent { color: var(--ed-t1); font-weight: 700; }
.ed-strong       { color: var(--ed-ink); font-weight: 700; }
.ed-strong--t2   { color: var(--ed-t2); font-weight: 700; }
.ed-strong--t3   { color: var(--ed-t3); font-weight: 700; }
.ed-strong--t4   { color: var(--ed-t4); font-weight: 700; }
.ed-strong--t5   { color: var(--ed-t5); font-weight: 700; }

/* --- PILL（5トーン・direct rotation） --- */
.ed-pill {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 700; letter-spacing: 3px;
  text-transform: uppercase; color: #fff;
  padding: 4px 14px; border-radius: 0; white-space: nowrap;
  background: var(--ed-ink);
}
.ed-pill[data-tone="t1"] { background: var(--ed-t1); }
.ed-pill[data-tone="t2"] { background: var(--ed-t2); }
.ed-pill[data-tone="t3"] { background: var(--ed-t3); }
.ed-pill[data-tone="t4"] { background: var(--ed-t4); }
.ed-pill[data-tone="t5"] { background: var(--ed-t5); }

/* --- TAG（カード/hero内の分類チップ） --- */
.ed-tag {
  display: inline-flex; align-items: center;
  font-size: 9px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; padding: 2px 8px; border-radius: 0;
  border: 1px solid var(--ed-border); background: var(--ed-soft); color: var(--ed-muted);
}
.ed-tag[data-tone="t1"] { background: color-mix(in srgb, var(--ed-t1) 12%, white); color: var(--ed-t1); border-color: color-mix(in srgb, var(--ed-t1) 45%, white); }
.ed-tag[data-tone="t2"] { background: color-mix(in srgb, var(--ed-t2) 12%, white); color: var(--ed-t2); border-color: color-mix(in srgb, var(--ed-t2) 45%, white); }
.ed-tag[data-tone="t3"] { background: color-mix(in srgb, var(--ed-t3) 12%, white); color: var(--ed-t3); border-color: color-mix(in srgb, var(--ed-t3) 45%, white); }
.ed-tag[data-tone="t4"] { background: color-mix(in srgb, var(--ed-t4) 12%, white); color: var(--ed-t4); border-color: color-mix(in srgb, var(--ed-t4) 45%, white); }
.ed-tag[data-tone="t5"] { background: color-mix(in srgb, var(--ed-t5) 12%, white); color: var(--ed-t5); border-color: color-mix(in srgb, var(--ed-t5) 45%, white); }
.ed-hero__tags .ed-tag { font-size: 12px; padding: 5px 14px; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.15); color: rgba(255,255,255,.75); }

/* --- CARD（border + gap 併用） --- */
.ed-cards[data-ed-grid="cards"] { display: flex; flex-direction: column; gap: 3px; margin: 24px 0; }
.ed-card {
  background: var(--ed-card); border: 1px solid var(--ed-border);
  padding: 22px 26px; display: grid;
  grid-template-columns: 56px minmax(0,1fr); gap: 18px; align-items: start;
  transition: border-color .2s, background .2s;
}
.ed-card:hover { border-color: var(--ed-t1); background: color-mix(in srgb, var(--ed-t1) 8%, white); }
.ed-card__icon { font-size: 32px; text-align: center; line-height: 1; }
.ed-card__body { min-width: 0; }
.ed-card--no-icon { grid-template-columns: minmax(0,1fr); }
/* 1.5.3以前の保存HTMLも即時修復。本文だけのcardは全列を使い、
   C03/C05のicon用40/64px列へ押し込まれないようにする。 */
.ed-card > .ed-card__body:only-child { grid-column: 1 / -1; width: 100%; }
.ed-card__title { font-family: var(--ed-heading-font); font-weight: 900; font-size: 17px; margin: 0 0 5px; }
.ed-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.ed-card__desc { font-size: 13px; color: var(--ed-muted); line-height: 1.7; margin: 0; }
/* 広告混入対策: n番目要素への依存を一切行わない（nth-childセレクタ不使用） */

/* --- GRID（border無し・gapのみで罫線表現／固定3列＋フォールバック） --- */
.ed-grid[data-ed-grid="data3"] {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 3px; background: var(--ed-border); margin: 24px 0;
}
.ed-grid[data-ed-grid="data2"] { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; background: var(--ed-border); margin: 24px 0; }
/* 5〜6項目時は data3 のまま2段に折り返す。auto-fitは使わない（LOCKED仕様） */

.ed-grid__item { background: var(--ed-card); padding: 22px 18px; text-align: center; transition: background .2s; min-width: 0; }
.ed-grid__item:hover { background: color-mix(in srgb, var(--ed-t1) 8%, white); }
.ed-grid__figure { font-size: 32px; margin: 0 0 8px; display: block; line-height: 1; }
.ed-grid__figure--stat { font-family: var(--ed-heading-font); font-weight: 900; font-size: 26px; color: var(--ed-t1); }
.ed-grid__title { font-family: var(--ed-heading-font); font-weight: 900; font-size: 14px; margin: 0 0 5px; }
.ed-grid__desc { font-size: 12px; color: var(--ed-muted); line-height: 1.6; margin: 0; }

/* --- BOX（3トーン固定：note=t5, info=t2, warn=t4） --- */
.ed-box { border: 1px solid var(--ed-border); border-left: 4px solid var(--ed-ink); background: var(--ed-soft); padding: 20px 24px; margin: 24px 0; }
.ed-box[data-tone="note"] { border-left-color: var(--ed-t5); background: color-mix(in srgb, var(--ed-t5) 10%, white); }
.ed-box[data-tone="info"] { border-left-color: var(--ed-t2); background: color-mix(in srgb, var(--ed-t2) 10%, white); }
.ed-box[data-tone="warn"] { border-left-color: var(--ed-t4); background: color-mix(in srgb, var(--ed-t4) 10%, white); }
.ed-box__title { font-size: 11px; letter-spacing: .14em; font-weight: 700; text-transform: uppercase; margin: 0 0 8px; color: var(--ed-t4); }
.ed-box p { font-size: 14px; line-height: 1.8; margin: 0; }

/* --- QUOTE --- */
.ed-quote { background: var(--ed-ink); padding: 32px 40px; margin: 32px 0; position: relative; overflow: hidden; }
.ed-quote::before { content: "\201C"; position: absolute; left: 12px; top: -18px; font-family: Georgia, serif; font-size: 100px; color: rgba(255,255,255,.05); line-height: 1; }
.ed-quote p { font-family: var(--ed-heading-font); font-weight: 900; font-size: 18px; color: #fff; line-height: 1.7; margin: 0; position: relative; }
.ed-quote p .ed-accent { color: var(--ed-t1); }
.ed-quote__source { margin-top: 10px; font-family: var(--ed-mono-font); font-size: 11px; letter-spacing: .14em; color: rgba(255,255,255,.35); position: relative; }

/* --- TABLE --- */
.ed-table-wrap { overflow-x: auto; margin: 24px 0; -webkit-overflow-scrolling: touch; }
.ed-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 480px; }
.ed-table th { background: var(--ed-ink); color: #fff; padding: 11px 16px; text-align: left; font-size: 11px; letter-spacing: .14em; white-space: nowrap; }
.ed-table td { padding: 10px 16px; border-bottom: 1px solid var(--ed-border); vertical-align: top; color: var(--ed-text); }
.ed-table tr:nth-of-type(even) td { background: var(--ed-soft); } /* テーブル内の縞模様のみnth使用（table自体は広告混入対象外のため許可） */

/* --- TIMELINE（h3の反復。専用クラスは持たずed-h3+ed-pを積む） --- */
.ed-timeline .ed-h3 { margin-top: 32px; }

/* --- SUMMARY --- */
.ed-summary { background: var(--ed-ink); border: 2px solid var(--ed-t1); padding: 36px 44px; margin: 40px 0; position: relative; overflow: hidden; }
.ed-summary__motif { position: absolute; right: 20px; bottom: -10px; font-size: 120px; opacity: .06; color:#fff; pointer-events:none; }
.ed-summary__title { font-family: var(--ed-heading-font); font-weight: 900; font-size: 17px; color: var(--ed-t1); margin: 0 0 16px; }
.ed-summary__list { list-style: none; margin: 0; padding: 0; }
.ed-summary__row { font-size: 14px; color: rgba(255,255,255,.8); padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; gap: 12px; line-height: 1.7; }
.ed-summary__row:last-child { border-bottom: none; }
.ed-summary__row::before { content: "\2192"; color: var(--ed-t1); font-weight: 700; flex-shrink: 0; }

/* --- FOOTER --- */
.ed-footer { background: var(--ed-ink); border-top: 3px solid var(--ed-t1); padding: 22px 48px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-family: var(--ed-mono-font); font-size: 10px; letter-spacing: .14em; color: rgba(255,255,255,.3); text-transform: uppercase; }
.ed-footer__logo { font-family: var(--ed-heading-font); font-weight: 900; font-size: 16px; color: rgba(255,255,255,.7); }
.ed-footer__logo em { font-style: normal; color: var(--ed-t1); }

/* --- 広告混入対策（section内にAdSenseが挿入されても壊れないための保険） --- */
.ed-article .adsbygoogle,
.ed-article ins.adsbygoogle,
.ed-article .google-auto-placed {
  display: block !important;
  max-width: 100% !important;
  width: 100% !important;
  margin: 40px auto !important;
  overflow: hidden !important;
}
/* grid/cardの直接childとして広告が差し込まれるケースへの保険：
   grid/cardコンテナ内に .ed-grid__item / .ed-card 以外のブロックが
   紛れ込んでも、gridの列数計算を乱さないよう明示的にgrid-columnを指定 */
.ed-grid[data-ed-grid] > :not(.ed-grid__item) { grid-column: 1 / -1; }
.ed-cards[data-ed-grid="cards"] > :not(.ed-card) { width: 100%; }


/* ============================================================
   B. テーマごとに変更してよい CSS Variables（VARIABLE）
   ★ 03_CANONICAL_SPEC_v1.md「統一VARIABLE一覧」と完全一致させること。
     06_design-tokens.json / 22_ai-generation-prompt.md も同一リストを参照する。
     この節に無い変数・プロパティをAIが追加/変更することは禁止。
   ============================================================ */
.ed-article {
  /* --- 5トーン・パレット + ベース2色 = 公式VARIABLE 7個 --- */
  --ed-bg:     #f1efe9;
  --ed-ink:    #14181c;
  --ed-t1:     #8c662c; /* メインアクセント：テーマの実在色 */
  --ed-t2:     #2a5aa0; /* 情報・データ系 */
  --ed-t3:     #4c6b48; /* 自然・身体系 */
  --ed-t4:     #a03030; /* 警告・歴史的転換点 */
  --ed-t5:     #8c662c; /* 文化・ノスタルジー系（t1と同色でも可） */

  /* --- h1文字サイズトークン 公式VARIABLE 3個（16章H1長文ルールに対応） ---
     デフォルトはAttention-Detox実測値。Tunisia実測値(36/5vw/64px)は
     「hero訴求を強めたい記事」向けのVARIABLE許容範囲として使用可（03参照）。
     50文字超の長いH1では --ed-h1-max を下げて対応する（記事固有インライン
     styleは引き続き禁止。この3変数の値変更のみで対応する）。 */
  --ed-h1-min:   32px;
  --ed-h1-fluid: 4.6vw;
  --ed-h1-max:   54px;

  /* --- 派生（通常固定。手動チューニング時のみ触る。公式VARIABLEではない） --- */
  --ed-card:   #ffffff;
  --ed-border: #dcd6c8;
  --ed-muted:  #6b6456;
  --ed-soft:   #ece7da;
  --ed-text:   #24211a; /* 準黒本文色。inkそのものより少し起こす */
}


/* ============================================================
   C. コンポーネント選択によってのみ変化する部分（CONDITIONAL）
   ============================================================ */

/* --- FAQ（Golden Masterに存在しない拡張。使用は任意） --- */
.ed-faq { display: flex; flex-direction: column; gap: 3px; margin: 24px 0; }
.ed-faq__item { background: var(--ed-card); border: 1px solid var(--ed-border); padding: 4px 24px; }
.ed-faq__item[open] { border-color: var(--ed-t1); }
.ed-faq__q { cursor: pointer; list-style: none; padding: 16px 28px 16px 0; font-weight: 700; font-size: 15px; position: relative; }
.ed-faq__q::-webkit-details-marker { display: none; }
.ed-faq__q::before { content: "Q"; color: var(--ed-t1); font-family: var(--ed-heading-font); font-weight: 900; margin-right: 10px; }
.ed-faq__q::after { content: "+"; position: absolute; right: 0; top: 16px; font-size: 18px; color: var(--ed-muted); }
.ed-faq__item[open] .ed-faq__q::after { content: "\2212"; }
.ed-faq__a { padding: 0 0 18px; font-size: 14px; color: var(--ed-muted); line-height: 1.8; }
.ed-faq__a::before { content: "A"; color: var(--ed-t2); font-family: var(--ed-heading-font); font-weight: 900; margin-right: 10px; }

/* --- TOC（Golden Masterに存在しない拡張。長尺記事のみ推奨） --- */
.ed-toc { border: 1px solid var(--ed-border); background: var(--ed-card); padding: 20px 26px; margin: 0 0 48px; }
.ed-toc__title { font-family: var(--ed-heading-font); font-weight: 900; font-size: 13px; margin: 0 0 12px; }
.ed-toc__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ed-toc__list a { font-size: 13px; color: var(--ed-text); text-decoration: none; display: flex; gap: 8px; }
.ed-toc__list a::before { content: "\2192"; color: var(--ed-t1); }

/* --- CTA（Golden Masterに存在しない拡張。誘導が必要な記事のみ） --- */
.ed-cta { background: var(--ed-ink); border: 2px solid var(--ed-t1); padding: 36px 44px; margin: 40px 0; text-align: center; }
.ed-cta__title { font-family: var(--ed-heading-font); font-weight: 900; font-size: 18px; color: #fff; margin: 0 0 10px; }
.ed-cta__desc { font-size: 14px; color: rgba(255,255,255,.7); margin: 0 0 20px; }
.ed-cta__button { display: inline-block; background: var(--ed-t1); color: #fff; font-weight: 700; font-size: 14px; padding: 14px 32px; border-radius: 0; text-decoration: none; }


/* ============================================================
   D. レスポンシブ（720px 単一ブレークポイント）
   ============================================================ */
@media (max-width: 720px) {
  .ed-topbar, .ed-footer { padding-left: 24px; padding-right: 24px; }
  .ed-hero { padding: 56px 24px; }
  .ed-hero__grid { grid-template-columns: 1fr; }
  .ed-hero__spec { display: none; }
  .ed-main { padding: 56px 24px; }
  .ed-grid[data-ed-grid="data3"],
  .ed-grid[data-ed-grid="data2"] { grid-template-columns: 1fr; }
  .ed-card { grid-template-columns: 1fr; }
  .ed-card__icon { text-align: left; }
  .ed-footer { flex-direction: column; align-items: flex-start; }
  .ed-quote { padding: 24px 24px; }
  .ed-summary { padding: 28px 24px; }
}

/* ============================================================
   E. 禁止パターンの機械的ブロック（保険。通常は発火しない）
   ============================================================ */
.ed-article [style*="writing-mode"],
.ed-article [style*="text-orientation"] { writing-mode: horizontal-tb !important; text-orientation: mixed !important; }
.ed-article { text-orientation: mixed; }
