/* =============================================================
   article-style.css  —  エルヴェ ブログ記事 装飾スタイル
   -------------------------------------------------------------
   Part 1: 会話ふきだし・ボード・強調ボックス・ステップ・リンク・
           囲み・見出し別版・抜粋（しんせつ見本から再設計・再着色）
   Part 2: レスポンシブ表（横スクロール / カード積み上げ / sticky列）

   ブランドカラー変数（差し替えはここだけで完結）
     --el-green      #1F5038  メイン緑（見出し・枠・ふきだし主調）
     --el-cream      #fffbf1  クリーム（淡い背景）
     --el-gold       #e6bd01  ゴールド（アクセント・強調）
     --el-lightgreen #d7e9d9  ライトグリーン（サブ背景）
   フォントは本文既定を尊重し、font-family は一切指定しない。
   モバイルファースト（min-width で拡張）。
   ============================================================= */

:root {
  --el-green: #1f5038;
  --el-green-d: #163a29; /* 濃い緑（境界・影の締め） */
  --el-cream: #fffbf1;
  --el-gold: #e6bd01;
  --el-lightgreen: #d7e9d9;
  --el-line: #e2e6e1; /* 薄いグレー罫線 */
  --el-text: #333333;
  --el-danger: #c0392b; /* demerit 用の赤（維持） */
  --el-danger-bg: #fdecea;
  --el-radius: 8px;
}

/* 記事本文の共通ラッパー（任意）。既存レイアウトを壊さないよう最小限。 */
.article-body {
  color: var(--el-text);
  line-height: 1.9;
  word-break: break-word;
}
.article-body p {
  margin: 0 0 1.2em;
}

/* =============================================================
   1-1. 会話ふきだし  .sb-box
   構造:
   .sb-box
     .icon-img.icon-img-left|right > img
     .icon-name.icon-name-left|right       （任意）
     .sb-side.sb-side-left|right
       .sb-txt.sb-txt-left|right
   ============================================================= */
.sb-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 1.6em 0;
}
.icon-img {
  flex: 0 0 auto;
  width: 64px;
}
.icon-img img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--el-lightgreen);
  background: #fff;
  display: block;
}
.icon-name {
  font-size: 0.72em;
  text-align: center;
  margin-top: 4px;
  color: var(--el-green);
  font-weight: 700;
  line-height: 1.3;
  width: 64px;
}

/* 左右の並び替え（右発言は行を反転） */
.sb-box:has(.icon-img-right) {
  flex-direction: row-reverse;
}

/* icon-name は icon-img の直下に置きたいので、icon+name を縦積みにする。
   マークアップ上は icon-img と icon-name が兄弟なので、
   flexの order とラップで縦並びを表現する。 */
.sb-box {
  flex-wrap: wrap;
}
.icon-img-left {
  order: 1;
}
.icon-name-left {
  order: 2;
  width: 64px;
}
.sb-side-left {
  order: 3;
}
/* 右版 */
.sb-box:has(.icon-img-right) .icon-img-right {
  order: 1;
}
.sb-box:has(.icon-img-right) .icon-name-right {
  order: 2;
}
.sb-box:has(.icon-img-right) .sb-side-right {
  order: 3;
}

/* icon-name が無い場合でも吹き出しが上端で揃うように */
.sb-side {
  flex: 1 1 0;
  min-width: 0;
  position: relative;
}
.sb-txt {
  position: relative;
  background: var(--el-lightgreen);
  color: var(--el-text);
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 0.95em;
  line-height: 1.7;
}
/* 左吹き出しのしっぽ（左向き三角） */
.sb-txt-left::before {
  content: "";
  position: absolute;
  top: 18px;
  left: -14px;
  border: 7px solid transparent;
  border-right-color: var(--el-lightgreen);
}
/* 右吹き出し（ゴールド寄りのクリームで話者を区別） */
.sb-txt-right {
  background: var(--el-cream);
  border: 1px solid var(--el-lightgreen);
}
.sb-txt-right::before {
  content: "";
  position: absolute;
  top: 18px;
  right: -15px;
  border: 7px solid transparent;
  border-left-color: var(--el-cream);
}

