/* ==================================================================
 * 整える前とあとの見比べの図（[kioku_mikurabe]・[kioku_narabe]。TPK_Mikurabe）と、整え方の記事の題の横の3つの組（TPK_Mikurabe::fv）。
 * 決まった形（2026-11-22 ご主人「この形で」）：
 *   1. つまみで前とあと：左が整える前、右が整えたあと。白い縦の線と丸いつまみ 44px、左上・右上に札。図の下に名前（.8125rem、薄墨、真ん中）
 *   2. パソコン（1024px〜）：2つずつ横に（列の間 40px、段の上下 40px）。左右で見出し・文・図の頭の高さをそろえる（subgrid）
 *   3. 図は列の幅いっぱい、高さは画面の 56%・520px まで（縦長は高さで止めて真ん中に）。1列のときは本文の幅、高さは画面の 72%・720px まで
 *   4. スマホ（〜781px）：1つずつ、画面の幅いっぱい（左右の余白なし）、縦は画面の 70% まで、影なし
 *   5. スクリプトが動かないときは、前とあとを左右に並べる（html に .tpk-hk-js が無いとき）
 * ------------------------------------------------------------------ */
/* 余白は、ページの部品の「余白なし」（.tpk-ph-wrap :where(figure, p …)。あとから読まれる）より強く当てる */
.tpk-hk{--hk-max-h:min(72vh,720px); --hk-max-w:100%}
.tpk-ph-wrap .tpk-hk,.tpk-hk{margin:40px 0}
/* 図の大きさ：幅は列いっぱい、縦長で高さが上限を超えるときは、高さで止めて真ん中に */
.tpk-hk__f{position:relative; width:min(var(--hk-max-w), calc(var(--hk-max-h) * var(--hk-w) / var(--hk-h))); margin:0 auto}

/* スクリプトが動かないとき：前とあとを左右に並べ、札を左上に（つまみ・線は出さない） */
html:not(.tpk-hk-js) .tpk-hk__f{display:grid; grid-template-columns:1fr 1fr; gap:8px; width:min(100%, calc(var(--hk-max-h) * var(--hk-w) / var(--hk-h) * 2 + 8px))}
html:not(.tpk-hk-js) .tpk-hk__f img{grid-row:1; display:block; width:100%; height:auto; margin:0}
html:not(.tpk-hk-js) .tpk-hk__mae,html:not(.tpk-hk-js) .tpk-hk__l--mae{grid-column:1}
html:not(.tpk-hk-js) .tpk-hk__ato,html:not(.tpk-hk-js) .tpk-hk__l--ato{grid-column:2}
html:not(.tpk-hk-js) .tpk-hk__l{grid-row:1; align-self:start; justify-self:start; margin:8px}
html:not(.tpk-hk-js) .tpk-hk__sen,html:not(.tpk-hk-js) .tpk-hk__tsumami,html:not(.tpk-hk-js) .tpk-hk__in{display:none}

