/* きんたいさん取扱説明書(pleasure-lab.com/kintaisan/manual/)専用。
   色・角丸・余白の変数は css/home.css のものを使う。
   原本は kintaisan リポジトリの tools/manual/site/。直すのはそちら。 */

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.manual { padding: 0 var(--gutter) 4rem; }
.manual-wrap { max-width: 1080px; margin: 0 auto; }

/* ---- 見出しまわり */
.manual-hero { padding: 1rem 0 2rem; }
.manual-hero h1 { font-size: clamp(2rem, 6vw, 3.4rem); font-weight: 700; line-height: 1.25; letter-spacing: -.05em; margin: .5rem 0 1rem; }
.manual-hero .lead { font-size: 1.0625rem; line-height: 1.95; color: var(--muted); max-width: 42rem; }

/* ---- 検索 */
.manual-search { position: relative; margin: 1.5rem 0 0; max-width: 42rem; }
.manual-search label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .5rem; }
.manual-search input { width: 100%; min-height: 52px; padding: .8rem 1.2rem; border: 1px solid var(--ink); border-radius: 999px; background: var(--surface); font: inherit; font-size: 1rem; color: var(--ink); }
.manual-search input:focus-visible { outline: 3px solid var(--acid); outline-offset: 2px; }
.search-results { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .5rem; }
.search-results a { display: block; padding: .8rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.search-results a:hover { border-color: var(--ink); }
.search-results strong { display: block; font-size: 1rem; line-height: 1.6; }
.search-results span { display: block; font-size: .8125rem; color: var(--muted); line-height: 1.7; }
.search-status { font-size: .875rem; color: var(--muted); margin-top: .75rem; }
.search-status:empty, .search-results:empty { display: none; }

/* ---- 入口の目次カード */
.feature-card { display: grid; gap: .5rem; padding: 1.6rem 1.75rem; margin: 2rem 0 0; border-radius: var(--radius-md); background: var(--acid); color: var(--ink); }
.feature-card .eyebrow { color: #3f4c18; }
.feature-card h2 { font-size: clamp(1.35rem, 3.6vw, 1.75rem); font-weight: 700; line-height: 1.45; letter-spacing: -.03em; }
.feature-card p { line-height: 1.85; }
.feature-card .more { font-weight: 600; margin-top: .25rem; }
.feature-card .more::after { content: ' →'; }
.feature-card:hover { transform: translateY(-2px); }
.feature-card { transition: transform .2s; }

.chapter-grid { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; counter-reset: chapter; }
.chapter-grid a { display: grid; gap: .3rem; height: 100%; padding: 1.2rem 1.3rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-soft); transition: transform .2s, border-color .2s; }
.chapter-grid a:hover { transform: translateY(-2px); border-color: var(--ink); }
.chapter-grid .num { font-size: .75rem; color: var(--muted); font-weight: 600; letter-spacing: .08em; }
.chapter-grid strong { font-size: 1.0625rem; line-height: 1.55; letter-spacing: -.02em; }
.chapter-grid small { color: var(--muted); font-size: .875rem; line-height: 1.7; }

/* ---- 本文 */
.manual-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; }
.manual-toc { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.manual-toc summary { cursor: pointer; padding: 1rem 1.25rem; font-weight: 600; min-height: 52px; display: flex; align-items: center; }
.manual-toc ol { list-style: none; margin: 0; padding: 0 1.25rem 1rem; display: grid; gap: .1rem; }
.manual-toc a { display: block; padding: .5rem 0; line-height: 1.6; }
.manual-toc a:hover { text-decoration: underline; text-underline-offset: .3em; }

.prose { min-width: 0; font-size: 1.0625rem; line-height: 2; overflow-wrap: anywhere; }
.prose h2 { font-size: clamp(1.4rem, 4vw, 1.85rem); font-weight: 700; line-height: 1.5; letter-spacing: -.035em; margin: 3.25rem 0 1rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.prose h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.prose h3 { font-size: 1.25rem; font-weight: 700; line-height: 1.55; margin: 2.25rem 0 .75rem; padding-left: .8rem; border-left: 4px solid var(--acid-deep); }
.prose h4 { font-size: 1.0625rem; font-weight: 700; margin: 1.75rem 0 .5rem; }
.prose h5, .prose h6 { font-size: 1rem; font-weight: 700; margin: 1.5rem 0 .5rem; }
.prose :is(h2, h3, h4, h5, h6) { scroll-margin-top: 6.5rem; }
.prose p { margin: 0 0 1.1rem; }
.prose ul, .prose ol { margin: 0 0 1.25rem; padding-left: 1.5rem; }
.prose li { margin-bottom: .4rem; padding-left: .2rem; }
.prose strong { font-weight: 700; background: linear-gradient(transparent 62%, rgb(197 242 59 / .55) 62%); }
.prose code { padding: .1em .4em; border-radius: 6px; background: #eceee4; font-size: .92em; }
.prose a { color: var(--acid-deep); text-decoration: underline; text-underline-offset: .25em; }
.prose a:hover { color: var(--ink); }
.table-scroll { overflow-x: auto; margin: 0 0 1.5rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); -webkit-overflow-scrolling: touch; }
.prose table { border-collapse: collapse; min-width: 100%; font-size: .9375rem; line-height: 1.7; }
.prose th, .prose td { padding: .65rem .85rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { background: #eceee4; white-space: nowrap; }
.prose tr:last-child td { border-bottom: 0; }
mark { background: var(--acid); color: inherit; border-radius: 3px; }

/* ---- 前後の章 */
.chapter-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; margin-top: 3.5rem; }
.chapter-nav a { display: grid; gap: .25rem; padding: 1.1rem 1.3rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); min-height: 72px; }
.chapter-nav a:hover { border-color: var(--ink); }
.chapter-nav small { color: var(--muted); font-size: .8125rem; }
.chapter-nav strong { line-height: 1.5; }
.chapter-nav .next { text-align: right; grid-column: 2; }
.chapter-nav .prev { grid-column: 1; }
.back-top { display: inline-block; margin-top: 1.5rem; font-size: .9375rem; color: var(--muted); }

/* ---- 送受信のページ */
.flow-steps { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; counter-reset: step; }
.flow-steps li { position: relative; padding: 1.2rem 1.3rem 1.3rem; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--line); counter-increment: step; }
.flow-steps li::before { content: counter(step); display: grid; place-items: center; width: 2rem; height: 2rem; margin-bottom: .6rem; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 700; }
.flow-steps strong { display: block; font-size: 1.0625rem; line-height: 1.55; margin-bottom: .3rem; }
.flow-steps p { font-size: .9375rem; line-height: 1.8; color: var(--muted); margin: 0; }

.share-case { margin: 3rem 0 0; padding-top: 2.5rem; border-top: 1px solid var(--line); scroll-margin-top: 6.5rem; }
.share-case h2 { font-size: clamp(1.4rem, 4vw, 1.85rem); line-height: 1.5; letter-spacing: -.035em; margin: 0 0 .5rem; }
.share-case .dir { display: inline-flex; align-items: center; gap: .5rem; font-size: .8125rem; font-weight: 600; padding: .25rem .8rem; border-radius: 999px; background: var(--acid); }
.share-case .dir.rev { background: var(--ink); color: #fff; }
.share-figure { margin: 1.25rem 0; }
.share-figure img { display: block; width: 100%; height: auto; }
.share-points { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.share-points li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .75rem; padding: .85rem 1.1rem; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); line-height: 1.85; font-size: 1rem; }
.share-points b { font-size: .875rem; color: var(--acid-deep); line-height: 2; }
.callout { margin: 2.5rem 0 0; padding: 1.3rem 1.5rem; border-left: 4px solid var(--acid-deep); border-radius: var(--radius-sm); background: var(--surface); }
.callout h3 { font-size: 1rem; margin: 0 0 .4rem; padding: 0; border: 0; }
.callout p { margin: 0; line-height: 1.9; color: var(--muted); }
.callout p + p { margin-top: .5rem; }

@media (min-width: 1000px) {
    .manual-layout.has-toc { grid-template-columns: 250px minmax(0, 1fr); gap: 3rem; align-items: start; }
    .manual-layout.has-toc .manual-toc { position: sticky; top: 6.5rem; max-height: calc(100vh - 8rem); overflow-y: auto; }
    .manual-toc[open] summary { pointer-events: none; }
}

@media (max-width: 700px) {
    .manual { padding-left: 1.25rem; padding-right: 1.25rem; }
    .chapter-grid, .flow-steps { grid-template-columns: 1fr; }
    .chapter-nav { grid-template-columns: 1fr; }
    .chapter-nav .next, .chapter-nav .prev { grid-column: 1; text-align: left; }
    .prose { font-size: 1rem; line-height: 1.95; }
    /* 表は1行を1枚のカードにして縦に積む(横にスクロールさせない) */
    .table-scroll { border: 0; background: none; overflow: visible; }
    .prose table, .prose tbody, .prose tr, .prose td { display: block; }
    .prose thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .prose tr { margin-bottom: .9rem; padding: .5rem 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
    .prose td { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: .6rem; padding: .3rem .95rem; border: 0; }
    .prose td::before { content: attr(data-label); font-size: .8125rem; font-weight: 600; color: var(--muted); }
    .share-points li { grid-template-columns: 1fr; gap: 0; }
    .share-points b { line-height: 1.7; }
    /* スマホでは縦長の図に切り替わる(build_site_pages.py の figure_picture)。広げすぎない */
    .share-figure img { max-width: 420px; margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
    .feature-card, .chapter-grid a { transition: none; }
}

/* ---- 言語の切り替え・OS の印・設定の図 */
.lang-switch { display: flex; flex-wrap: wrap; gap: .4rem .5rem; margin: 0 0 1rem; font-size: .875rem; }
.lang-switch a, .lang-switch .current { padding: .3rem .85rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.lang-switch a:hover { border-color: var(--ink); }
.lang-switch .current { background: var(--ink); border-color: var(--ink); color: #fff; }
.os-badge { display: inline-block; padding: .05rem .6rem; border-radius: 999px; background: #e4ecff; color: #1f3c88; font-size: .75rem; font-weight: 700; letter-spacing: .02em; vertical-align: middle; }
.os-note { margin: .75rem 0 0; padding: .8rem 1rem; border-radius: var(--radius-sm); background: #f0f4ff; color: #1f3c88; font-size: .9375rem; line-height: 1.8; }
.chapter-grid .num .os-badge { margin-left: .5rem; }
.doc-figure { margin: 1.75rem 0; }
.doc-figure img { display: block; width: 100%; max-width: 640px; height: auto; margin: 0 auto; border-radius: var(--radius-md); }
.doc-screen img { max-width: 300px; border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.doc-screen figcaption { text-align: center; }
.doc-figure figcaption { max-width: 640px; margin: .6rem auto 0; color: var(--muted); font-size: .9375rem; line-height: 1.8; }
