/* キロポストデータのページ専用 */
.kp-cta { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; }

.kp-intro { margin-top: clamp(56px, 7vw, 96px); }

/* 地図: 路線とキロポスト（assets/js/kpmap.js が canvas に描く。JS がないときは中央道の平面図） */
.kpx-fig { margin: 0; }
.kpx-fig > .cap { padding-inline: 4px; }
.kpx { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; height: clamp(560px, 72vh, 700px); }
.kpx-map { position: relative; background: var(--alt); border-radius: var(--r-lg); overflow: hidden; color: #2B2C30; min-height: 0; }
.kpx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; }
.kpx-canvas.is-drag { cursor: grabbing; }
.kpx-canvas.is-hot { cursor: pointer; }
.kpx-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.kpx-fallback { display: none; padding: clamp(14px, 2vw, 24px); height: 100%; overflow: auto; }
html:not(.js) .kpx-fallback, .kpx-map.is-failed .kpx-fallback { display: block; }
.kpx-map.is-failed .kpx-canvas, .kpx-map.is-failed .kpx-zoom, .kpx-map.is-failed .kpx-layers { display: none; }
html:not(.js) .kpx-canvas, html:not(.js) .kpx-zoom, html:not(.js) .kpx-layers, html:not(.js) .kpx-read, html:not(.js) .kpx-search { display: none; }

.kpx-read { position: absolute; left: 20px; top: 18px; margin: 0; max-width: calc(100% - 220px); font-family: var(--mono); font-size: 11px; letter-spacing: .08em; line-height: 1.6; color: var(--mute); pointer-events: none; }
.kpx-read b { display: block; font-family: var(--sans); font-weight: 500; font-size: 13px; letter-spacing: .04em; color: var(--text); }
.kpx-map.is-photo .kpx-read { color: rgba(255,255,255,.85); }
.kpx-map.is-photo .kpx-read b { color: #fff; }
.kpx-read b, .kpx-read span { text-shadow: 0 0 6px var(--kpx-halo, transparent), 0 0 2px var(--kpx-halo, transparent); }
.kpx-map.is-pale { --kpx-halo: rgba(255,255,255,.9); }
.kpx-map.is-photo { --kpx-halo: rgba(0,0,0,.6); }

.kpx-zoom { position: absolute; right: 16px; bottom: 40px; display: flex; flex-direction: column; gap: 8px; }
.kpx-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--white); color: var(--ink); display: grid; place-items: center; cursor: pointer; transition: background .3s var(--ease); }
.kpx-btn:hover { background: var(--accent-soft); }
.kpx-btn .i { width: 18px; height: 18px; }
.kpx-layers { position: absolute; right: 16px; top: 14px; display: flex; padding: 3px; gap: 2px; border-radius: var(--pill); background: var(--white); }
.kpx-layers button { height: 34px; min-width: 48px; padding: 0 14px; border: 0; border-radius: var(--pill); background: transparent; color: var(--mute); font: inherit; font-size: 12.5px; letter-spacing: .06em; cursor: pointer; transition: background .3s var(--ease), color .3s var(--ease); }
.kpx-layers button[aria-pressed="true"] { background: var(--ink); color: var(--white); }
.kpx-attr { position: absolute; left: 12px; right: 72px; bottom: 10px; margin: 0; display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 10.5px; line-height: 1.5; letter-spacing: .02em; color: var(--mute); pointer-events: none; }
.kpx-attr a { pointer-events: auto; color: inherit; text-decoration: underline; text-underline-offset: .2em; text-decoration-color: var(--accent); }
.kpx-attr span, .kpx-attr a { text-shadow: 0 0 4px var(--kpx-halo, transparent), 0 0 2px var(--kpx-halo, transparent); }
.kpx-map.is-photo .kpx-attr { color: rgba(255,255,255,.85); }