/* つまみの形：2枚を重ね、前の画像を --x の位置で切る（左が前、右があと） */
.tpk-hk-js .tpk-hk__f{overflow:hidden; aspect-ratio:var(--hk-w) / var(--hk-h); background:var(--tp-kinari-hi,#FAF6EE); box-shadow:0 12px 32px rgba(34,32,28,.14);
  touch-action:pan-y; user-select:none; -webkit-user-select:none; cursor:ew-resize}
.tpk-hk-js .tpk-hk__f img{position:absolute; inset:0; display:block; width:100%; height:100%; max-width:none; margin:0; object-fit:cover; pointer-events:none}
.tpk-hk-js .tpk-hk__mae{z-index:1; clip-path:inset(0 calc(100% - var(--x,50%)) 0 0)}
.tpk-hk__sen{position:absolute; z-index:2; top:0; bottom:0; left:var(--x,50%); width:2px; margin-left:-1px; background:#fff; box-shadow:0 0 0 1px rgba(34,32,28,.25); pointer-events:none}
/* つまみは線と同じ位置。ただし端（0%・100%）でも図の外へ切れないよう、図の内側 22px までで止める（確認係） */
.tpk-hk__tsumami{position:absolute; z-index:3; top:50%; left:clamp(22px, var(--x,50%), calc(100% - 22px)); width:44px; height:44px; margin:-22px 0 0 -22px; pointer-events:none; border-radius:50%; background:#fff; box-shadow:0 2px 10px rgba(34,32,28,.3);
  display:flex; align-items:center; justify-content:center}
.tpk-hk__tsumami::before{content:"◀ ▶"; font-size:10px; letter-spacing:2px; line-height:1; color:#22201C}
.tpk-hk__l{position:absolute; z-index:3; top:8px; padding:4px 8px; font-size:.75rem; line-height:1.4; letter-spacing:.08em; color:#fff; background:rgba(34,32,28,.62); pointer-events:none}
/* 境目が端に寄って片方がほとんど見えないときは、その札を消す（JS が .is-mae-nashi・.is-ato-nashi を付ける） */
.tpk-hk__l{transition:opacity .2s}
.is-mae-nashi .tpk-hk__l--mae,.is-ato-nashi .tpk-hk__l--ato{opacity:0}
.tpk-hk__l--mae{left:8px}
.tpk-hk__l--ato{right:8px}
/* 中の range（キーボードの左右の矢印で動かす。指とマウスは図そのもので受けるので、range は見えないまま押せない） */
.tpk-hk__in{position:absolute; inset:0; width:100%; height:100%; margin:0; opacity:0; pointer-events:none}
.tpk-hk__f:has(.tpk-hk__in:focus-visible) .tpk-hk__tsumami{outline:2px solid var(--tp-green,#2F4F43); outline-offset:3px}
.tpk-hk figcaption{margin:8px 0 0; font-size:.8125rem; line-height:1.6; color:var(--tp-ink-sub,#5C574D); text-align:center}
.tpk-hk-nuke{padding:8px 12px; border:1px dashed var(--tp-vermilion,#9B4A33); color:var(--tp-vermilion,#9B4A33); font-size:.8125rem}

/* パソコン：2つずつ横に並べる。カードは「見出し → 図の前の文 → 図と図のあとの文」の3段で、左右の段の頭をそろえる */
.tpk-ph-wrap .tpk-hk-card > h2{margin-top:40px}
@media (min-width:1024px){
  .tpk-ph-wrap .tpk-hk-row{margin:40px 0}
  .tpk-hk-row{display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 40px}
  .tpk-hk-row + .tpk-hk-row{margin-top:40px}
  .tpk-hk-card{display:grid; grid-row:span 3; grid-template-rows:subgrid; min-width:0}
  .tpk-ph-wrap .tpk-hk-card > h2{margin:0 0 16px}
  .tpk-ph-wrap .tpk-hk-pre > *{margin:0 0 16px}
  .tpk-ph-wrap .tpk-hk-pre > :last-child{margin-bottom:0}
  .tpk-hk-fp{min-width:0}
  .tpk-ph-wrap .tpk-hk-card .tpk-hk{margin:8px 0 0}
  .tpk-hk-card .tpk-hk{--hk-max-h:min(56vh,520px)}
  .tpk-ph-wrap .tpk-hk-post > *{margin:16px 0 0}
}
@media (max-width:1023px){
  .tpk-ph-wrap .tpk-hk-pre > *,.tpk-ph-wrap .tpk-hk-post > *{margin:0 0 16px}
}
/* スマホ：画面の幅いっぱい（左右の余白なし）、縦は画面の 70% まで、影なし */
@media (max-width:781px){
  .tpk-hk{--hk-max-h:70vh}
  .tpk-ph-wrap .tpk-hk,.tpk-hk{margin:24px calc(-1 * var(--tp-gutter,16px))}
  .tpk-hk-js .tpk-hk__f{box-shadow:none}
  .tpk-hk figcaption{padding:0 16px}
}

/* ------------------------------------------------------------------
 * 整え方の記事の題の横：縦長 2:3 の小さい組を3つ（真ん中を 1.18 倍）。ふだんは「あと」、指（マウス）を乗せると「前」に戻る。
 * 右の端は本文の列の右端にそろえる（目次 240px＋間 64px＋本文 720px＝1024px。ご主人 11/22「記事枠の右端の横のスペースが気になります」）
 * ------------------------------------------------------------------ */
.tpk-tt3{display:flex; flex:none; gap:16px; align-items:flex-end; --w:120px}
@media (min-width:1024px){
  .tpk-legal--fv .tpk-ph-head .tpk-ph-in > .tpk-tt3{margin-right:max(0px, calc(100% - 1024px)); --w:140px}
}
.tpk-tt3__k{position:relative; display:block; width:var(--w); aspect-ratio:2 / 3; overflow:hidden; background:var(--tp-kinari-hi,#FAF6EE); box-shadow:0 10px 24px rgba(34,32,28,.2)}
.tpk-tt3__k:nth-child(2){width:calc(var(--w) * 1.18)}
.tpk-tt3__k img{position:absolute; inset:0; display:block; width:100%; height:100%; max-width:none; margin:0; object-fit:cover; transition:opacity .5s}
.tpk-tt3__k .tpk-tt3__mae{opacity:0}
@media (hover:hover){ .tpk-tt3__k:hover .tpk-tt3__mae{opacity:1} }
@media (prefers-reduced-motion:reduce){ .tpk-tt3__k img{transition:none} }
@media (max-width:781px){
  .tpk-tt3{gap:8px; justify-content:center; --w:calc((100vw - 2 * var(--tp-gutter,16px) - 16px) / 3.18)}
  /* 題と3つの画像のあいだは 40px（列の間 20px に 20px 足す。2026-11-23 ご主人「タイトルの下の画像とタイトルの間にもう少し」） */
  .tpk-legal--fv .tpk-ph-head .tpk-ph-in > .tpk-tt3{align-self:stretch; margin-top:20px}
}

/* ------------------------------------------------------------------
 * 「しないこと」と「すること」を左右に並べた表のような一覧（整え方の記事の頭。2026-11-23 ご主人「ul・li の HTML で、CSS でテーブルっぽく」）。
 * 本文には <ul class="tpk-hk-hyou"><li><p class="tpk-hk-hyou__h">しないこと</p><ul>…</ul></li><li>…すること…</li></ul> と書く。
 * 線と見出しの段の色は、規約などの表（kioku-legal.css の th・td）と同じ
 * ------------------------------------------------------------------ */
.tpk-ph-wrap .tpk-hk-hyou{display:grid; grid-template-columns:minmax(0,38fr) minmax(0,62fr); margin:24px 0; padding:0; list-style:none; border:1px solid var(--rule,#D9D2C3); font-size:.8125rem; line-height:1.7}
.tpk-ph-wrap .tpk-hk-hyou > li{display:grid; grid-template-rows:auto 1fr; margin:0; padding:0}
.tpk-ph-wrap .tpk-hk-hyou > li + li{border-left:1px solid var(--rule,#D9D2C3)}
.tpk-ph-wrap .tpk-hk-hyou__h{margin:0; padding:10px 16px; font-weight:700; background:var(--paper-hi,#FAF6EE); border-bottom:1px solid var(--rule,#D9D2C3)}
.tpk-ph-wrap .tpk-hk-hyou > li > ul{margin:0; padding:12px 16px 12px 2.25em; list-style:disc}
.tpk-ph-wrap .tpk-hk-hyou > li > ul > li{margin:0}
.tpk-ph-wrap .tpk-hk-hyou > li > ul > li + li{margin-top:6px}
/* スマホは「しないこと」の下に「すること」を縦に（ご主人 11/23） */
@media (max-width:781px){
  .tpk-ph-wrap .tpk-hk-hyou{grid-template-columns:minmax(0,1fr)}
  .tpk-ph-wrap .tpk-hk-hyou > li + li{border-left:0; border-top:1px solid var(--rule,#D9D2C3)}
}

/* 図の下の説明を本文に書くとき（<p class="tpk-hk-cap">）。cap="" は改行を入れられないため、作者名と題などで改行したい説明はこちらに書く（ご主人 11/23「作者名と本の名前で改行」）。
   図の下の空きを消して、図の中の説明と同じ 8px の近さにする */
.tpk-ph-wrap .tpk-hk:has(+ .tpk-hk-cap),
.tpk-ph-wrap .tpk-hk-fp:has(> .tpk-hk-post > .tpk-hk-cap:first-child) > .tpk-hk{margin-bottom:0}
.tpk-ph-wrap .tpk-hk-cap,
.tpk-ph-wrap .tpk-hk-post > .tpk-hk-cap{margin:8px 0 16px; font-size:.8125rem; line-height:1.6; color:var(--tp-ink-sub,#5C574D); text-align:center}
