/* 記事ページ（/ja/guide/）。色・書体は style.css のトークンを使う。スマホで読む前提（横の余白16px・本文17px・行間1.95） */
body.guide { background: var(--bg); }
/* LP の見出しは keep-all（語の途中で折り返さない）だが、記事の長い見出しは画面からはみ出すので普通に折り返す */
html[lang="ja"] body.guide :is(h1, h2, h3, h4) { word-break: normal; overflow-wrap: anywhere; line-break: strict; }
body.guide .tw-wrap, body.guide .tw-body { min-width: 0; }
.tw-article { padding: 16px 0 72px; }
.tw-wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* パンくず */
.tw-crumb { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 22px; }
.tw-crumb a { color: var(--muted); text-decoration: none; }
.tw-crumb a:hover { color: var(--accent-ink); text-decoration: underline; }

/* 見出しまわり */
.tw-head { margin: 0 0 22px; }
.tw-chip { display: inline-block; margin: 0 0 12px; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12.5px; font-weight: 700; letter-spacing: .04em; }
.tw-article h1 { font-size: clamp(25px, 6.4vw, 36px); line-height: 1.42; margin: 0 0 14px; letter-spacing: .01em; font-weight: 800; }
.tw-lead { font-size: 16px; line-height: 1.85; color: var(--fg-soft); margin: 0 0 16px; }
.tw-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); margin: 0; padding-top: 14px; border-top: 1px solid var(--border); }
/* 区切り点は項目の後ろに付ける（前に付けると、折り返した行の頭で本文の左端からはみ出す） */
.tw-meta span:not(:last-child)::after { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: #c2cbd8; margin: 0 0 3px 10px; vertical-align: middle; }
/* 導入文: タイトル直下。読み続けてもらう2〜3文なので本文より少し大きく */
.tw-intro { margin: 0 0 22px; font-size: 17.5px; }
.tw-intro p:last-child { margin-bottom: 0; }
.tw-head .tw-meta { margin-bottom: 18px; }
.tw-eyecatch { display: block; width: 100%; height: auto; border-radius: var(--radius-lg); margin: 0 0 26px; box-shadow: var(--shadow-sm); }

/* 目次 */
.tw-toc { margin: 0 0 34px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.tw-toc summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; cursor: pointer; list-style: none; background: var(--bg-tint); }
.tw-toc summary::-webkit-details-marker { display: none; }
.tw-toc summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin-left: auto; transition: transform .2s; }
.tw-toc details[open] summary::after { transform: rotate(-135deg); }
.tw-toc-title { font-weight: 800; font-size: 15px; }
.tw-toc-count { font-size: 12.5px; color: var(--muted); }
.tw-toc ol { margin: 0; padding: 8px 18px 14px 18px; list-style: none; counter-reset: toc; }
.tw-toc li { counter-increment: toc; display: flex; gap: 10px; padding: 7px 0; border-top: 1px dashed var(--border); line-height: 1.55; font-size: 14.5px; }
.tw-toc li:first-child { border-top: 0; }
.tw-toc li::before { content: counter(toc, decimal-leading-zero); flex: none; font: 700 12px/1.9 ui-monospace, "SF Mono", Menlo, monospace; color: var(--accent); }
.tw-toc a { color: var(--fg); text-decoration: none; }
.tw-toc a:hover { color: var(--accent-ink); text-decoration: underline; }