@media (min-width: 768px) {
  .icon-img,
  .icon-img img,
  .icon-name {
    width: 72px;
  }
  .icon-img img {
    height: 72px;
  }
  .sb-txt {
    font-size: 1em;
  }
}

/* =============================================================
   1-2. 見出し＋ボード  .box-title-gray / .box-title-sky
   （-sky/-blue は名前互換のまま実色をライトグリーン〜緑系へ）
   ============================================================= */
.box-title-gray,
.box-title-sky {
  margin: 1.6em 0;
  border-radius: var(--el-radius);
  overflow: hidden;
  border: 1px solid var(--el-line);
}
.box-title-gray .box-title,
.box-title-sky .box-title {
  padding: 10px 16px;
  font-weight: 700;
  font-size: 1em;
  color: #fff;
}
/* gray 版：落ち着いた濃緑ヘッダー＋クリーム地 */
.box-title-gray .box-title {
  background: var(--el-green);
}
.box-title-gray {
  background: var(--el-cream);
}
/* sky 版：ライトグリーン地＋緑ヘッダー（旧「青」の役割） */
.box-title-sky .box-title {
  background: var(--el-green);
}
.box-title-sky {
  background: var(--el-lightgreen);
}
.box-title-gray ul,
.box-title-sky ul {
  margin: 0;
}
.box-title-gray .box-title + ul,
.box-title-sky .box-title + ul {
  padding: 12px 16px 12px 34px;
}

/* リスト .list-011（チェック風の緑マーカー） */
ul.list-011 {
  list-style: none;
  padding-left: 0;
  margin: 0.4em 0;
}
ul.list-011 li {
  position: relative;
  padding: 4px 0 4px 26px;
  line-height: 1.7;
}
ul.list-011 li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.7em;
  width: 12px;
  height: 7px;
  border-left: 3px solid var(--el-gold);
  border-bottom: 3px solid var(--el-gold);
  transform: rotate(-45deg);
}

/* =============================================================
   1-3. 強調ボックス  .su-box.su-box-style-default
   ============================================================= */
.su-box {
  margin: 1.6em 0;
  border: 2px solid var(--el-green);
  border-radius: var(--el-radius);
  background: #fff;
  overflow: hidden;
}
.su-box-title {
  background: var(--el-green);
  color: #fff;
  font-weight: 700;
  padding: 10px 16px;
  font-size: 1em;
}
.su-box-content {
  padding: 14px 18px;
}
.su-box-content ul {
  margin: 0;
  padding-left: 1.3em;
}
.su-box-content li {
  padding: 3px 0;
}

/* =============================================================
   1-4. ステップ  .point1 / .point2 / .point3
   （連番の丸バッジを ::before で自動採番）
   ============================================================= */
.point1,
.point2,
.point3 {
  position: relative;
  background: var(--el-cream);
  border: 1px solid var(--el-lightgreen);
  border-left: 4px solid var(--el-green);
  border-radius: var(--el-radius);
  margin: 10px 0;
  padding: 14px 16px 14px 60px;
  min-height: 32px;
  line-height: 1.7;
}
.point1::before,
.point2::before,
.point3::before {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--el-green);
  color: #fff;
  font-weight: 700;
  font-size: 0.95em;
  display: flex;
  align-items: center;
  justify-content: center;
}
.point1::before {
  content: "1";
}
.point2::before {
  content: "2";
}
.point3::before {
  content: "3";
}

/* =============================================================
   1-5. リンク  .osusume-link / .emphasize-link
   ============================================================= */
