/* ===== Policy Page Layout (Final v2) ===== */

/* スムーススクロール（目次 → 見出し） */
html { scroll-behavior: smooth; }
/* ユーザーが「動きを減らす」を選んだ場合は無効化 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ===== Policy Page Layout (selector harden) ===== */

/* どれか1つ当たればOK：テンプレ名・別名・スラッグ */
body.page-template-policy-page,
body.page-template-page-policy,
body.page-template-templates-policy-page,
body.page-template-templates-page-policy,
body.page-slug-policy {
  background: url('https://adventcosplay.com/wp-content/uploads/2025/08/smokeground_B.jpg')
    center center / cover fixed no-repeat;
  font-family: 'Yusei Magic', serif;
  color: #222;
  line-height: 1.9;
}


/* 全体コンテナ */
.policy-article {
  max-width: 1200px;
  margin: 60px auto;
  padding: 40px 28px;
  background: transparent;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.15);
  position: relative;
  z-index: 1;
}

/* 羊皮紙ラッパー（文字部分を包む） */
.policy-wrapper {
  background: url('https://adventcosplay.com/wp-content/uploads/2025/08/smokeground_Y.jpg')
    center top / cover no-repeat;
  border: 1px solid rgba(255, 245, 230, 0.4);
  border-radius: 12px;
  padding: 50px 40px;
  box-shadow:
    0 0 40px rgba(0, 0, 0, 0.4),
    inset 0 0 10px rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(3px);
  position: relative;
}

/* タイトル */
.policy-title {
  text-align: center;
  font-size: clamp(26px, 3vw, 34px);
  margin-bottom: 16px;
  color: #3c1b1b;
  font-family: 'Hangyaku', serif;
  text-shadow: 0 0 10px rgba(255, 230, 200, 0.6);
  border-bottom: 2px solid rgba(130, 51, 39, 0.25);
  padding-bottom: 8px;
}

/* リード文 */
.policy-lead {
  text-align: center;
  color: #4c3b3b;
  margin-bottom: 28px;
  font-size: 1.05rem;
}

/* =========================
   目次（TOC）
========================= */
.policy-toc {
  margin: 22px 0 32px;
  padding: 16px 18px;
  background: rgba(255, 248, 235, 0.85);
  border: 1px solid rgba(130, 51, 39, 0.25);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}
.policy-toc strong {
  display: block;
  margin-bottom: 8px;
  color: #823327;
  letter-spacing: .03em;
}
.policy-toc ul {
  margin: 0;
  padding-left: 18px;
  list-style: disc;
  columns: 2;
  column-gap: 28px;
}
@media (max-width: 640px){
  .policy-toc ul { columns: 1; }
}
.policy-toc li { margin: 6px 0; }
.policy-toc a {
  color: #5c2a2a;
  text-decoration: none;
  border-bottom: 1px dashed rgba(92,42,42,.35);
  transition: color .2s ease, border-color .2s ease;
}
.policy-toc a:hover,
.policy-toc a:focus-visible {
  color: #9f3c3c;
  border-bottom-color: rgba(159,60,60,.6);
  outline: none;
}

/* アンカー位置ずれ対策（固定ヘッダー分の余白） */
.policy-wrapper h2[id] { scroll-margin-top: 84px; }

/* セクション区切り */
.policy-section + .policy-section { margin-top: 40px; }

/* 見出し */
.policy-wrapper h2,
.policy-hd {
  font-size: 1.3rem;
  margin-bottom: 10px;
  color: #823327;
  border-bottom: 2px solid rgba(130, 51, 39, 0.2);
  padding-bottom: 6px;
  text-shadow: 0 0 4px rgba(255, 240, 210, 0.5);
  line-height: 1.5;
}

/* 見出しへジャンプした直後の視認性アップ */
.policy-wrapper h2:target {
  animation: policyTargetFlash .9s ease-out 1;
  outline: 3px solid rgba(130, 51, 39, .35);
  outline-offset: 4px;
}
@keyframes policyTargetFlash {
  0%   { background-color: rgba(255, 240, 220, .9); }
  100% { background-color: transparent; }
}

/* 本文 */
.policy-section p {
  margin-bottom: 12px;
  color: #2a1a1a;
  line-height: 1.95;
}

/* リスト */
.policy-section ul,
.policy-section ol {
  padding-left: 1.4em;
  margin: .5em 0 1.2em;
}
.policy-section li { margin: .25em 0; }

/* リンク */
.policy-section a {
  color: #7a1f3a;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color .2s ease;
}
.policy-section a:hover,
.policy-section a:focus-visible {
  color: #b0375c;
}

/* インラインコード（メタタグなど） */
.policy-section code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .95em;
  background: rgba(0,0,0,.06);
  padding: .08em .4em;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,.08);
}

/* 補足/注意ボックス（任意） */
.policy-note {
  background: rgba(255, 252, 245, .9);
  border: 1px solid rgba(130, 51, 39, .25);
  padding: 12px 14px;
  border-radius: 8px;
  color: #3a2a2a;
  margin: 12px 0 18px;
}

/* 更新日 */
.policy-updated {
  text-align: right;
  font-size: .95rem;
  color: #5b4a4a;
  font-style: italic;
  margin-top: 16px;
}

/* フッター */
.policy-footer {
  text-align: right;
  font-size: 0.9rem;
  margin-top: 40px;
  color: #5b4a4a;
  font-style: italic;
}

/* アクセシビリティ：キーボードフォーカスの視認性 */
a:focus-visible,
button:focus-visible {
  outline: 3px solid #b0375c;
  outline-offset: 3px;
  border-radius: 4px;
}

/* レスポンシブ */
@media (max-width: 960px){
  .policy-article { margin: 40px auto; padding: 28px 18px; }
  .policy-wrapper { padding: 36px 22px; }
}
@media (max-width: 640px){
  .policy-title { font-size: clamp(24px, 5.5vw, 30px); }
  .policy-section + .policy-section { margin-top: 32px; }
}

/* ===== 印刷用（背景・装飾を抑えて読みやすく） ===== */
@media print {
  body.page-template-policy-page {
    background: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .policy-article {
    box-shadow: none !important;
    margin: 0;
    padding: 0;
  }
  .policy-wrapper {
    background: #fff !important;
    box-shadow: none !important;
    border: 0;
    padding: 0;
  }
  .policy-toc { break-inside: avoid; }
  a[href]:after {
    content: " (" attr(href) ")";
    font-size: 0.9em;
  }
}