/* 本文 */
.tw-body { font-size: 17px; line-height: 1.95; color: var(--fg); counter-reset: h2; }
.tw-body p { margin: 0 0 1.25em; }
.tw-body h2 { counter-increment: h2; position: relative; font-size: clamp(21px, 5.2vw, 25px); line-height: 1.5; margin: 2.6em 0 .9em; padding: 0 0 .5em; border-bottom: 2px solid var(--border); scroll-margin-top: 84px; font-weight: 800; }
.tw-body h2::before { content: counter(h2, decimal-leading-zero); display: block; font: 800 13px/1 ui-monospace, "SF Mono", Menlo, monospace; color: var(--accent); letter-spacing: .08em; margin-bottom: 10px; }
.tw-body h2::after { content: ""; position: absolute; left: 0; bottom: -2px; width: 64px; height: 2px; background: var(--grad); }
.tw-body h3 { font-size: clamp(18px, 4.6vw, 20px); line-height: 1.55; margin: 2em 0 .65em; padding-left: .7em; border-left: 4px solid var(--accent-2); font-weight: 700; }
.tw-body h4 { font-size: 17px; margin: 1.6em 0 .5em; }
.tw-body ul, .tw-body ol { margin: 0 0 1.4em; padding: 14px 18px 14px 2.2em; background: var(--bg-tint); border-radius: var(--radius); }
.tw-body li { margin: .35em 0; line-height: 1.8; }
.tw-body li::marker { color: var(--accent); font-weight: 700; }
.tw-body strong { background: linear-gradient(transparent 62%, #d9e6ff 62%); font-weight: 700; }
.tw-body a { color: var(--accent-ink); }

/* 表（スマホでは横にスクロール） */
.tw-body table { width: 100%; table-layout: auto; border-collapse: separate; border-spacing: 0; margin: 0 0 1.6em; font-size: 14.5px; line-height: 1.6; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tw-body thead th { background: #eef3fb; color: var(--fg); font-weight: 700; font-size: 13.5px; }
.tw-body th, .tw-body td { padding: 9px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.tw-body tbody tr:nth-child(even) td { background: var(--surface-2); }
.tw-body tbody tr:last-child td { border-bottom: 0; }
.tw-body td:first-child { font-weight: 600; }
.tw-body td:not(:first-child) { font-variant-numeric: tabular-nums; }
@media (min-width: 600px) { .tw-body table { font-size: 15px; } .tw-body th, .tw-body td { padding: 10px 14px; } }

/* 図 */
.tw-fig { margin: 2em 0; padding: 0; }
.tw-fig img, .tw-fig svg { display: block; width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; }
.tw-fig figcaption { font-size: 13px; color: var(--muted); margin-top: 10px; line-height: 1.6; }
.tw-fig.tw-missing { padding: 26px; border: 2px dashed var(--partial); border-radius: var(--radius); color: var(--muted); text-align: center; font-size: 14px; }

/* アプリ紹介のストアボタン */
.tw-store { margin: 1.6em 0 2em; padding: 18px; border-radius: var(--radius-lg); background: linear-gradient(135deg, #f3f7ff 0%, #eefbfd 100%); border: 1px solid #dbe6fb; }
.tw-store-app { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.tw-store-icon { width: 56px; height: 56px; border-radius: 14px; box-shadow: var(--shadow-sm); flex: none; }
.tw-store-name { margin: 0 !important; font-weight: 800; font-size: 16px; line-height: 1.4; }
.tw-store-sub { margin: 2px 0 0 !important; font-size: 13px; line-height: 1.6; color: var(--fg-soft); }
.tw-store-badges { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tw-store-badges img { height: 46px; width: auto; display: block; }

/* 出典・筆者・関連 */
.tw-sources { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--border); }
.tw-sources h2 { font-size: 15px; margin: 0 0 8px; color: var(--fg-soft); }
.tw-sources ul { font-size: 13.5px; line-height: 1.75; padding-left: 1.2em; color: var(--fg-soft); margin: 0; }
.tw-sources a { color: var(--fg-soft); }
.tw-author { display: flex; gap: 14px; align-items: flex-start; margin-top: 28px; padding: 18px; border-radius: var(--radius); background: var(--bg-tint); border: 1px solid var(--border); font-size: 14px; line-height: 1.8; color: var(--fg-soft); }
.tw-author-icon { width: 48px; height: 48px; border-radius: 12px; flex: none; }
.tw-author p { margin: 0; }
.tw-author-name { font-weight: 800; color: var(--fg); margin-bottom: 4px !important; }
.tw-related { margin-top: 44px; }
.tw-related h2 { font-size: 18px; margin: 0 0 12px; }
.tw-related ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.tw-related a, .tw-cards a { display: block; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--fg); background: var(--surface); box-shadow: var(--shadow-sm); font-weight: 700; line-height: 1.6; transition: border-color .15s, transform .15s; }
.tw-related a:hover, .tw-cards a:hover { border-color: #b9cdfa; transform: translateY(-1px); }

/* 記事一覧 */
.tw-group { margin: 30px 0; }
.tw-group h2 { font-size: 20px; margin: 0 0 12px; }
.tw-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.tw-cards .t { display: block; }
.tw-cards .d { display: block; font-size: 14px; color: var(--muted); margin-top: 4px; line-height: 1.6; font-weight: 400; }

/* 本文＋サイドバー。PC（1040px以上）は右に300pxのサイドバー、それより狭いと本文の下に並べる */
.tw-layout { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.tw-layout > .tw-wrap { padding: 0; max-width: 760px; }
@media (min-width: 1040px) {
  .tw-layout { display: grid; grid-template-columns: minmax(0, 760px) 300px; gap: 48px; justify-content: center; }
  .tw-layout > .tw-wrap { margin: 0; }
}

/* 記事一覧のカード（サムネイル付き） */
.tw-cards.tw-thumbs { gap: 16px; }
@media (min-width: 640px) { .tw-cards.tw-thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tw-cards.tw-thumbs a { padding: 0; overflow: hidden; display: flex; flex-direction: column; border-radius: var(--radius-lg); }
.tw-thumb { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; background: var(--bg-tint); }
.tw-thumb-none { background: linear-gradient(135deg, #eaf1ff 0%, #e6f8fb 100%); }
.tw-card-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.tw-cards.tw-thumbs .t { font-size: 16.5px; line-height: 1.55; }
.tw-cards.tw-thumbs .d { margin-top: 0; font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tw-card-date { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.tw-group { scroll-margin-top: 84px; }

/* サイドバー */
.tw-side { display: flex; flex-direction: column; gap: 18px; margin-top: 48px; }
@media (min-width: 1040px) { .tw-side { margin-top: 0; padding-top: 52px; } }
.tw-side-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; font-size: 14px; line-height: 1.75; color: var(--fg-soft); }
.tw-side-box p { margin: 0 0 10px; }
.tw-side-title { font-weight: 800; font-size: 15px; color: var(--fg); margin: 0 0 12px !important; padding-bottom: 10px; border-bottom: 2px solid var(--border); }
.tw-side-more { display: inline-block; font-weight: 700; font-size: 13.5px; color: var(--accent-ink); text-decoration: none; }
.tw-side-more::after { content: " ›"; }
.tw-side-more:hover { text-decoration: underline; }
.tw-side-list, .tw-side-cats, .tw-side-toc ol { list-style: none; margin: 0; padding: 0; }
.tw-side-list li + li { margin-top: 12px; }
.tw-side-list a { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: start; text-decoration: none; color: var(--fg); font-weight: 700; font-size: 13.5px; line-height: 1.55; }
.tw-side-list .tw-thumb { border-radius: 8px; }
.tw-side-list a:hover span { color: var(--accent-ink); }
.tw-side-cats li + li { border-top: 1px dashed var(--border); }
.tw-side-cats a { display: flex; justify-content: space-between; align-items: center; padding: 9px 2px; text-decoration: none; color: var(--fg); font-weight: 600; }
.tw-side-cats a:hover { color: var(--accent-ink); }
.tw-side-cats .n { font-size: 12px; color: var(--muted); background: var(--bg-tint); border-radius: 999px; padding: 1px 9px; }
.tw-side-app { background: linear-gradient(135deg, #f3f7ff 0%, #eefbfd 100%); border-color: #dbe6fb; }
.tw-side-app-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.tw-side-app-head img { width: 44px; height: 44px; border-radius: 11px; box-shadow: var(--shadow-sm); flex: none; }
.tw-side-app-head p { margin: 0 !important; display: flex; flex-direction: column; line-height: 1.45; }
.tw-side-app-head strong { color: var(--fg); font-size: 15px; }
.tw-side-app-head span { font-size: 12.5px; }
/* 目次はPCだけ。本文の目次とは別に、読み進めても右に残る */
.tw-side-toc { display: none; }
@media (min-width: 1040px) {
  .tw-side-toc { display: block; position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow: auto; }
  .tw-side-toc li { counter-increment: stoc; }
  .tw-side-toc ol { counter-reset: stoc; }
  .tw-side-toc a { display: flex; gap: 8px; padding: 6px 0; font-size: 13px; line-height: 1.55; color: var(--fg-soft); text-decoration: none; }
  .tw-side-toc a::before { content: counter(stoc, decimal-leading-zero); flex: none; font: 700 11px/1.9 ui-monospace, "SF Mono", Menlo, monospace; color: var(--accent); }
  .tw-side-toc a:hover { color: var(--accent-ink); }
}
