/* =========================================================================
   Navispex — 使い方サイト
   アプリ(web/src/index.css)と同じトークン。ライト既定、prefers-color-scheme で反転。
   Web フォントは IBM Plex Mono だけ(数字・買い目・モデル名・コマンド)。
   本文は OS の日本語サンス。
   ========================================================================= */

:root {
  --bg: #eff3f7;
  --surface: #fff;
  --surface2: #e5ecf3;
  --ink: #121c26;
  --ink2: #3d4c5b;
  --muted: #5d6c7b;
  --line: #cfd9e3;
  --accent: #0a5fa8;
  --accent-soft: rgb(10 95 168 / .09);
  --ok: #16794a;
  --warn-bg: #fdf3d8;
  --warn-ink: #6d4d00;

  --l1: #f5f5f5;
  --l2: #2b2b2b;
  --l3: #d9342b;
  --l4: #2a6fd6;
  --l5: #f2d21f;
  --l6: #2e9b4f;

  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --body: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;

  --maxw: 1080px;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1620;
    --surface: #16212d;
    --surface2: #1f2d3c;
    --ink: #e8eef5;
    --ink2: #c3ceda;
    --muted: #8fa0b1;
    --line: #2a3a4b;
    --accent: #4fb0f5;
    --accent-soft: rgb(79 176 245 / .13);
    --ok: #56cf94;
    --warn-bg: #3a2e08;
    --warn-ink: #f2c14e;
  }
}

* { box-sizing: border-box; }
html { color-scheme: light dark; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.85;
}
img { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- header ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1rem;
  padding: .55rem clamp(1rem, 4vw, 2rem);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav__brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); flex-shrink: 0; }
.nav__brand:hover { text-decoration: none; }
.nav__mark { width: 30px; height: 30px; border-radius: 7px; }
.nav__name { font-size: 1.12rem; font-weight: 800; letter-spacing: .01em; }
.nav__name span { font-weight: 400; font-size: .92rem; color: var(--muted); margin-left: .35rem; }
.nav__menu { display: contents; }
.nav__toggle { display: none; list-style: none; }
.nav__toggle::-webkit-details-marker { display: none; }
.nav__links { display: flex; align-items: center; gap: .15rem; margin-left: auto; flex-wrap: wrap; }
.nav__link {
  color: var(--ink2); font-size: .9rem; padding: .3rem .65rem; border-radius: 7px;
}
.nav__link:hover { color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.nav__link.is-here { color: var(--accent); background: var(--accent-soft); font-weight: 700; }

/* ---------- doc layout(ヘルプ) ---------- */
.doc {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: 208px minmax(0, 1fr);
  gap: clamp(1.4rem, 3vw, 2.6rem);
  padding: 1.8rem clamp(1rem, 4vw, 2rem) 4rem;
}
.doc--plain { display: block; max-width: 940px; }
.side { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 88px); overflow: auto; }
.side__grp { font-size: .78rem; color: var(--muted); margin: 1.1rem 0 .3rem; }
.side__grp:first-child { margin-top: 0; }
.side__link {
  display: block; color: var(--ink2); font-size: .88rem; line-height: 1.5;
  padding: .32rem .6rem; border-left: 2px solid var(--line);
}
.side__link:hover { color: var(--accent); border-left-color: var(--accent); text-decoration: none; }
.side__link.is-here { color: var(--accent); border-left-color: var(--accent); font-weight: 700; background: var(--accent-soft); }
.main { min-width: 0; }
.crumb { font-family: var(--mono); font-size: .76rem; color: var(--muted); margin: 0 0 .6rem; }