.osusume-link {
  margin: 1.2em 0;
  padding: 12px 16px 12px 42px;
  background: var(--el-cream);
  border: 1px solid var(--el-lightgreen);
  border-radius: var(--el-radius);
  position: relative;
}
.osusume-link::before {
  content: "\25B6"; /* ▶ */
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--el-gold);
  font-size: 0.8em;
}
.osusume-link a,
.emphasize-link a {
  color: var(--el-green);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.emphasize-link {
  margin: 1.2em 0;
  padding: 8px 16px;
  background: var(--el-lightgreen);
  border-radius: var(--el-radius);
}
.emphasize-link p {
  margin: 0;
  padding: 8px 0 8px 24px;
  position: relative;
  border-bottom: 1px dashed rgba(31, 80, 56, 0.3);
}
.emphasize-link p:last-child {
  border-bottom: none;
}
.emphasize-link p::before {
  content: "\25B6";
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--el-gold);
  font-size: 0.75em;
}

/* =============================================================
   1-6. 囲み線  .boxed （+ h4.title）
   ============================================================= */
.boxed {
  margin: 1.6em 0;
  border: 2px solid var(--el-lightgreen);
  border-radius: var(--el-radius);
  padding: 18px 20px;
  background: #fff;
  position: relative;
}
.boxed h4.title,
.boxed .title {
  margin: -32px 0 12px; /* 枠線の上に食い込ませる見出し */
  display: inline-block;
  background: #fff;
  padding: 0 10px;
  color: var(--el-green);
  font-size: 1em;
  font-weight: 700;
}
.boxed ul {
  margin: 0;
  padding-left: 1.3em;
}
.boxed li {
  padding: 3px 0;
}

/* =============================================================
   1-7. 見出し別版
   h3.c-header.blue / h4.leaf / h4.baloon_midashi.demerit
   ============================================================= */
h3.c-header {
  position: relative;
  margin: 2em 0 1em;
  padding: 10px 16px 10px 18px;
  background: var(--el-cream);
  border-left: 6px solid var(--el-green);
  border-bottom: 2px solid var(--el-lightgreen);
  font-size: 1.25em;
  color: var(--el-green);
  font-weight: 700;
}
/* .blue は名前互換のまま緑系アクセントに寄せる */
h3.c-header.blue {
  border-left-color: var(--el-green);
}

/* 葉っぱモチーフの H4 */
h4.leaf {
  position: relative;
  margin: 1.8em 0 0.9em;
  padding: 6px 6px 6px 30px;
  font-size: 1.12em;
  color: var(--el-green);
  font-weight: 700;
  border-bottom: 2px dotted var(--el-lightgreen);
}
h4.leaf::before {
  content: "\1F343"; /* 🍃 葉 */
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95em;
}

/* 吹き出し型の警告見出し（demerit のみ赤系維持） */
h4.baloon_midashi {
  position: relative;
  display: inline-block;
  margin: 1.8em 0 1em;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 1.05em;
  font-weight: 700;
  background: var(--el-green);
  color: #fff;
}
h4.baloon_midashi::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 24px;
  border: 8px solid transparent;
  border-top-color: var(--el-green);
  border-bottom: 0;
}
h4.baloon_midashi.demerit {
  background: var(--el-danger);
}
h4.baloon_midashi.demerit::after {
  border-top-color: var(--el-danger);
}

/* 黄色マーカー（見本の marker_yellow をゴールド寄りに） */
.marker_yellow {
  background: linear-gradient(transparent 60%, rgba(230, 189, 1, 0.45) 60%);
  font-weight: 700;
}

/* =============================================================
   1-8. 抜粋  dl.extract
   構造: dl.extract > dt>img / dd.title>a / dd.text
   ============================================================= */
