/*! cn-motion.css v1.0 (2026-10-16) — co-nect 5サイト共通モーション部品
 * 効く範囲：body.cn-motion の中だけ。属性 data-cn-* で宣言的に付ける。
 * 開始状態（隠す・縮める）は JS が画面外の要素に .cn-wait を付けたときだけ。JS無効・reduced-motion では最終状態のまま。
 * イージングは3乗系の1系統：入る＝--cn-out（easeOutCubic）、状態の間を動く＝--cn-io（easeInOutCubic）。
 * 移植元（数値の出典）：
 * Motion Prompt #002 · MIT License (c) 2026 Shohei Ohtaki · https://showheyohtaki.github.io/motion-prompt/#002
 * Motion Prompt #004 · MIT License (c) 2026 Shohei Ohtaki · https://showheyohtaki.github.io/motion-prompt/#004
 * Motion Prompt #052 · MIT License (c) 2026 Shohei Ohtaki · https://showheyohtaki.github.io/motion-prompt/#052
 * Motion Prompt #057 · MIT License (c) 2026 Shohei Ohtaki · https://showheyohtaki.github.io/motion-prompt/#057
 * Motion Prompt #063 · MIT License (c) 2026 Shohei Ohtaki · https://showheyohtaki.github.io/motion-prompt/#063
 * Motion Prompt #065 · MIT License (c) 2026 Shohei Ohtaki · https://showheyohtaki.github.io/motion-prompt/#065
 * Motion Prompt #068 · MIT License (c) 2026 Shohei Ohtaki · https://showheyohtaki.github.io/motion-prompt/#068
 * Motion Prompt #070 · MIT License (c) 2026 Shohei Ohtaki · https://showheyohtaki.github.io/motion-prompt/#070
 * Motion Prompt #079 · MIT License (c) 2026 Shohei Ohtaki · https://showheyohtaki.github.io/motion-prompt/#079
 * Motion Prompt #080 · MIT License (c) 2026 Shohei Ohtaki · https://showheyohtaki.github.io/motion-prompt/#080
 * Motion Prompt #081 · MIT License (c) 2026 Shohei Ohtaki · https://showheyohtaki.github.io/motion-prompt/#081
 * Motion Prompt #082 · MIT License (c) 2026 Shohei Ohtaki · https://showheyohtaki.github.io/motion-prompt/#082
 * Motion Prompt #086 · MIT License (c) 2026 Shohei Ohtaki · https://showheyohtaki.github.io/motion-prompt/#086
 */

/* ---- サイトごとに上書きする値（ブランド色とスコープ） ---- */
.cn-motion {
  --cn-accent: #F85602;               /* 強調（線・点・弾む数字） */
  --cn-ink: #1A1A1A;
  --cn-line: #E6E2DD;                 /* 未到達の線・読了バーの地 */
  --cn-mark: rgba(248, 86, 2, .18);   /* マーカー（#080の黄色をブランドの薄いオレンジに置換） */
  --cn-out: cubic-bezier(.33, 1, .68, 1);   /* easeOutCubic = kit eOut */
  --cn-io: cubic-bezier(.65, 0, .35, 1);    /* easeInOutCubic = kit eIO */
}

/* ================= #002 スタガー：棒が順に伸びる ================= */
/* 開始 0.15 + 0.12×i 秒・0.5秒。仕様の backOut（行き過ぎ）は1系統イージングのため easeOutCubic に置換 */
.cn-motion [data-cn-bar] { transform-origin: 50% 100%; transform-box: fill-box; }
.cn-motion [data-cn-bars="x"] [data-cn-bar], .cn-motion [data-cn-bars="shrink"] [data-cn-bar] { transform-origin: 0 50%; }
.cn-motion .cn-wait[data-cn-bars] [data-cn-bar] { transform: scaleY(0); }
.cn-motion .cn-wait[data-cn-bars="x"] [data-cn-bar] { transform: scaleX(0); }
/* shrink：同じ長さ（--from）から本来の長さへ縮む（カルテ「離れていく」）。--from = 最大幅 / 本来の幅 */
.cn-motion .cn-wait[data-cn-bars="shrink"] [data-cn-bar] { transform: scaleX(var(--from, 1)); }
.cn-motion .cn-wait[data-cn-bars] [data-cn-bar-after] { opacity: 0; }