/* ---------- typography ---------- */
h1, h2, h3 { line-height: 1.4; text-wrap: balance; }
h1 { font-size: clamp(1.55rem, 4vw, 2rem); font-weight: 800; margin: .1rem 0 .4rem; letter-spacing: -.01em; }
h2 { font-size: 1.24rem; font-weight: 700; margin: 2.6rem 0 .7rem; padding-top: .9rem; border-top: 1px solid var(--line); }
h3 { font-size: 1.02rem; font-weight: 700; margin: 1.7rem 0 .3rem; }
p { margin: .7rem 0; max-width: 66ch; }
ul, ol { padding-left: 1.3rem; max-width: 66ch; }
li { margin: .35rem 0; }
.lead { color: var(--ink2); font-size: 1.02rem; max-width: 56ch; margin: .4rem 0 1.6rem; }
.updated { font-family: var(--mono); font-size: .76rem; color: var(--muted); margin: .1rem 0 1rem; }
.tldr {
  margin: 0 0 1.7rem; padding: .8rem 1.1rem; max-width: 66ch;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: .93rem;
}
.tldr__t { font-weight: 700; font-size: .86rem; color: var(--muted); margin: 0 0 .35rem; }
.tldr ul { margin: 0; padding-left: 1.2rem; }
.tldr li { margin: .2rem 0; }
strong, b { font-weight: 700; }
small { color: var(--muted); font-size: .85rem; }

code {
  font-family: var(--mono); font-size: .86em;
  background: var(--surface2); border-radius: 4px; padding: .08em .38em;
  overflow-wrap: anywhere;
}
pre {
  font-family: var(--mono); font-size: .84rem; line-height: 1.65;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem 1.1rem; overflow-x: auto; margin: 1rem 0;
}
pre code { background: none; padding: 0; font-size: inherit; }

table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .92rem; }
th, td { text-align: left; padding: .5rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 700; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; }
.num { font-family: var(--mono); text-align: right; white-space: nowrap; }

/* ---------- callout ---------- */
.note {
  margin: 1.2rem 0; padding: .8rem 1.1rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  font-size: .93rem;
}
.note p:first-child { margin-top: 0; }
.note p:last-child { margin-bottom: 0; }
.note--warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--line); border-left-color: var(--warn-ink); }
.note--warn a { color: inherit; text-decoration: underline; }

/* ---------- スクリーンショット ---------- */
.shot { margin: 1.2rem 0 1.5rem; max-width: 330px; }
.shot img {
  display: block; width: 100%; height: auto;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 1px 2px rgb(18 28 38 / .06), 0 12px 30px rgb(18 28 38 / .09);
}
.shot figcaption { margin-top: .55rem; font-size: .82rem; line-height: 1.65; color: var(--muted); max-width: 42ch; }

/* ---------- 手順(画像つき) ---------- */
.walk { list-style: none; margin: 1.4rem 0 0; padding: 0; max-width: none; }
.walk > li {
  display: grid; grid-template-columns: 330px minmax(0, 1fr);
  column-gap: 2rem; align-items: start; margin: 0;
  padding: 1.6rem 0 1.8rem; border-top: 1px solid var(--line);
}
.walk > li:last-child { border-bottom: 1px solid var(--line); }
.walk__h {
  grid-column: 1 / -1; margin: 0 0 .2rem; max-width: none;
  display: flex; align-items: baseline; gap: .7rem;
}
.walk__n {
  flex-shrink: 0; font-family: var(--mono); font-size: .82rem; font-weight: 600;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: .12rem .6rem; line-height: 1.5;
}
.walk__h b { font-size: 1.05rem; }
.walk__shot { margin: .6rem 0 0; max-width: 330px; }
.walk__body { min-width: 0; padding-top: .6rem; }
.walk__body > :first-child { margin-top: 0; }
.walk__body p { max-width: 52ch; }

/* ---------- 大きい入口 ---------- */
.bigcta {
  display: block; margin: 1.4rem 0 2.2rem; padding: 1.1rem 1.3rem 1.2rem;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgb(18 28 38 / .05), 0 10px 26px rgb(18 28 38 / .07);
}
.bigcta:hover { text-decoration: none; border-color: var(--accent); }
.bigcta b { display: block; font-size: 1.2rem; color: var(--accent); }
.bigcta span { display: block; margin-top: .3rem; color: var(--ink2); font-size: .93rem; line-height: 1.7; }