.kpx-tip { position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; background: var(--ink); color: var(--on-dark); border-radius: var(--r-sm); padding: 8px 12px; font-size: 12px; line-height: 1.6; white-space: nowrap; transform: translate(-50%, calc(-100% - 14px)); }
.kpx-tip b { display: block; font-family: var(--mono); font-weight: 500; font-size: 14px; letter-spacing: .04em; }
.kpx-tip small { display: block; font-size: 11px; color: var(--on-dark-3); }
.kpx-hint { position: absolute; left: 50%; bottom: 56px; z-index: 2; margin: 0; transform: translateX(-50%); background: var(--ink); color: var(--on-dark); border-radius: var(--pill); padding: 8px 18px; font-size: 12.5px; white-space: nowrap; opacity: 0; transition: opacity .3s var(--ease); pointer-events: none; }
.kpx-hint.is-on { opacity: 1; }

.kpx-side { display: flex; flex-direction: column; gap: 20px; background: var(--alt); border-radius: var(--r-lg); padding: 22px 20px 20px; min-height: 0; }
.kpx-search { position: relative; }
.kpx-search-label { display: block; font-size: 12px; letter-spacing: .12em; color: var(--mute); margin-bottom: 8px; }
.kpx-q { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px; border-radius: var(--pill); background: var(--white); border: 1px solid transparent; transition: border-color .3s var(--ease); }
.kpx-q:focus-within { border-color: var(--accent); }
.kpx-q .i { width: 18px; height: 18px; flex: none; color: var(--mute); }
.kpx-q input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 16px; color: var(--text); outline: none; }
.kpx-q input::placeholder { color: #9A9CA1; }
.kpx-q input::-webkit-search-cancel-button { display: none; }
.kpx-sug { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 5; list-style: none; margin: 0; padding: 6px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r-sm); }
.kpx-sug li { display: flex; flex-direction: column; justify-content: center; min-height: 44px; padding: 6px 12px; border-radius: 8px; font-size: 14px; line-height: 1.5; cursor: pointer; }
.kpx-sug li small { font-size: 11.5px; color: var(--mute); }
.kpx-sug li[aria-selected="true"], .kpx-sug li:hover { background: var(--accent-soft); }
.kpx-sug li.is-msg { cursor: default; color: var(--mute); font-size: 13px; }
.kpx-sug li.is-msg:hover { background: transparent; }

.kpx-list { flex: 1; min-height: 0; overflow-y: auto; margin-inline: -8px; padding-inline: 8px; overscroll-behavior: contain; }
.kpx-group { font-size: 11.5px; letter-spacing: .12em; color: var(--mute); margin: 0 0 4px; }
.kpx-list ul + .kpx-group { margin-top: 14px; }
.kpx-list ul { list-style: none; margin: 0; padding: 0; }
.kpx-route { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; transition: background .25s var(--ease); }
.kpx-route:hover { background: rgba(26,27,30,.04); }
.kpx-route[aria-pressed="true"] { background: var(--white); }
.kpx-sw { flex: none; width: 18px; height: 0; border-top: 2px solid rgba(26,27,30,.32); }
.kpx-sw.is-data { border-top-color: var(--ink); }
.kpx-sw.is-wip { border-top-color: rgba(26,27,30,.55); }
.kpx-route[aria-pressed="true"] .kpx-sw { border-top-color: var(--accent); border-top-width: 3px; }
.kpx-rname { flex: 1; min-width: 0; line-height: 1.4; padding-block: 6px; }
.kpx-rname small { display: block; font-size: 11px; color: var(--mute); }
.kpx-count { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; margin-left: 8px; }
.kpx-more { margin-top: 14px; }
.kpx-more > summary { list-style: none; display: flex; align-items: center; min-height: 36px; cursor: pointer; }
.kpx-more > summary::-webkit-details-marker { display: none; }
.kpx-more > summary .more-i { margin-left: auto; }
.kpx-rmeta { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; color: var(--mute); white-space: nowrap; }