dl.extract {
  display: grid;
  grid-template-columns: 96px 1fr;
  grid-template-rows: auto auto;
  gap: 2px 14px;
  align-items: start;
  margin: 1.6em 0;
  padding: 14px;
  border: 1px solid var(--el-line);
  border-radius: var(--el-radius);
  background: var(--el-cream);
}
dl.extract dt {
  grid-row: 1 / 3;
  margin: 0;
}
dl.extract dt img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}
dl.extract dd {
  margin: 0;
}
dl.extract dd.title {
  align-self: start;
}
dl.extract dd.title a {
  color: var(--el-green);
  font-weight: 700;
  text-decoration: none;
  line-height: 1.5;
}
dl.extract dd.title a:hover {
  text-decoration: underline;
}
dl.extract dd.text {
  font-size: 0.88em;
  color: #666;
  line-height: 1.6;
}

/* =============================================================
   ===============  Part 2: レスポンシブ表  ====================
   決定マトリクス（クラス契約）:
     .table-scroll        基本 = 横スクロール（左右影ヒント）
     .article-table       表の基本装飾（thead緑・ゼブラ・罫線）
     .table-cards         2〜3列の解説型のみ = モバイルでカード積み上げ
     .table-sticky-first  比較表 = 横スクロール＋最左列 sticky
   モバイルファースト。
   ============================================================= */

/* --- 2-1. 横スクロール領域（CSSオンリーのスクロール影） --- */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* 左右端に固定の白、その内側にグラデ影。
     background-attachment: local(白カバー) / scroll(影) の合わせ技で
     スクロール位置に応じて影が出入りする。 */
  background:
    /* 左カバー */
    linear-gradient(to right, var(--el-cream) 30%, rgba(255, 251, 241, 0)) left
      center,
    /* 右カバー */
    linear-gradient(to left, var(--el-cream) 30%, rgba(255, 251, 241, 0)) right
      center,
    /* 左影 */
    radial-gradient(
        farthest-side at 0 50%,
        rgba(31, 80, 56, 0.22),
        rgba(31, 80, 56, 0)
      )
      left center,
    /* 右影 */
    radial-gradient(
        farthest-side at 100% 50%,
        rgba(31, 80, 56, 0.22),
        rgba(31, 80, 56, 0)
      )
      right center;
  background-repeat: no-repeat;
  background-size:
    40px 100%,
    40px 100%,
    14px 100%,
    14px 100%;
  background-attachment: local, local, scroll, scroll;
  border-radius: var(--el-radius);
}
.table-scroll,
.table-sticky-first {
  margin: 1.6em 0;
}
/* スクロール領域は role="region" tabindex="0" 付与前提。フォーカスリング。 */
.table-scroll:focus-visible,
.table-sticky-first:focus-visible {
  outline: 3px solid var(--el-gold);
  outline-offset: 2px;
}

/* --- 2-2. 表の基本装飾 .article-table --- */
.article-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 520px; /* 横スクロールを効かせる下限 */
  background: #fff;
  font-size: 0.9em;
  line-height: 1.6;
  border-radius: var(--el-radius);
  overflow: hidden;
}
.article-table caption {
  caption-side: top;
  text-align: left;
  font-weight: 700;
  color: var(--el-green);
  padding: 0 0 8px;
  font-size: 1em;
}
.article-table thead th {
  background: var(--el-green);
  color: #fff;
  font-weight: 700;
  text-align: left;
  padding: 10px 14px;
  white-space: nowrap;
  vertical-align: middle;
}
.article-table th,
.article-table td {
  padding: 10px 14px;
  border: 1px solid var(--el-line);
  vertical-align: top;
}
/* 行頭見出し（th scope=row） */
.article-table tbody th[scope="row"] {
  background: var(--el-lightgreen);
  color: var(--el-green);
  white-space: nowrap;
}
/* 全セル白背景で統一（ゼブラのクリームはページ背景と同化するため無効化） */
.article-table tbody tr:nth-child(odd) td {
  background: #fff;
}

@media (min-width: 768px) {
  .article-table {
    font-size: 0.95em;
  }
}

/* --- 2-3. カード積み上げ型 .table-cards --- */
/* モバイル: tr = 1枚のカード。td::before で data-label を復元。
   thead は sr-only（display:none にせずセマンティクスを維持）。 */
