/* =============================================
   しおりページ（template-shiori-page.php）専用CSS
   ============================================= */

:root {
  --ai:        #40220f;
  --ai-dark:   #2a1508;
  --ai-light:  #f2e8df;
  --washi:     #f0ece2;
  --kin:       #a96c1f;
  --sumi:      #231f1c;
  --haiiro:    #7a8590;
  --border-c:  #d2ccc0;
  --bg:        var(--washi);
  --text:      var(--sumi);
  --text-sub:  var(--haiiro);
  --accent:    var(--kin);
  --header-bg: var(--ai);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
  font-size: 15px;
  line-height: 1.8;
  min-height: 100vh;
}
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  box-shadow: 0 0 60px rgba(0,0,0,.1);
  padding-top: 56px; /* しおりバー分 */
}

/* --- しおりバー --- */
#shiori-bar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 56px;
  background: var(--header-bg);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 9999;
  box-sizing: border-box;
}
#shiori-back-btn {
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  transition: color .15s;
}
#shiori-back-btn:hover { color: #fff; }
#shiori-back-btn span {
  font-size: 24px;
  line-height: 1;
  margin-top: -2px;
}
#shiori-bar-title {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* --- コンテンツエリア --- */
.shiori-content {
  padding: 24px 20px 32px;
}
.shiori-content h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--ai);
  margin: 2rem 0 0.75rem;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border-c);
}
.shiori-content h2:first-child {
  margin-top: 0;
}
.shiori-content h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ai);
  margin: 1.5rem 0 0.5rem;
}

.shiori-content p {
  margin: 0 0 1rem;
}
.shiori-content ul,
.shiori-content ol {
  margin: 0 0 1rem;
  padding-left: 1.4em;
}
.shiori-content li {
  margin-bottom: 0.4rem;
}
.shiori-content a {
  color: var(--kin);
  text-decoration: underline;
}
.shiori-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0.5rem 0;
}
.shiori-content figure {
  margin: 1rem 0;
}
.shiori-content figcaption {
  font-size: 12px;
  color: var(--text-sub);
  text-align: center;
  margin-top: 4px;
}
.shiori-content strong { font-weight: 700; }
.shiori-content em     { font-style: italic; }
.shiori-content hr {
  border: none;
  border-top: 1px solid var(--border-c);
  margin: 1.5rem 0;
}

/* --- テーブル --- */
.shiori-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 0;
  margin-bottom: 1rem;
  overflow-x: auto;
  display: block;
}
.shiori-content table th,
.shiori-content table td {
  padding: 8px 10px;
  border: 1px solid var(--border-c);
  text-align: left;
  vertical-align: top;
}
.shiori-content table th {
  background: var(--ai-light);
  font-weight: 500;
  width: 18%;
  position: sticky;
  left: 0;
  z-index: 1;
}

/* --- 目次 --- */
.shiori-content .shiori-toc {
  margin: 0 0 1.5rem;
  padding: 10px 14px;
  background: var(--ai-light);
  border: 1px solid var(--border-c);
  border-radius: 4px;
}
.shiori-content .shiori-toc-title {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--ai);
}
.shiori-content .shiori-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.shiori-content .shiori-toc li::before {
  content: "▶ ";
  font-size: 10px;
  color: var(--kin);
}
.shiori-content .shiori-toc a {
  text-decoration: none;
  color: var(--ai);
  font-size: 14px;
}
.shiori-content .shiori-toc a:hover {
  text-decoration: underline;
}

/* --- 目次に戻るボタン --- */
.shiori-toc-back {
  display: block;
  text-align: right;
  margin-top: 1rem;
  font-size: 12px;
}
.shiori-toc-back a {
  color: var(--text-sub);
  text-decoration: none;
  padding: 4px 8px;
  border: 1px solid var(--border-c);
  border-radius: 3px;
  background: var(--ai-light);
}
.shiori-toc-back a:hover {
  color: var(--ai);
}

/* アンカーリンク先がしおりバーに隠れないオフセット */
.shiori-content [id] {
  scroll-margin-top: 68px;
}