.kpx-info { flex: none; }
.kpx-card { background: var(--white); border-radius: 20px; padding: 18px 18px 16px; }
.kpx-card-tag { margin: 0; font-size: 11px; letter-spacing: .12em; color: var(--mute); }
.kpx-card-tag.is-data { color: var(--accent); }
.kpx-card-name { font-family: var(--serif); font-size: 1.3rem; line-height: 1.5; margin: 2px 0 8px; }
.kpx-spec { margin: 0; font-size: 12.5px; line-height: 1.8; }
.kpx-spec div { display: grid; grid-template-columns: 5.5em 1fr; gap: 8px; }
.kpx-spec dt { color: var(--mute); }
.kpx-spec dd { margin: 0; }
.kpx-card-note { font-size: 12.5px; line-height: 1.8; color: var(--mute); margin: 8px 0 14px; }
.kpx-cta { width: 100%; justify-content: space-between; height: 46px; font-size: 13px; }

@media (max-width: 900px) {
  .kpx { grid-template-columns: 1fr; height: auto; }
  .kpx-map { height: min(68svh, 520px); }
  .kpx-side { padding: 18px 16px 16px; }
  .kpx-list { overflow: visible; margin-inline: 0; padding-inline: 0; }
  .kpx-list ul { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 6px; }
  .kpx-route { font-size: 13px; padding: 0 8px; gap: 8px; }
  .kpx-rmeta { display: none; }
  .kpx-read { left: 16px; top: 64px; max-width: calc(100% - 32px); }
  .kpx-layers { left: 12px; right: auto; top: 12px; }
}
html:not(.js) .kpx { height: auto; }
html:not(.js) .kpx-map { height: auto; }