/* ================= #004 ラインドロー：SVGの線を描く ================= */
/* 対象の線に JS が pathLength="1" を付ける。1.55秒・easeInOutCubic */
.cn-motion .cn-wait[data-cn-draw] [pathLength="1"] { stroke-dasharray: 1; stroke-dashoffset: 1; }
.cn-motion .cn-wait[data-cn-draw] [data-cn-draw-after] { opacity: 0; }

/* ================= #080 マーカー ================= */
/* 線の高さ＝文字の下寄り（仕様：ベースラインの8px上〜3px下＝20px文字で .55em）。幅0→100%を0.8秒・easeOutCubic */
.cn-motion [data-cn-marker], .cn-motion [data-cn-after] {
  background-image: linear-gradient(var(--cn-mark), var(--cn-mark));
  background-repeat: no-repeat; background-position: 0 92%; background-size: 100% .55em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.cn-motion .cn-wait[data-cn-marker], .cn-motion .cn-wait [data-cn-marker],
.cn-motion .cn-wait[data-cn-ba] [data-cn-after] { background-size: 0 .55em; }

/* ================= 前後差（#086の線の伸び ＋ #080 ＋ #002の時差） ================= */
/* 取り消し線は行ごとに引く（折り返しても各行の中央に線）。data-cn-before / data-cn-after は文字を包む「インライン」の span に付ける */
.cn-motion [data-cn-before] {
  background-image: linear-gradient(var(--cn-strike, rgba(107, 114, 128, .75)), var(--cn-strike, rgba(107, 114, 128, .75)));
  background-repeat: no-repeat; background-position: 0 58%; background-size: 100% 2px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.cn-motion .cn-wait[data-cn-ba] [data-cn-before] { background-size: 0 2px; }

/* ================= #068 ステップインジケーター：順に点く ================= */
/* 1区間0.3秒・easeInOutCubic。段階 [data-cn-step] に JS が順に .is-on を付ける */
.cn-motion [data-cn-step-line] { transform-origin: 0 50%; }
.cn-motion [data-cn-step-line="y"] { transform-origin: 50% 0; }
.cn-motion .cn-wait [data-cn-step-line], .cn-motion .cn-in [data-cn-step]:not(.is-on) [data-cn-step-line],
.cn-motion .cn-in[data-cn-step]:not(.is-on) [data-cn-step-line] { transform: scaleX(0); }
.cn-motion .cn-wait [data-cn-step-line="y"], .cn-motion .cn-in [data-cn-step]:not(.is-on) [data-cn-step-line="y"] { transform: scaleY(0); }
.cn-motion .cn-wait [data-cn-step-dot], .cn-motion .cn-in [data-cn-step]:not(.is-on) [data-cn-step-dot] {
  background: #fff !important; color: var(--cn-ink) !important; box-shadow: inset 0 0 0 2px var(--cn-line);
}
/* 段階そのものを薄くしておく型（BEFORE/AFTERの並走など） */
.cn-motion .cn-wait [data-cn-step="dim"], .cn-motion .cn-in [data-cn-step="dim"]:not(.is-on) { opacity: .3; }
.cn-motion [data-cn-step="dim"].is-on { box-shadow: inset 0 -.5em 0 var(--cn-mark); }
/* 会話・リストが順に出る型（data-cn-seq="reveal"） */
.cn-motion .cn-wait[data-cn-seq="reveal"] [data-cn-step],
.cn-motion .cn-in[data-cn-seq="reveal"] [data-cn-step]:not(.is-on) { opacity: 0; transform: translateY(8px); }

/* ================= #079 読了バー ================= */
.cn-motion [data-cn-progress] {
  position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 1000;
  background: var(--cn-line); pointer-events: none;
}
.cn-motion [data-cn-progress]::after {
  content: ""; position: absolute; inset: 0; background: var(--cn-accent);
  transform-origin: 0 50%; transform: scaleX(var(--cn-p, 0));
}
@supports (animation-timeline: scroll()) {
  .cn-motion [data-cn-progress]::after { animation: cn-progress linear both; animation-timeline: scroll(root block); }
  @keyframes cn-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

/* ================= #057 タブ／目次の下線（JSが .cn-ind を差し込む） ================= */
.cn-motion [data-cn-tabs], .cn-motion [data-cn-toc] { position: relative; }
.cn-motion .cn-ind {
  position: absolute; left: 0; bottom: 0; width: 100px; height: 3px; background: var(--cn-accent);
  transform-origin: 0 0; pointer-events: none; opacity: 0;
}
.cn-motion [data-cn-toc] .cn-ind { top: 0; bottom: auto; width: 3px; height: 100px; }
.cn-motion .cn-ind.is-ready { opacity: 1; }

/* ================= #063 数字の弾み（値が変わったとき） ================= */
.cn-motion [data-cn-pop] { display: inline-block; transform-origin: 50% 60%; }

/* ================= #070 送信中 ================= */
.cn-motion .cn-busy { position: relative; color: transparent !important; pointer-events: none; }
.cn-motion .cn-busy > * { visibility: hidden; }
.cn-motion .cn-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; border-radius: 50%;
  /* 243°（1.35π）の弧＋薄い輪。太さは半径26:太さ6 の比を20pxに換算して約3px */
  background: conic-gradient(var(--cn-spin, #fff) 0 243deg, rgba(255, 255, 255, .35) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
}

/* ================= #052 アコーディオン ================= */
/* details：対応ブラウザ（::details-content）だけ高さが伸びる。非対応は従来どおり即開閉 */
.cn-motion details[data-cn-acc] { interpolate-size: allow-keywords; }
/* class で開閉する型（.open / .is-open の親）：中身を1枚の要素で包んで data-cn-acc-panel を付ける */
.cn-motion [data-cn-acc-panel] { display: grid !important; grid-template-rows: 0fr; }
.cn-motion [data-cn-acc-panel] > * { overflow: hidden; min-height: 0; }
.cn-motion .open > [data-cn-acc-panel], .cn-motion .is-open > [data-cn-acc-panel] { grid-template-rows: 1fr; }

/* ================= #065 ハンバーガー → × ================= */
.cn-motion [data-cn-burger] svg > * { transform-box: fill-box; transform-origin: center; }
.cn-motion [data-cn-burger][aria-expanded="true"] svg > :nth-child(1), .cn-motion details[open] > [data-cn-burger] svg > :nth-child(1) { transform: translateY(var(--cn-burger-gap, 8px)) rotate(45deg); }
.cn-motion [data-cn-burger][aria-expanded="true"] svg > :nth-child(2), .cn-motion details[open] > [data-cn-burger] svg > :nth-child(2) { opacity: 0; }
.cn-motion [data-cn-burger][aria-expanded="true"] svg > :nth-child(3), .cn-motion details[open] > [data-cn-burger] svg > :nth-child(3) { transform: translateY(calc(var(--cn-burger-gap, 8px) * -1)) rotate(-45deg); }

/* ================= #086 下線 ================= */
.cn-motion [data-cn-underline] { position: relative; text-decoration: none; }
.cn-motion [data-cn-underline]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -.3em; height: 2px;
  background: var(--cn-accent); transform: scaleX(0); transform-origin: 100% 50%; pointer-events: none;
}

/* ================= #082 画像ズーム（枠は動かさない） ================= */
.cn-motion [data-cn-zoom] { overflow: hidden; }

/* ======== 動き（reduced-motion では一切入れない） ======== */
@media (prefers-reduced-motion: no-preference) {
  .cn-motion .cn-in[data-cn-bars] [data-cn-bar] { transition: transform .5s var(--cn-out) calc(.15s + var(--i, 0) * .12s); }
  .cn-motion .cn-in[data-cn-bars] [data-cn-bar-after] { transition: opacity .3s var(--cn-out) calc(.65s + var(--n, 3) * .12s); }
  .cn-motion .cn-in[data-cn-draw] [pathLength="1"] { stroke-dasharray: 1; transition: stroke-dashoffset 1.55s var(--cn-io) calc(var(--i, 0) * .12s); }
  .cn-motion .cn-in[data-cn-draw] [data-cn-draw-after] { transition: opacity .3s var(--cn-out) 1.5s; }
  .cn-motion .cn-in[data-cn-marker], .cn-motion .cn-in [data-cn-marker] { transition: background-size .8s var(--cn-out) var(--d, 0s); }
  .cn-motion .cn-in[data-cn-ba] [data-cn-before] { transition: background-size .3s var(--cn-out) calc(var(--i, 0) * .12s); }
  .cn-motion .cn-in[data-cn-ba] [data-cn-after] { transition: background-size .8s var(--cn-out) calc(.3s + var(--i, 0) * .12s); }
  .cn-motion [data-cn-step-line] { transition: transform .3s var(--cn-io); }
  .cn-motion [data-cn-step-dot] { transition: background-color .3s var(--cn-io), color .3s var(--cn-io), box-shadow .3s var(--cn-io); }
  .cn-motion [data-cn-step="dim"] { transition: opacity .3s var(--cn-io), box-shadow .3s var(--cn-io); }
  .cn-motion [data-cn-seq="reveal"] [data-cn-step] { transition: opacity .5s var(--cn-out), transform .5s var(--cn-out); }
  .cn-motion .cn-ind { transition: transform .25s var(--cn-io), opacity .2s linear; }
  .cn-motion .cn-panel-in { animation: cn-panel .2s linear .1s both; }
  @keyframes cn-panel { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  /* #063：拡大率 1.18→1 を0.25秒で直線的に。その間は強調色 */
  .cn-motion .cn-popping { animation: cn-pop .25s linear; }
  @keyframes cn-pop { 0% { transform: scale(1.18); color: var(--cn-accent); } 99% { color: var(--cn-accent); } 100% { transform: none; } }
  /* #070：1秒に1.3回転（468°/秒 → 1回転0.769秒） */
  .cn-motion .cn-busy::after { animation: cn-spin .769s linear infinite; }
  @keyframes cn-spin { to { transform: rotate(360deg); } }
  /* #052：0.35秒・easeInOutCubic（仕様 1.0〜1.35秒） */
  .cn-motion details[data-cn-acc]::details-content { block-size: 0; overflow: clip; transition: block-size .35s var(--cn-io), content-visibility .35s allow-discrete; }
  .cn-motion details[data-cn-acc][open]::details-content { block-size: auto; }
  .cn-motion [data-cn-acc-panel] { transition: grid-template-rows .35s var(--cn-io); }
  .cn-motion [data-cn-acc-icon] { transition: transform .35s var(--cn-io); }
  /* #065：0.3秒・easeInOutCubic */
  .cn-motion [data-cn-burger] svg > * { transition: transform .3s var(--cn-io), opacity .3s var(--cn-io); }

  @media (hover: hover) {
    /* #081：0.3秒で上へ10px、影 ぼかし6→22・ずれ2→12・濃さ.08→.22 */
    .cn-motion [data-cn-lift] { transition: transform .3s var(--cn-out), box-shadow .3s var(--cn-out); box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }
    .cn-motion [data-cn-lift]:hover { transform: translateY(var(--cn-lift, -10px)); box-shadow: 0 12px 22px rgba(0, 0, 0, .22); }
    /* #082：0.5秒で中身 1→1.15（中心から） */
    .cn-motion [data-cn-zoom] img { transition: transform .5s var(--cn-out); }
    .cn-motion [data-cn-zoom]:hover img, .cn-motion a:hover [data-cn-zoom] img { transform: scale(var(--cn-zoom, 1.15)); }
    /* #086：乗ったら左から0.3秒、離れたら右へ抜ける */
    .cn-motion [data-cn-underline]::after { transition: transform .3s var(--cn-out); }
    .cn-motion [data-cn-underline]:hover::after { transform: scaleX(1); transform-origin: 0 50%; }
  }
}

/* ===================== WellCon 固有（2026-10-16） ===================== */
.cn-motion { --cn-accent: #ff6600; --cn-mark: rgba(255, 102, 0, .18); }

/* ロゴ：心電図の線を描く（#004）→ Well/Con を1字ずつ塗る（#002の時差）。kit/logos/wellcon.html */
.cn-logo-play .wc-logo-anim [data-cn-ch] { display: inline-block; }
.cn-logo-play .wc-logo-anim { --cn-io: cubic-bezier(.65, 0, .35, 1); }
/* v2（記事・一覧）の自前ヘッダー：塗りの色は wc-v2.css の Well/Con と同じ */
.wc-logo-anim .wc-logo-well { --f: #F85602; }
.wc-logo-anim .wc-logo-con { --f: #1A1A1A; }
.cn-logo-play .wc-logo-anim path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: cnDraw 1s var(--cn-io) both; }
@keyframes cnDraw { to { stroke-dashoffset: 0; } }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .cn-logo-play .wc-logo-anim [data-cn-ch] {
    color: transparent; -webkit-text-stroke: 1px var(--f);
    background: linear-gradient(var(--f), var(--f)) no-repeat 0 100% / 100% 0; -webkit-background-clip: text; background-clip: text;
    animation: cnFill .45s var(--cn-io) calc(.55s + var(--i) * .1s) both, cnStroke .25s linear calc(1s + var(--i) * .1s) both, cnDone 0s linear calc(1.25s + var(--i) * .1s) forwards;
  }
  .cn-logo-play .wc-logo-anim [data-cn-ch]:nth-child(even) { background-position: 0 0; }
}
@keyframes cnFill { to { background-size: 100% 100%; } }
@keyframes cnStroke { to { -webkit-text-stroke-color: transparent; } }
/* 描き終わり（各字の最後の動きが終わった時刻）に、元の文字と同じ描き方へ戻す（濃さ・字幅を静止版と同じに。動きは変えない） */
@keyframes cnDone { to { display: inline; color: var(--f); background: none; -webkit-background-clip: border-box; background-clip: border-box; -webkit-text-stroke: 0; } }

/* #007：数え上げ中に後ろの単位が左右にずれないよう、数字の幅を最終値の桁数で固定 */
.cn-motion [data-cn-count] { display: inline-block; font-variant-numeric: tabular-nums; min-width: var(--cn-w, auto); text-align: right; }

/* #068 導入の流れ：つなぎ線は STEP1→4 の点灯（0.3秒×3区間）に合わせて伸ばす */
.cn-motion .cn-flow-line { transform-origin: 0 50%; }
.cn-motion .cn-wait .cn-flow-line { transform: scaleX(0); }
@media (prefers-reduced-motion: no-preference) {
  .cn-motion .cn-flow-line { transition: transform .9s var(--cn-io); }
}

/* #052 FAQ：パディングは内側へ（閉じたときに余白が残らないように）。閉じた中身は読み上げ・タブ移動の対象外に */
.cn-motion .faq-answer[data-cn-acc-panel] { padding: 0; }
.cn-motion .cn-faq-a { padding: 0 0 1.25rem 3rem; }
.cn-motion .faq-item:not(.open) > [data-cn-acc-panel] > * { visibility: hidden; }
@media (prefers-reduced-motion: no-preference) {
  .cn-motion .faq-item > [data-cn-acc-panel] > * { transition: visibility 0s linear .35s; }
  .cn-motion .faq-item.open > [data-cn-acc-panel] > * { transition-delay: 0s; }
}

/* #060 プログラム切替：選択中のボタンの下に印（丸いボタンなので少し下へ離す） */
.cn-motion [data-cn-tabs="[data-tab-btn]"] .cn-ind { bottom: -10px; border-radius: 2px; }

/* #068 セルフ診断：「はい」の数で、改善優先度マップの4段階の現在地が順に点く */
.cn-motion .cn-sc-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 18px 0 0; padding: 0; list-style: none; }
.cn-motion .cn-sc-steps li { font-size: 11px; line-height: 1.4; color: rgba(255, 255, 255, .45); }
.cn-motion .cn-sc-steps li::before {
  content: ""; display: block; height: 4px; border-radius: 2px; margin-bottom: 6px;
  background: rgba(255, 255, 255, .15); box-shadow: inset 0 0 0 0 var(--cn-accent);
}
.cn-motion .cn-sc-steps li.is-on { color: #fff; }
.cn-motion .cn-sc-steps li.is-on::before { box-shadow: inset 300px 0 0 0 var(--cn-accent); }
@media (prefers-reduced-motion: no-preference) {
  .cn-motion .cn-sc-steps li { transition: color .3s var(--cn-io); }
  .cn-motion .cn-sc-steps li::before { transition: box-shadow .3s var(--cn-io); }
}