/* ---------- lane chip(艇番色) ---------- */
.lane {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.75rem; height: 1.75rem; border-radius: 5px;
  font-family: var(--mono); font-weight: 600; font-size: .95rem; line-height: 1;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .22);
  flex-shrink: 0;
}
.lane--1 { background: var(--l1); color: #121c26; }
.lane--2 { background: var(--l2); color: #fff; }
.lane--3 { background: var(--l3); color: #fff; }
.lane--4 { background: var(--l4); color: #fff; }
.lane--5 { background: var(--l5); color: #121c26; }
.lane--6 { background: var(--l6); color: #fff; }
.lane--sm { width: 1.35rem; height: 1.35rem; font-size: .8rem; border-radius: 4px; }
.lanes { display: inline-flex; gap: .3rem; vertical-align: -.4rem; }

/* ---------- hero(ランディング) ---------- */
.hero {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(2.2rem, 6vw, 3.6rem) clamp(1rem, 4vw, 2rem) 1rem;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: clamp(1.6rem, 4vw, 3rem); align-items: center;
}
.hero__mark { width: 74px; height: 74px; border-radius: 16px; }
.hero__title { font-size: clamp(1.9rem, 5.2vw, 2.9rem); font-weight: 800; letter-spacing: -.02em; margin: 1rem 0 .3rem; }
.hero__sub { color: var(--ink2); font-size: 1.04rem; max-width: 42ch; margin: .5rem 0 0; }
.hero__meta { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1.3rem; }
.tag {
  font-family: var(--mono); font-size: .78rem; color: var(--ink2);
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: .2rem .8rem;
}

/* 券面 */
.ticket {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 1rem 1.1rem 1.05rem; max-width: 380px;
  box-shadow: 0 1px 2px rgb(18 28 38 / .05), 0 14px 34px rgb(18 28 38 / .07);
}
.ticket__head {
  display: flex; justify-content: space-between; align-items: baseline; gap: .6rem;
  font-family: var(--mono); font-size: .75rem; color: var(--muted);
  padding-bottom: .6rem; border-bottom: 1px dashed var(--line);
}
.ticket__row {
  display: flex; align-items: center; gap: .35rem;
  padding: .5rem 0; border-bottom: 1px solid var(--line);
}
.ticket__amt { margin-left: auto; font-family: var(--mono); font-size: 1.02rem; font-weight: 600; }
.ticket__why { margin: .75rem 0 0; font-size: .85rem; line-height: 1.7; color: var(--ink2); }
.ticket__by { display: flex; align-items: center; gap: .4rem; margin-top: .7rem; font-family: var(--mono); font-size: .75rem; color: var(--muted); }

/* 読み手のアバター */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 50%; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .18);
}
.avatar svg { width: 60%; height: 60%; }
.avatar--sm { width: 1.5rem; height: 1.5rem; }
.avatar--red { background: #d9342b; color: #fff; }
.avatar--blue { background: #2a6fd6; color: #fff; }
.avatar--green { background: #2e9b4f; color: #fff; }
.avatar--yellow { background: #f2d21f; color: #121c26; }
.avatar--purple { background: #7a4fd6; color: #fff; }
.avatar--teal { background: #1a9c9c; color: #fff; }

.readers { display: flex; flex-wrap: wrap; gap: .45rem; margin: 1rem 0 0; }
.reader {
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: .25rem .8rem .25rem .3rem;
  font-family: var(--mono); font-size: .82rem;
}

/* ---------- landing sections ---------- */
.band { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }
.band--sep { margin-top: 2.6rem; padding-top: 1.2rem; }
.band--sep > h2:first-child { margin-top: 0; }

.steps { list-style: none; margin: 1.2rem 0 0; padding: 0; display: grid; gap: 0; }
.steps > li { padding: 1rem 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 1.2rem; }
.steps > li:last-child { border-bottom: 1px solid var(--line); }
.steps__t { font-weight: 700; }
.steps__d { color: var(--ink2); font-size: .95rem; margin: 0; max-width: 60ch; }

.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.6rem 2.2rem; margin-top: 1.2rem; }
.split h3 { margin-top: 0; }
.split p { margin-bottom: 0; }

.track { margin: 1.2rem 0 0; max-width: 620px; font-family: var(--mono); font-size: .85rem; }
.track__row { display: grid; grid-template-columns: minmax(0, 1fr) 5rem; gap: .6rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.track__who { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.track__who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track__bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface2); position: relative; }
.track__bar i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--accent); }
.track__bar i.is-up { background: var(--ok); }
.track__bar u { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--muted); text-decoration: none; }
.track__val { text-align: right; font-weight: 600; }
.track__val.is-up { color: var(--ok); }
.track__val.is-out { color: var(--muted); }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); margin-top: 3rem; background: var(--surface); }
.foot__in { max-width: var(--maxw); margin: 0 auto; padding: 1.8rem clamp(1rem, 4vw, 2rem) 2.4rem; display: grid; grid-template-columns: 1.5fr 1fr; gap: 1.4rem; }
.foot__brand { display: flex; align-items: center; gap: .5rem; }
.foot__brand img { width: 26px; height: 26px; border-radius: 6px; }
.foot__brand b { font-size: 1rem; }
.foot p { color: var(--muted); font-size: .84rem; margin: .3rem 0; max-width: 60ch; }
.foot__col h3 { font-size: .84rem; margin: 0 0 .4rem; color: var(--muted); font-weight: 700; }
.foot__col a { display: block; font-size: .88rem; padding: .12rem 0; }
.foot__legal { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: .9rem; color: var(--muted); font-size: .8rem; }
.foot__legal p { font-size: .8rem; max-width: 74ch; }

/*
 * しくみの図は横長と縦組みの2枚を持っていて、<picture> で切り替える。
 * 1000px を切ると横長の図は文字が小さすぎて読めないので縦組みへ。
 * ただし縦組みをそのまま幅いっぱいに置くと縦に伸びすぎるので、横幅を抑える。
 */
@media (max-width: 1000px) {
  .shot--flow img { max-width: 430px; margin-inline: auto; }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .ticket { max-width: 100%; }
}
@media (max-width: 900px) {
  .walk > li { grid-template-columns: 1fr; }
  .walk__body { padding-top: .2rem; }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .doc { grid-template-columns: 1fr; }
  /*
   * 目次のサイドバーは**スマートフォンでは本文の下へ回す**。
   * 以前は横並びに畳んで本文の上に置いていたので、リンク8本＋見出し3つを
   * 毎ページの頭で越えないと本文に着かなかった。読み終わってから次を選ぶ順にする。
   * 上へ戻りたいときは、sticky なヘッダーの ☰ に同じものが入っている。
   */
  .doc { display: flex; flex-direction: column; }
  .main { order: 1; }
  .side {
    order: 2; position: static; max-height: none; overflow: visible;
    margin-top: 2rem; padding: 1rem 1.1rem 1.2rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  }
  .side::before { content: "使い方の目次"; display: block; font-weight: 700; margin-bottom: .5rem; }
  .side__grp { margin: .9rem 0 .2rem; }
  .side__link { padding: .5rem .7rem; }
  /* ☰ が唯一の上向きの導線になるので、記号だけにしない。 */
  .nav__toggle::after { content: "メニュー"; font-size: .8rem; margin-left: .3rem; }
  /*
   * 表が横に流れるのは `.tbl-wrap` が受けるが、それでも1つの列だけが伸びると
   * 残りの列が「本 / 命 / 党」と1文字ずつに潰れる。狭い画面では見出し列を
   * 折り返させず、本文の列は必ず折り返す。
   */
  th { white-space: nowrap; }
  td { word-break: break-word; }
  .steps > li { grid-template-columns: 1fr; gap: .2rem; }
  .foot__in { grid-template-columns: 1fr; }
  .nav { gap: .5rem; }
  .nav__menu { display: block; position: relative; margin-left: auto; }
  .nav__toggle {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 2.6rem; padding: 0 .7rem; border-radius: 8px; cursor: pointer;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 1.1rem;
  }
  .nav__links {
    position: absolute; right: 0; top: calc(100% + .5rem); margin: 0;
    flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: .05rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 14px 40px rgb(0 0 0 / .18); padding: .45rem; min-width: 12rem; z-index: 60;
  }
  .nav__menu:not([open]) .nav__links { display: none; }
  .nav__link { padding: .55rem .7rem; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}