/* サンプルのダウンロード */
.kp-dl { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(28px, 4vw, 64px); align-items: start; margin-top: clamp(56px, 7vw, 96px); }
.kp-dl-h { font-family: var(--serif); font-weight: 400; font-size: clamp(1.3rem, 2vw, 1.6rem); margin: 0 0 10px; }
.kp-dl-lead { font-size: 14px; line-height: 2; color: var(--mute); margin: 0 0 20px; }
.kp-dl-side .kp-dl-btn { margin-top: 0; }
.kpm { display: block; width: 100%; height: auto; font-family: var(--mono); }
.kpm text { fill: currentColor; font-size: 12px; letter-spacing: .04em; }
.kpm .kpm-grid { fill: none; stroke: currentColor; stroke-width: .5; opacity: .07; }
.kpm .kpm-frame, .kpm .kpm-crop { fill: none; stroke: currentColor; stroke-width: .75; opacity: .45; }
.kpm .kpm-road { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
.kpm .kpm-tick { fill: none; stroke: currentColor; stroke-width: .75; opacity: .7; }
.kpm .kpm-pt circle:first-child, .kpm .kpm-dot { fill: var(--accent); }
.kpm .kpm-ring { fill: none; stroke: var(--accent); stroke-width: .75; opacity: .55; }
.kpm .kpm-pend { fill: var(--alt); stroke: currentColor; stroke-width: .9; opacity: .6; }
.kpm .kpm-lead { fill: none; stroke: currentColor; stroke-width: .75; opacity: .7; }
.kpm .kpm-end { font-family: var(--sans); font-size: 12px; opacity: .75; }
.kpm .kpm-scale path, .kpm .kpm-north path, .kpm .kpm-north circle { fill: none; stroke: currentColor; stroke-width: .9; }
.kpm .kpm-legend text { font-family: var(--sans); font-size: 12px; opacity: .8; }

.kp-size { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; opacity: .6; margin-left: 4px; }
.kp-dl .more { margin-top: 20px; }
.kp-table-wrap { overflow-x: auto; }
.kp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.kp-table th { text-align: left; font-weight: 400; font-size: 11.5px; color: var(--mute); padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.kp-table td { font-family: var(--mono); font-size: 12.5px; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }

/* 料金: 無料のサンプルと有料の路線データ */
.kp-plans { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(12px, 1.6vw, 20px); }
.kp-plan { background: var(--ink-card); border-radius: var(--r-lg); padding: clamp(24px, 3vw, 40px); display: flex; flex-direction: column; }
.kp-plan-tag { align-self: flex-start; font-size: 12px; letter-spacing: .1em; padding: 4px 12px; border-radius: var(--pill); border: 1px solid rgba(245,245,243,.24); color: var(--on-dark-2); }
.kp-plan-tag.is-free { border-color: var(--accent-on-dark); color: var(--accent-on-dark); }
.kp-plan-name { font-family: var(--serif); font-weight: 400; font-size: clamp(1.5rem, 2.4vw, 2rem); margin: 20px 0 12px; }
.kp-plan-body { font-size: 14px; line-height: 2; color: var(--on-dark-2); margin-bottom: 20px; }
.kp-plan .spec { margin-bottom: 28px; }
.kp-plan .btn { margin-top: auto; align-self: flex-start; }
.kp-buy { margin-top: clamp(56px, 7vw, 96px); }
.kp-buy .label { margin-bottom: 24px; }

@media (max-width: 900px) {
  .kp-dl, .kp-plans { grid-template-columns: 1fr; }
  .kpm { min-width: 720px; }
}
.kp-fig-scroll { margin-top: 2px; }
.kp-fig-scroll .kpf--tall { display: none; }
@media (max-width: 700px) {
  .kp-fig-scroll .kpf--wide { display: none; }
  .kp-fig-scroll .kpf--tall { display: block; max-width: 440px; margin-inline: auto; }
}
/* 最初の写真: 板と注釈（画像に描き込み済み）が右寄りなので、狭い画面では右を残して切る */
.hero-kp .bg img { object-position: 76% 50%; }

/* キロポストとは: 写真（板を拡大した小窓つき）と3つの要点、100mごとの並びと「1枚＝1行」 */
.kpw-sec { padding-block: clamp(64px, 8vw, 120px); }
.kpw { display: grid; grid-template-columns: 7fr 5fr; gap: clamp(28px, 4vw, 64px); align-items: center; }
.kpw-photo { position: relative; margin: 0; }
.kpw-photo img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-lg); }
.kpw-photo .cap { margin-top: 10px; }
/* 板のまわりを等倍で切り出す（元画像 1600×900 の板の中心 x 75.6%・y 56.2%。表示幅を小窓の 8 倍にすると元画像とほぼ同じ大きさ） */
.kpw-zoom { position: absolute; left: 16px; bottom: 44px; width: 28%; aspect-ratio: 1; border-radius: var(--r-sm); background-size: 800% auto; background-position: 79.2% 58%; background-repeat: no-repeat; outline: 2px solid var(--white); }
.kpw-zoom span { position: absolute; left: 8px; top: 6px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; color: #fff; text-shadow: 0 0 4px rgba(0,0,0,.6); }
.kpw-text .h { margin-bottom: clamp(20px, 2.4vw, 32px); }
.kpw-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.kpw-points li { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; }
.kpw-no { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--accent); padding-top: 3px; }
.kpw-points h3 { font-size: 15.5px; font-weight: 600; letter-spacing: .03em; line-height: 1.7; margin: 0 0 2px; }
.kpw-points p { font-size: 14px; line-height: 1.9; color: var(--mute); margin: 0; }
.kpw-src { font-size: 11.5px; line-height: 1.8; color: var(--mute); margin: 18px 0 0; }
.kpw-src a { color: inherit; text-decoration: underline; text-underline-offset: .2em; text-decoration-color: var(--accent); }

