/* 記事の中の «動く図解»（src/lib/rich-explain.mjs・docs/media/EXPLAIN_ANIM_PLAN.md）
   - JS が無い・動きを減らす設定では、全部の場面が並んだ完成形（何も隠さない）
   - JS（/media/rich-explain.js）が .is-armed を付けると、いまの場面（.is-on）だけが光り、線の上を点が流れる。1 周したら .is-done で全部を見せて止まる
   - 色はメディアの色（--color_main） */

.post_content .kv-ex,.kv-ex{
  --ex-c:var(--color_main,#1a7f5a);--ex-ink:#14171f;--ex-sub:#5b6472;--ex-line:#dfe4ea;--ex-bg:#fff;--ex-soft:#f4f7f9;
  --ex-ease:cubic-bezier(.2,.8,.2,1);
  container-type:inline-size;position:relative;display:flex;flex-direction:column;gap:16px;
  margin:2.2em 0;padding:22px 22px 18px;border:1px solid var(--ex-line);border-radius:16px;background:var(--ex-bg);color:var(--ex-ink);
  font-size:15px;line-height:1.6;min-width:0
}
.kv-ex .kv-ex__title{display:block;font-size:17px;font-weight:800;line-height:1.45}
.kv-ex .kv-ex__sr{position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip:rect(0 0 0 0)!important;white-space:nowrap!important}
.kv-ex .kv-ex__ico{width:26px;height:26px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex:none}

/* ---- 流れ・手順 ---- */
.kv-ex .kv-ex__scenes{position:relative;display:grid;grid-template-columns:repeat(var(--n),minmax(0,1fr));gap:14px;margin:0;padding:0;list-style:none;counter-reset:none}
.kv-ex .kv-ex__scenes::before{content:"";position:absolute;left:calc(50% / var(--n));right:calc(50% / var(--n));top:30px;height:3px;border-radius:3px;background:var(--ex-line)}
.kv-ex .kv-ex__scene{position:relative;display:flex;flex-direction:column;align-items:center;text-align:center;gap:8px;margin:0;padding:0;transition:opacity .5s var(--ex-ease),transform .5s var(--ex-ease)}
.kv-ex .kv-ex__badge{position:relative;z-index:1;display:grid;place-items:center;width:60px;height:60px;border-radius:50%;background:var(--ex-soft);color:var(--ex-c);border:2px solid var(--ex-c);transition:background .4s,color .4s,box-shadow .4s,transform .4s var(--ex-ease)}
.kv-ex .kv-ex__no{position:absolute;right:-4px;top:-4px;display:grid;place-items:center;width:22px;height:22px;border-radius:50%;background:var(--ex-c);color:#fff;font-size:12px;font-weight:800;line-height:1}
.kv-ex .kv-ex__label{font-size:15px;font-weight:800;line-height:1.4}
.kv-ex .kv-ex__text{font-size:13.5px;color:var(--ex-sub);line-height:1.6}

/* 動いているとき: いまの場面だけ光る・過ぎた場面は色が残る・これからの場面は薄い */
.kv-ex.is-armed:not(.is-done) .kv-ex__scene{opacity:.35;transform:translateY(4px)}
.kv-ex.is-armed .kv-ex__scene.is-past{opacity:.75;transform:none}
.kv-ex.is-armed .kv-ex__scene.is-on{opacity:1;transform:none}
.kv-ex.is-armed .kv-ex__scene.is-on .kv-ex__badge{background:var(--ex-c);color:#fff;transform:scale(1.08);box-shadow:0 0 0 8px color-mix(in srgb,var(--ex-c) 18%,transparent);animation:kvex-pulse 1.6s var(--ex-ease) infinite}
.kv-ex.is-armed .kv-ex__scene.is-past .kv-ex__badge{background:var(--ex-c);color:#fff}
/* 線の上を流れる点（いまの場面へ向かう） */
.kv-ex.is-armed .kv-ex__scene.is-on:not(:first-child)::before{content:"";position:absolute;z-index:2;top:25px;left:calc(-50% - 7px);width:12px;height:12px;border-radius:50%;background:var(--ex-c);animation:kvex-run .9s var(--ex-ease) forwards}
@keyframes kvex-run{from{transform:translateX(0);opacity:1}to{transform:translateX(calc(100cqi / var(--n)));opacity:0}}
@keyframes kvex-pulse{0%,100%{box-shadow:0 0 0 6px color-mix(in srgb,var(--ex-c) 20%,transparent)}50%{box-shadow:0 0 0 12px color-mix(in srgb,var(--ex-c) 6%,transparent)}}

/* 狭い画面: 縦に並べる（線も縦） */
@container (max-width:560px){
  .kv-ex .kv-ex__scenes{grid-template-columns:1fr;gap:12px}
  .kv-ex .kv-ex__scenes::before{left:29px;right:auto;top:30px;bottom:30px;width:3px;height:auto}
  .kv-ex .kv-ex__scene{display:grid;grid-template-columns:60px 1fr;grid-template-rows:auto auto;align-items:center;text-align:left;column-gap:14px;row-gap:2px}
  .kv-ex .kv-ex__badge{grid-row:1/3}
  .kv-ex .kv-ex__label{align-self:end}
  .kv-ex .kv-ex__text{align-self:start}
  .kv-ex.is-armed .kv-ex__scene.is-on:not(:first-child)::before{display:none}
}

/* ---- 違い（比べる表） ---- */
.kv-ex .kv-ex__tw{overflow-x:auto}
.kv-ex .kv-ex__table{width:100%;border-collapse:separate;border-spacing:0;font-size:14px;line-height:1.6}
.kv-ex .kv-ex__table th,.kv-ex .kv-ex__table td{padding:12px 12px;border-bottom:1px solid var(--ex-line);text-align:left;vertical-align:top}
.kv-ex .kv-ex__table thead th{font-size:15px;font-weight:800;color:var(--ex-c);border-bottom:2px solid var(--ex-c)}
.kv-ex .kv-ex__table thead th span{vertical-align:middle;margin-left:6px}
.kv-ex .kv-ex__table thead .kv-ex__ico{vertical-align:middle}
.kv-ex .kv-ex__table tbody th{width:22%;font-weight:800;color:var(--ex-ink);white-space:nowrap}
.kv-ex .kv-ex__row{transition:opacity .5s var(--ex-ease),transform .5s var(--ex-ease),background .4s}
.kv-ex.is-armed:not(.is-done) .kv-ex__row{opacity:0;transform:translateX(-10px)}
.kv-ex.is-armed .kv-ex__row.is-past{opacity:1;transform:none}
.kv-ex.is-armed .kv-ex__row.is-on{opacity:1;transform:none;background:color-mix(in srgb,var(--ex-c) 8%,transparent)}
@container (max-width:480px){.kv-ex .kv-ex__table tbody th{white-space:normal;width:26%}.kv-ex .kv-ex__table th,.kv-ex .kv-ex__table td{padding:10px 8px}}

/* ---- 操作・要点 ---- */
.kv-ex .kv-ex__dots{display:flex;justify-content:center;gap:6px}
.kv-ex .kv-ex__dot{width:44px;height:44px;margin:0;padding:0;border:0;background:transparent;cursor:pointer;position:relative}
.kv-ex .kv-ex__dot::after{content:"";position:absolute;inset:0;margin:auto;width:10px;height:10px;border-radius:50%;background:var(--ex-line);transition:background .3s,transform .3s}
.kv-ex .kv-ex__dot[aria-current="step"]::after{background:var(--ex-c);transform:scale(1.3)}
.kv-ex .kv-ex__dot:focus-visible{outline:3px solid var(--ex-c);outline-offset:-6px;border-radius:50%}
.kv-ex .kv-ex__ctrl{display:flex;justify-content:flex-end;gap:8px;margin-top:-6px}
.kv-ex .kv-ex__btn{min-height:44px;padding:0 16px;border:1px solid var(--ex-line);border-radius:22px;background:#fff;color:var(--ex-ink);font-size:13.5px;font-weight:700;cursor:pointer}
.kv-ex .kv-ex__btn:hover{border-color:var(--ex-c)}
.kv-ex .kv-ex__btn:focus-visible{outline:3px solid var(--ex-c);outline-offset:2px}
.kv-ex .kv-ex__btn:disabled{opacity:.4;cursor:default}
.kv-ex .kv-ex__sum{margin:0;padding:12px 14px;border-radius:10px;background:var(--ex-soft);font-size:14.5px;line-height:1.7}
.kv-ex .kv-ex__sum b{color:var(--ex-c)}
.kv-ex .kv-ex__caution{display:flex;gap:8px;align-items:flex-start;margin:0;font-size:13.5px;color:#7a4d00;line-height:1.6}
.kv-ex .kv-ex__caution .kv-ex__ico{width:20px;height:20px;color:#b26b00;margin-top:2px}
.kv-ex .kv-ex__src{display:block;font-size:12px;color:var(--ex-sub)}
@media (prefers-reduced-motion:reduce){.kv-ex *{animation:none!important;transition:none!important}}
/* SWELL の表の見た目（見出しの塗り・枠）を打ち消す */
.post_content .kv-ex .kv-ex__table,.post_content .kv-ex .kv-ex__table th,.post_content .kv-ex .kv-ex__table td{border-left:0!important;border-right:0!important;border-top:0!important}
.post_content .kv-ex .kv-ex__table thead th,.post_content .kv-ex .kv-ex__table thead td{background:transparent!important;color:var(--ex-c)!important;border-bottom:2px solid var(--ex-c)!important}
.post_content .kv-ex .kv-ex__table tbody th{background:transparent!important;color:var(--ex-ink)!important}
.post_content .kv-ex .kv-ex__table tbody td{background:transparent!important;border-bottom:1px solid var(--ex-line)!important}
.post_content .kv-ex .kv-ex__row.is-on td,.post_content .kv-ex .kv-ex__row.is-on th{background:color-mix(in srgb,var(--ex-c) 8%,transparent)!important}
.kv-ex [hidden]{display:none!important}
.kv-ex .kv-ex__table thead th{word-break:keep-all;overflow-wrap:normal}
@container (max-width:480px){.kv-ex .kv-ex__table thead .kv-ex__ico{display:none}.kv-ex .kv-ex__table thead th span{margin-left:0}}
/* 狭い画面の «違い»: 行の名前を上に 1 行・2 つの答えを下に横並び（見出しの列が 1 文字ずつ折れて、右の列がはみ出すのを防ぐ・2026-11-12） */
@container (max-width:480px){
  .kv-ex .kv-ex__table,.kv-ex .kv-ex__table thead,.kv-ex .kv-ex__table tbody{display:block;width:100%}
  .kv-ex .kv-ex__table tr{display:grid;grid-template-columns:1fr 1fr;column-gap:10px}
  .kv-ex .kv-ex__table thead td{display:none}
  .kv-ex .kv-ex__table thead th{padding:8px 4px;word-break:normal;overflow-wrap:anywhere;line-height:1.45}
  .kv-ex .kv-ex__table tbody th{grid-column:1/-1;width:auto;white-space:normal;padding:12px 4px 2px;border-bottom:0!important;font-size:14px}
  .kv-ex .kv-ex__table tbody td{padding:4px 4px 12px}
  .kv-ex .kv-ex__tw{overflow-x:visible}
}
