/* ============================================================
   取材写真ギャラリー（#347）
   ⚠️ style.css には入れない。写真のある記事ページと /photos/<slug> だけが
      <link rel="stylesheet" href="/css/photo-gallery.css?v=…"> で読む（build.js の headExtra）。
      全ページが読む style.css に足すと、ハッシュが変わり全ページのHTMLに差分が出るため。
   記事末尾の見本（.pg）・専用ページ（.ph-*）・拡大表示（.lb）・応援の枠（.tip2）・応援モーダル（.tm）
   build: scripts/build-photos.js ／ 動き: js/photo-gallery.js・js/tip.js
   ⚠️ .lb・.tm は hidden 属性で隠している。display を指定するときは [hidden] の打ち消しを必ず書く。
   ⚠️ <nav> は使わない（素の nav 指定がスマホで非表示になるため）。目次は div[role=navigation]。
   ============================================================ */
.pg { margin: 64px 0 0; padding-top: 40px; border-top: 1px solid var(--line-accent); }
.pg-label { font-family: var(--font-ui); font-size: 14px; letter-spacing: .22em; color: var(--accent-text); margin: 0 0 6px; }
.pg-title { font-family: var(--font-display); font-size: 24px; font-weight: 500; letter-spacing: .06em; line-height: 1.6; margin: 0 0 10px !important; padding: 0 !important; border: 0 !important; }
.pg-lede { font-size: 15px !important; line-height: 1.9 !important; color: var(--text-body); margin: 0 0 8px !important; }
.pg-meta { font-family: var(--font-ui); font-size: 14px; color: var(--text-muted); margin: 0 0 8px; }
.pg-group { margin-top: 40px; }
.pg-gtitle { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: .08em; color: var(--text); margin: 0 0 14px !important; padding: 0 0 10px !important; border: 0 !important; border-bottom: 1px solid var(--rule-light) !important; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; }
.pg-gtitle small { font-family: var(--font-ui); font-weight: 400; font-size: 14px; letter-spacing: .02em; color: var(--text-muted); }
.pg-gtitle em { font-style: normal; font-family: var(--font-ui); font-size: 14px; color: var(--text-muted); margin-left: auto; }
.pg-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pg-grid li { margin: 0; padding: 0; }
.pg-cols4 { grid-template-columns: repeat(4, 1fr); }
.pg-preview { grid-template-columns: repeat(3, 1fr); margin-top: 22px; }
.pg-thumb { all: unset; box-sizing: border-box; display: block; width: 100%; aspect-ratio: 3/2; overflow: hidden; background: var(--surface-alt); border-radius: 2px; cursor: zoom-in; position: relative; }
.pg-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.pg-thumb:hover img { transform: scale(1.04); }
.pg-thumb::after { content: '拡大'; position: absolute; right: 8px; bottom: 8px; font-family: var(--font-ui); font-size: 14px; letter-spacing: .08em; color: #f0ebe3; background: rgba(13,13,13,.72); padding: 3px 9px; border-radius: 3px; opacity: 0; transition: opacity .2s; }
.pg-thumb:hover::after, .pg-thumb:focus-visible::after { opacity: 1; }
.pg-thumb:focus-visible { outline: 3px solid #ffd43d; outline-offset: 2px; box-shadow: 0 0 0 5px #000; }
.pg-more { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: rgba(13,13,13,.62); color: #f0ebe3; font-family: var(--font-ui); pointer-events: none; }
.pg-more b { font-size: 24px; font-weight: 600; }
.pg-more span { font-size: 14px; letter-spacing: .06em; }
.pg-thumb:has(.pg-more)::after { display: none; }
.pg-all { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; min-height: 52px; border: 1.5px solid var(--text); border-radius: 4px; font-family: var(--font-ui); font-size: 16px; font-weight: 600; color: var(--text); text-decoration: none; background: var(--surface); }
.pg-all:hover { text-decoration: underline; text-underline-offset: 3px; background: var(--surface-alt); }
.pg-all:focus-visible { outline: 3px solid #ffd43d; outline-offset: 2px; box-shadow: 0 0 0 5px #000; }

/* 専用ページ /photos/<slug> */
.ph-main { max-width: 960px; margin: 0 auto; padding: 36px 20px 80px; }
.ph-h1 { font-family: var(--font-display); font-size: 30px; font-weight: 500; letter-spacing: .06em; line-height: 1.5; margin: 6px 0 12px; color: var(--text); }
.ph-back { font-family: var(--font-ui); font-size: 14px; margin: 14px 0 0; }
.ph-back a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; display: inline-flex; align-items: center; min-height: 44px; }
.ph-back a:hover { text-decoration-thickness: 2px; }
.ph-back-end { margin-top: 40px; text-align: center; }
.ph-nav { position: sticky; top: var(--header-h); z-index: 20; background: var(--bg); padding: 10px 0; margin: 22px 0 0; border-bottom: 1px solid var(--rule-light); }
.ph-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.ph-nav li { margin: 0; padding: 0; }
.ph-nav a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 1px solid var(--rule-light); border-radius: 22px; font-family: var(--font-ui); font-size: 14px; color: var(--text); text-decoration: none; background: var(--surface); }
.ph-nav a small { color: var(--text-muted); font-size: 14px; }
.ph-nav a:hover { text-decoration: underline; text-underline-offset: 3px; border-color: var(--accent); }
.ph-nav a:focus-visible { outline: 3px solid #ffd43d; outline-offset: 2px; box-shadow: 0 0 0 5px #000; }
.ph-group { scroll-margin-top: 160px; }

/* 応援の枠：枠＋ボタン1つ。押すとモーダルで金額を選ぶ。js/tip.js が動いたときだけ出す（動かないときに死んだボタンを見せない） */
.tip2 { display: none; position: relative; margin: 56px 0 0; padding: 30px 20px 20px; border: 1px solid var(--rule-light); border-radius: 4px; }
.tip-ready .tip2 { display: block; }
.tip2-legend { position: absolute; top: -.85em; left: 50%; transform: translateX(-50%); background: var(--bg); padding: 0 14px; font-family: var(--font-ui); font-size: 14px; color: var(--text-muted); white-space: nowrap; }
.tip2-btn { all: unset; box-sizing: border-box; width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 1.5px solid var(--text); border-radius: 4px; font-family: var(--font-ui); font-size: 16px; font-weight: 600; color: var(--text); cursor: pointer; background: var(--surface); }
.tip2-btn:hover { text-decoration: underline; text-underline-offset: 3px; background: var(--surface-alt); }
.tip2-btn:focus-visible { outline: 3px solid #ffd43d; outline-offset: 2px; box-shadow: 0 0 0 5px #000; }
.tip2-btn svg { width: 26px; height: 26px; flex: none; }

/* 応援モーダル（スマホは下からのシート） */
.tm { position: fixed; inset: 0; z-index: 2000; background: rgba(13,13,13,.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.tm[hidden] { display: none; }
.tm-panel { overscroll-behavior: contain; width: 100%; max-width: 480px; max-height: 94vh; overflow: auto; background: #fff; border-radius: 8px; color: #1a1714; }
.tm-head { background: #f3ecdc; padding: 22px 20px 18px; text-align: center; }
.tm-bubble { position: relative; background: #fff; border-radius: 6px; padding: 14px 16px; font-family: var(--font-ui); font-size: 14px; line-height: 1.8; text-align: left; color: #2b2622; }
.tm-bubble::after { content: ''; position: absolute; left: 50%; bottom: -9px; margin-left: -9px; border: 9px solid transparent; border-bottom: 0; border-top-color: #fff; }
.tm-avatar { width: 56px; height: 56px; border-radius: 50%; display: block; margin: 16px auto 8px; object-fit: cover; background: #b23a26; }
.tm-title { font-family: var(--font-ui); font-size: 16px; font-weight: 600; margin: 0; }
.tm-body { padding: 20px 20px 22px; font-family: var(--font-ui); }
.tm fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.tm legend { font-size: 15px; font-weight: 700; padding: 0; margin-bottom: 10px; display: block; }
.tm .tm-req { font-weight: 400; font-size: 14px; color: #4a423b; margin-left: 8px; }
.tm-amounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tm-amount { position: relative; }
.tm-amount input[type=radio] { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.tm-amount .tm-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 4px 10px; border: 1.5px solid #d9d1c5; border-radius: 6px; min-height: 112px; justify-content: center; text-align: center; }
.tm-amount:hover .tm-card b { text-decoration: underline; text-underline-offset: 3px; }
.tm-amount svg { width: 38px; height: 38px; color: #1a1714; }
.tm-amount b { font-size: 16px; font-weight: 700; }
.tm-amount .tm-check { display: none; position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; }
.tm-amount .tm-check circle { fill: #7d622a; }
.tm-amount .tm-check path { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tm-amount input:checked + .tm-card .tm-check { display: block; }
.tm-amount input:checked + .tm-card { border-color: #7d622a; box-shadow: 0 0 0 1.5px #7d622a inset; background: #fbf6ea; }
.tm-amount input:focus-visible + .tm-card { outline: 3px solid #ffd43d; outline-offset: 2px; box-shadow: 0 0 0 5px #000; }
.tm-support { font-size: 14px; color: #4a423b; margin: 8px 0 0; line-height: 1.6; }
.tm-msg-note { margin-top: 22px; }
.tm-actions { margin-top: 20px; display: grid; gap: 10px; }
.tm-primary, .tm-cancel { all: unset; box-sizing: border-box; min-height: 52px; display: flex; align-items: center; justify-content: center; border-radius: 4px; font-size: 16px; font-weight: 700; cursor: pointer; text-align: center; }
.tm-primary { background: #7d622a; color: #fff; }
.tm-primary:hover, .tm-cancel:hover { text-decoration: underline; text-underline-offset: 3px; }
.tm-cancel { border: 1.5px solid #8a8783; color: #1a1714; background: #fff; }
.tm-primary:focus-visible, .tm-cancel:focus-visible { outline: 3px solid #ffd43d; outline-offset: 2px; box-shadow: 0 0 0 5px #000; }
.tm-note { font-size: 14px; color: #4a423b; line-height: 1.7; margin: 14px 0 0; text-align: center; }

/* 背景のスクロール止め。style.css の html, body { overflow-x: hidden } があるため、
   body に overflow:hidden を付けても止まらない。html に付けるクラスで切り替える（js/photo-gallery.js・js/tip.js）。 */
html.is-scroll-locked { overflow: hidden; }

/* 拡大表示（ライトボックス）。背景は不透明 */
.lb { overscroll-behavior: contain; position: fixed; inset: 0; z-index: 1000; background: #0d0d0d; display: flex; flex-direction: column; color: #f0ebe3; }
.lb[hidden] { display: none; }
.lb-top { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px 10px 20px; font-family: var(--font-ui); font-size: 14px; color: #c4c0ba; }
.lb-btn { all: unset; box-sizing: border-box; cursor: pointer; min-width: 48px; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; padding: 0 8px; font-family: var(--font-ui); font-size: 14px; color: #f0ebe3; border-radius: 4px; }
.lb-btn:hover { background: rgba(255,255,255,.1); text-decoration: underline; text-underline-offset: 3px; }
.lb-btn:focus-visible { outline: 3px solid #ffd43d; outline-offset: 2px; box-shadow: 0 0 0 5px #000; }
.lb-prev, .lb-next { font-size: 40px; line-height: 1; }
.lb-stage { flex: 1; min-height: 0; display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; padding: 0 8px 16px; }
.lb-fig { grid-column: 2; margin: 0; min-height: 0; height: 100%; display: flex; align-items: center; justify-content: center; }
.lb-fig img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.lb-prev { grid-column: 1; grid-row: 1; }
.lb-next { grid-column: 3; grid-row: 1; }
.lb-end { grid-column: 2; grid-row: 1; display: none; max-width: 560px; margin: 0 auto; padding: 0 16px; text-align: center; }
.lb-end .lb-kicker { font-family: var(--font-ui); font-size: 14px; letter-spacing: .22em; color: #c8a96e; margin: 0 0 8px; }
.lb-end .tip2-btn { background: transparent; color: #f0ebe3; border-color: #c8a96e; max-width: 360px; margin: 18px auto 0; }
.lb-end .tip2-btn:hover { background: rgba(200,169,110,.15); }
.lb-end h3 { font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: .06em; line-height: 1.7; margin: 0 0 12px; color: #f0ebe3; }
.lb-end p { font-size: 15px; line-height: 1.9; color: #c4c0ba; margin: 0 0 8px; }
.lb.is-end .lb-fig { display: none; }
.lb.is-end .lb-end { display: block; }
.lb-fig.is-loading img { opacity: .35; }

@media (max-width: 640px) {
  .pg-title { font-size: 21px; }
  .pg-cols4, .pg-preview { grid-template-columns: repeat(2, 1fr); }
  .ph-h1 { font-size: 24px; }
  .ph-nav { position: static; }
  .tm { align-items: flex-end; padding: 0; }
  .tm-panel { border-radius: 12px 12px 0 0; max-height: 96vh; max-width: 560px; }
  .tm-amounts { grid-template-columns: repeat(2, 1fr); }
  .lb-stage { grid-template-columns: 1fr; position: relative; }
  .lb-fig, .lb-end { grid-column: 1; }
  .lb-end { padding: 0 60px; } /* 左右の矢印ボタン（幅48px）と文字を重ねない */
  .lb-prev, .lb-next { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(13,13,13,.6); z-index: 2; }
  .lb-prev { left: 4px; }
  .lb-next { right: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .pg-thumb img { transition: none; }
  .pg-thumb:hover img { transform: none; }
}