/* --- shiori-table（縦積みレイアウト） --- */
.shiori-content table.shiori-table tbody {
  display: block;
  width: 100%;
}
.shiori-content table.shiori-table tr {
  display: block;
  width: 100%;
  margin-bottom: 0.5rem;
}
.shiori-content table.shiori-table th,
.shiori-content table.shiori-table td {
  display: block;
  width: 100%;
  box-sizing: border-box;
}
.shiori-content table.shiori-table th {
  position: static;
  border-bottom: none;
}

/* --- 英語要素を非表示（ブラウザ翻訳に任せる） --- */
.shiori-content .en {
  display: none;
}

/* --- dl（dt/dd を th/td 風に横並び） --- */
.shiori-content dl {
  display: flex;
  margin: 0 0 2px;
  font-size: 13px;
}
.shiori-content dl dt {
  flex: 0 0 8.5em;
  background: var(--ai-light);
  padding: 5px 8px;
  border: 1px solid var(--border-c);
  font-weight: 500;
  line-height: 1.5;
}
.shiori-content dl dd {
  flex: 1;
  margin: 0;
  padding: 5px 8px;
  border: 1px solid var(--border-c);
  border-left: none;
  line-height: 1.5;
}
.shiori-content dl + dl dt,
.shiori-content dl + dl dd {
  border-top: none;
}

/* --- テーブル横スクロール --- */
.shiori-content .scroll_table_wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.5rem 0;
}
.shiori-content .scroll_table_wrap table {
  min-width: 1000px;
  width: auto;
  display: table;
}

/* --- Google マップ --- */
.shiori-content .g_map_box {
  width: 100%;
  margin: 0.5rem 0;
}
.shiori-content .g_map_box iframe {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  border: 0;
}

/* --- YouTube --- */
.shiori-content div.youtube_wrapper {
  width: 90%;
  aspect-ratio: 16 / 9;
  margin: 0.5rem auto;
}
.shiori-content div.youtube_wrapper iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

/* --- FAQ グリッド --- */
.shiori-faq-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.shiori-faq-card {
  display: block;
  text-decoration: none;
  color: var(--text);
}
.shiori-faq-card img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  display: block;
  margin: 0;
}
.shiori-faq-card p {
  font-size: 14px;
  line-height: 1.5;
  margin: 8px 0 12px;
}

/* --- FAQ ページネーション --- */
.shiori-faq-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 20px 0 8px;
}
.shiori-faq-pagination a,
.shiori-faq-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--border-c);
  border-radius: 3px;
  font-size: 14px;
  text-decoration: none;
  color: var(--ai);
  background: var(--ai-light);
}
.shiori-faq-pagination .current {
  background: var(--ai);
  color: #fff;
  border-color: var(--ai);
}
.shiori-faq-pagination a:hover {
  background: var(--ai);
  color: #fff;
  border-color: var(--ai);
}

/* --- FAQモーダル --- */
.shiori-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.shiori-modal[aria-hidden="true"] {
  display: none;
}
.shiori-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .5);
}
.shiori-modal-inner {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 85vh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 12px 12px 0 0;
  padding: 48px 20px 40px;
  -webkit-overflow-scrolling: touch;
}
.shiori-modal-close {
  position: sticky;
  top: 0;
  float: right;
  margin: -40px -4px 8px 0;
  background: var(--ai-light);
  border: 1px solid var(--border-c);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  color: var(--ai);
  display: flex;
  align-items: center;
  justify-content: center;
}
.shiori-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ai);
  margin: 0 0 1rem;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-c);
  clear: both;
}
.shiori-modal-body img {
  max-width: 100%;
  height: auto;
  display: block;
}
.shiori-modal-loading {
  text-align: center;
  color: var(--text-sub);
  padding: 2rem 0;
}

/* --- フッター --- */
footer {
  text-align: center;
  padding: 24px 20px 36px;
  border-top: 1px solid var(--border-c);
}
footer a {
  font-size: 13px;
  color: var(--text-sub);
  text-decoration: none;
  border-bottom: 1px solid var(--border-c);
  padding-bottom: 2px;
}
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