.kps { margin: clamp(40px, 5vw, 72px) 0 0; }
.kps-body { position: relative; background: var(--white); border-radius: var(--r-lg); padding: 28px clamp(16px, 3vw, 40px) 18px; }
.kps-posts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); position: relative; z-index: 1; }
.kps-posts li { display: flex; flex-direction: column; align-items: center; }
.kps-posts li::after { content: ""; width: 1.3px; height: 26px; background: var(--ink); opacity: .55; } /* 支柱 */
.kps-plate { font-family: var(--mono); font-size: clamp(12px, 1.2vw, 15px); letter-spacing: .04em; line-height: 1; padding: 7px 9px; border: 1.3px solid var(--ink); border-radius: 4px; background: var(--white); color: var(--ink); }
.kps-posts li:nth-child(5) .kps-plate { background: var(--ink); color: var(--white); } /* 1キロごとの板は色が反転 */
.kps-posts li.is-on .kps-plate { border-color: var(--accent); color: var(--accent); outline: 4px solid var(--accent-soft); }
.kps-road { height: 18px; border-top: 1.3px solid var(--ink); border-bottom: 1.3px solid var(--ink); position: relative; opacity: .8; }
.kps-road::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed var(--ink); opacity: .45; }
/* 隣り合う2本（3本目と4本目）の間の寸法線 */
.kps-dim { position: relative; margin-left: calc(100% / 7 * 2.5); width: calc(100% / 7); height: 22px; margin-top: 6px; }
.kps-dim::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; border-top: 1px solid var(--mute); }
.kps-dim::after { content: ""; position: absolute; left: 0; right: 0; top: 2px; height: 8px; border-left: 1px solid var(--mute); border-right: 1px solid var(--mute); }
.kps-dim span { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); font-family: var(--mono); font-size: 11px; color: var(--mute); white-space: nowrap; }
.kps-ends { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11.5px; color: var(--mute); }

.kps-data { display: grid; grid-template-columns: auto 1fr auto; gap: 12px 28px; align-items: center; margin-top: 20px; }
.kps-data-label { grid-column: 1 / -1; margin: 0; font-size: 12px; letter-spacing: .12em; color: var(--mute); }
.kps-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.kps-row dl { display: flex; margin: 0; background: var(--white); border-radius: var(--r-sm); overflow: hidden; }
.kps-row dl div { padding: 8px 16px; }
.kps-row dl div + div { border-left: 1px solid var(--line); }
.kps-row dt { font-size: 11px; color: var(--mute); line-height: 1.6; }
.kps-row dd { margin: 0; font-family: var(--mono); font-size: 14px; letter-spacing: .02em; }
.kps-row dl div:first-child dd { color: var(--accent); }
.kps-data-cap { font-size: 11.5px; color: var(--mute); }
.kps-data-lead { margin: 0; font-size: 13.5px; line-height: 1.9; color: var(--mute); }
.kps-go { white-space: nowrap; }
.i-down { transform: rotate(90deg); }
.kps-go:hover .i-down { transform: rotate(90deg) translateX(3px); }

@media (max-width: 900px) {
  .kpw { grid-template-columns: 1fr; }
  .kps-data { grid-template-columns: 1fr; }
  .kps-go { justify-self: start; }
}
@media (max-width: 600px) {
  .kps-posts { grid-template-columns: repeat(5, 1fr); }
  .kps-posts li:first-child, .kps-posts li:last-child { display: none; }
  .kps-dim { margin-left: calc(100% / 5 * 1.5); width: calc(100% / 5); }
  .kps-plate { padding: 6px 6px; }
  .kpw-zoom { width: 34%; left: 10px; bottom: 40px; }
  .kps .pipe-head span:last-child { display: none; }
  .kps-row dl div { padding: 8px 10px; }
  .kps-row dd { font-size: 12.5px; }
}
.kpx-more[open] > summary .more-i::after { transform: rotate(0deg); }
.kpx-more .more-i { width: 24px; height: 24px; }
.kpx-more .more-i::before, .kpx-more .more-i::after { width: 9px; margin-left: -4.5px; }