.table-cards {
  display: block; /* min-width:520px を継承した table box の横はみ出しを防ぐ（モバイル） */
  min-width: 0;
  border-collapse: collapse;
  width: 100%;
  background: transparent;
  font-size: 0.95em;
}
.table-cards thead,
.table-cards tbody {
  display: block;
}
.table-cards caption {
  caption-side: top;
  text-align: left;
  font-weight: 700;
  color: var(--el-green);
  padding: 0 0 8px;
}
/* sr-only（視覚的に隠すがスクリーンリーダーには残す） */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* モバイル: theadを視覚的に隠す（data-labelで各セルに見出しを復元）。
   !important を付けないことで @media (min-width:768px) の復帰ルールを効かせる。 */
.table-cards thead {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.table-cards tbody tr {
  display: block;
  margin: 0 0 14px;
  border: 1px solid var(--el-lightgreen);
  border-radius: var(--el-radius);
  box-shadow: 0 1px 4px rgba(31, 80, 56, 0.1);
  overflow: hidden;
  background: #fff;
}
.table-cards tbody th,
.table-cards tbody td {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 14px;
  border: none;
  border-bottom: 1px solid var(--el-line);
  text-align: right;
}
.table-cards tbody tr > :last-child {
  border-bottom: none;
}
.table-cards tbody td::before {
  content: attr(data-label);
  font-weight: 700;
  color: var(--el-green);
  text-align: left;
  flex: 0 0 40%;
}
/* 行頭見出しはカードのヘッダー帯にする */
.table-cards tbody th[scope="row"] {
  background: var(--el-green);
  color: #fff;
  font-weight: 700;
  justify-content: flex-start;
  text-align: left;
}
.table-cards tbody th[scope="row"]::before {
  content: none;
}

/* PC（768px〜）では通常のテーブルに戻す */
@media (min-width: 768px) {
  .table-cards {
    display: table; /* モバイルの display:block; min-width:0 を解除して通常テーブルへ復元 */
    min-width: 520px;
    border-collapse: collapse;
    border-radius: var(--el-radius);
    overflow: hidden;
  }
  .table-cards thead {
    /* sr-only を解除 */
    display: table-header-group;
    position: static;
    width: auto;
    height: auto;
    clip: auto;
    margin: 0;
    overflow: visible;
  }
  .table-cards tbody {
    display: table-row-group;
  }
  .table-cards thead th {
    background: var(--el-green);
    color: #fff;
    text-align: left;
    padding: 10px 14px;
    border: 1px solid var(--el-line);
  }
  .table-cards tbody tr {
    display: table-row;
    margin: 0;
    border: none;
    box-shadow: none;
  }
  .table-cards tbody th,
  .table-cards tbody td {
    display: table-cell;
    text-align: left;
    padding: 10px 14px;
    border: 1px solid var(--el-line);
  }
  .table-cards tbody td::before {
    content: none;
  }
  .table-cards tbody tr:nth-child(odd) td {
    background: #fff;
  }
  .table-cards tbody th[scope="row"] {
    background: var(--el-lightgreen);
    color: var(--el-green);
  }
}

/* --- 2-4. 比較表（最左列 sticky）.table-sticky-first --- */
.table-sticky-first {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--el-radius);
}
.table-sticky-first .article-table {
  min-width: 640px;
}
.table-sticky-first thead th:first-child,
.table-sticky-first tbody th:first-child,
.table-sticky-first tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
}
/* sticky セルは背景不透明必須（下の列が透けないように） */
.table-sticky-first tbody th:first-child,
.table-sticky-first tbody td:first-child {
  background: var(--el-lightgreen);
  color: var(--el-green);
  font-weight: 700;
  box-shadow: 2px 0 4px rgba(31, 80, 56, 0.12);
}
.table-sticky-first thead th:first-child {
  z-index: 3;
  background: var(--el-green-d);
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.18);
}
