/* =========================================================
   hitomi無料エロ漫画貯蔵庫（仮） 静的テンプレート
   コンセプト: 蔵（貯蔵庫）×ピンクと黒。検索を常に表示するヘッダー。
   ほかは静かに、表紙とサンプルを主役にする。
   ========================================================= */

/* ピンク×黒。ダークを基調にし、OSのライト/ダーク設定に関わらず同じ配色 */
:root {
  --plaster: #0e0e10;   /* 背景: 黒 */
  --paper:   #1a1a1d;   /* 面 */
  --ink:     #f5f1f3;   /* 文字 */
  --mouse:   #a8a1a6;   /* 補助文字 */
  --rule:    #2f2b30;   /* 罫 */
  --plum:    #ff4f9a;   /* ピンク: アクセント・購入導線 */
  --plum-dk: #ff78b2;
  --on-plum: #0e0e10;   /* ピンク上の文字 */
  --black:   #000000;
  --shelf:   #ff4f9a;   /* 棚板 */

  --f-display: "Shippori Mincho B1", "Noto Serif JP", "Noto Serif CJK JP", serif;
  --f-body: "Zen Kaku Gothic New", "Noto Sans JP", "Noto Sans CJK JP", "Hiragino Sans", sans-serif;

  --step--1: 0.8125rem;
  --step-0: 0.9375rem;
  --step-1: 1.125rem;
  --step-2: 1.375rem;
  --step-3: 1.75rem;

  --wrap: 1440px;
  --gap: 16px;

  color-scheme: dark;
  box-sizing: border-box;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: calc(64px + env(safe-area-inset-top, 0px)); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--plaster); color: var(--ink);
  font-family: var(--f-body); font-size: var(--step-0); line-height: 1.7;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--plum); }
:focus-visible { outline: 3px solid var(--plum); outline-offset: 2px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gap); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- ヘッダー ----------
   SP: サイト名＋ハンバーガーのみ。検索とメニューは開いたパネル内
   PC: 1行目にサイト名と検索、2行目にメニュー */
.site-header {
  position: sticky; top: 0; z-index: 30;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--black); border-bottom: 2px solid var(--plum);
}
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; min-height: 52px; }
.brand {
  font-family: var(--f-display); font-weight: 800; font-size: 16px; line-height: 1.3;
  text-decoration: none; padding: 12px 0; min-width: 0;
}
.nav-toggle {
  flex: none; width: 44px; height: 44px; margin-right: -10px;
  display: grid; place-items: center; border: 0; background: transparent; color: var(--ink); cursor: pointer;
}
.burger { width: 22px; height: 16px; position: relative; display: block; }
.burger span { position: absolute; left: 0; width: 100%; height: 2px; background: currentColor; border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
.burger span:nth-child(1) { top: 0; }
.burger span:nth-child(2) { top: 7px; }
.burger span:nth-child(3) { top: 14px; }
.nav-toggle[aria-expanded="true"] .burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .burger span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.global-nav {
  display: none; flex-basis: 100%;
  max-height: calc(100vh - 54px); overflow-y: auto;
  padding: 12px 0 16px; border-top: 1px solid var(--rule);
}
.global-nav.is-open { display: block; }
.nav-links ul { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.nav-links a { display: block; padding: 11px 0; text-decoration: none; border-bottom: 1px solid var(--rule); }
.search.header-search input { padding: 11px 12px; }
.search.header-search button { padding: 0 16px; }

@media (min-width: 900px) {
  .header-inner { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "brand search" "nav nav"; column-gap: 28px; }
  .brand { grid-area: brand; font-size: var(--step-1); padding: 18px 0; }
  .nav-toggle { display: none; }
  .global-nav { display: contents; }
  .header-search { grid-area: search; justify-self: end; align-self: center; width: 100%; max-width: 520px; }
  .search.header-search input { padding: 8px 12px; line-height: 1.4; }
  .nav-links { grid-area: nav; border-top: 1px solid var(--rule); }
  .nav-links ul { display: flex; gap: 26px; margin: 0; }
  .nav-links a { border: 0; padding: 9px 0; font-size: var(--step--1); }
  .nav-links a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--plum); color: var(--plum); }
}

/* ---------- 検索 ---------- */
.search { display: flex; border: 2px solid var(--plum); border-radius: 8px; overflow: hidden; background: var(--paper); }
.search input { flex: 1; min-width: 0; border: 0; padding: 12px 14px; font: inherit; color: inherit; background: transparent; }
.search button { border: 0; background: var(--plum); color: var(--on-plum); padding: 0 18px; font: inherit; font-weight: 700; cursor: pointer; }

/* ---------- パンくず ---------- */
.breadcrumb { font-size: var(--step--1); color: var(--mouse); padding-top: 12px; }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.breadcrumb li + li::before { content: "／"; margin-right: 4px; }
.breadcrumb a { text-decoration: none; }

/* ---------- 見出し ---------- */
.page-head { padding: 20px 0 8px; }
.page-title { font-family: var(--f-display); font-weight: 800; font-size: var(--step-3); line-height: 1.35; margin: 0; }
.page-lead { color: var(--mouse); margin: 6px 0 0; max-width: 40em; }
.sec { padding: 28px 0 8px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sec-title { font-family: var(--f-display); font-weight: 800; font-size: var(--step-2); margin: 0; line-height: 1.3; }
.sec-more { font-size: var(--step--1); white-space: nowrap; }

/* ---------- トップ：導入 ---------- */
.intro { padding: 18px 0 6px; display: grid; gap: 12px; }
.intro-stat { margin: 0; color: var(--mouse); font-size: var(--step--1); }
.intro-stat strong { color: var(--ink); font-size: var(--step-1); font-family: var(--f-display); }
.floor-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.floor-tabs a {
  text-decoration: none; padding: 8px 16px; border: 1px solid var(--ink); border-radius: 999px; font-size: var(--step--1);
}
.floor-tabs a[aria-current="page"] { background: var(--plum); border-color: var(--plum); color: var(--on-plum); font-weight: 700; }

/* ---------- 棚（作品グリッド） ---------- */
.shelf { list-style: none; margin: 0; padding: 0; }
.shelf--scroll {
  display: grid; grid-auto-flow: column; grid-auto-columns: 42%; gap: 14px;
  overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 14px;
  border-bottom: 5px solid var(--shelf);
}
.shelf--scroll > li { scroll-snap-align: start; }
@media (min-width: 600px) { .shelf--scroll { grid-auto-columns: 26%; } }
@media (min-width: 900px) { .shelf--scroll { grid-auto-columns: calc((100% - 5 * 14px) / 6); } }

.shelf--grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px 14px; }
@media (min-width: 600px) { .shelf--grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .shelf--grid { grid-template-columns: repeat(5, 1fr); } }

.work { position: relative; }
.work a { text-decoration: none; }
.work-title {
  font-weight: 700; font-size: var(--step-0); line-height: 1.45; margin: 8px 0 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.work a:hover .work-title { color: var(--plum); text-decoration: underline; }
.work-author { font-size: var(--step--1); color: var(--mouse); margin: 0; }
.work-review { font-size: var(--step--1); color: var(--mouse); margin: 0; }
.floor-badge {
  position: absolute; top: 6px; left: 6px; z-index: 1;
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 3px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--ink);
}
.rank-no {
  position: absolute; top: -6px; right: -4px; z-index: 1; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: var(--plum); color: var(--on-plum);
  font-family: var(--f-display); font-weight: 800; font-size: 16px;
}

/* 表紙（ダミー。本番はAPIの imageURL を img で出す） */
.cover {
  aspect-ratio: 5 / 7; width: 100%; border-radius: 3px; overflow: hidden;
  background: var(--c, #7a8196); position: relative; display: grid; place-items: end start;
  box-shadow: 0 1px 0 var(--rule);
}
.cover::after {
  content: "表紙"; color: #fff; opacity: .75; font-size: 11px; padding: 6px 8px;
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---------- タグ（ジャンル棚） ---------- */
.tag-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tag-list a {
  display: inline-block; text-decoration: none; padding: 6px 12px; border-radius: 4px;
  background: var(--paper); border: 1px solid var(--rule); font-size: var(--step--1);
}
.tag-list a:hover { border-color: var(--plum); }
.tag-list .count { color: var(--mouse); margin-left: 4px; }

/* ---------- 索引（ジャンル・作者一覧） ---------- */
.index-group { margin: 0 0 24px; }
.index-group h2 { font-family: var(--f-display); font-size: var(--step-1); margin: 0 0 10px; padding-bottom: 4px; border-bottom: 2px solid var(--plum); }
.index-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 20px; }
.index-list a { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--rule); text-decoration: none; }
.index-list .count { color: var(--mouse); font-size: var(--step--1); }

/* ---------- 一覧ページの並び替え・ページ送り ---------- */
.list-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 18px; font-size: var(--step--1); color: var(--mouse); }
.sort-links { display: flex; gap: 12px; }
.sort-links a[aria-current="true"] { color: var(--ink); font-weight: 700; text-decoration: none; }
.pager { display: flex; justify-content: center; gap: 6px; margin: 32px 0 8px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 42px; height: 42px; display: grid; place-items: center; padding: 0 10px;
  border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); text-decoration: none;
}
.pager [aria-current="page"] { background: var(--plum); color: var(--on-plum); border-color: var(--plum); font-weight: 700; }

/* ---------- 作品詳細 ---------- */
/* スマホ: 表紙を小さく横に置き、購入導線をファーストビューに入れる */
.work-detail { display: grid; grid-template-columns: 112px 1fr; gap: 14px 16px; padding-top: 16px; align-items: start; }
.detail-cta { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .work-detail { grid-template-columns: 300px 1fr; grid-template-rows: auto 1fr; gap: 16px 36px; }
  .detail-cover { grid-row: 1 / 3; }
  .detail-cta { grid-column: 2; }
}
.detail-title { font-family: var(--f-display); font-weight: 800; font-size: var(--step-2); line-height: 1.4; margin: 0 0 6px; }
@media (min-width: 900px) { .detail-title { font-size: var(--step-3); } }
.detail-byline { margin: 0 0 14px; color: var(--mouse); }
.detail-byline a { color: var(--ink); }
.detail-review { font-size: var(--step--1); color: var(--mouse); margin: 0 0 16px; }
.stars { color: var(--plum); letter-spacing: 1px; }

.cta { display: grid; gap: 10px; }
@media (min-width: 600px) { .cta { grid-template-columns: 1fr 1fr; max-width: 560px; } }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 52px;
  padding: 10px 18px; border-radius: 8px; font-weight: 700; text-decoration: none; text-align: center; line-height: 1.3;
}
.btn small { display: block; font-weight: 400; font-size: 11px; }
.btn-primary { background: var(--plum); color: var(--on-plum); }
.btn-primary:hover { background: var(--plum-dk); color: var(--on-plum); }
.btn-secondary { background: transparent; color: var(--ink); border: 2px solid var(--plum); }
.btn-secondary:hover { color: var(--plum); border-color: var(--plum); }
.cta-note { font-size: 11px; color: var(--mouse); margin: 8px 0 0; }

/* サンプル画像: SPは1カラム */
.samples { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 600px) { .samples { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .samples { grid-template-columns: repeat(4, 1fr); } }
.sample-btn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.sample-ph {
  aspect-ratio: 5 / 7; background: var(--c, #8a90a0); border-radius: 3px; display: grid; place-items: center;
  color: #fff; font-size: var(--step--1);
}
.samples-empty { padding: 18px; background: var(--paper); border: 1px dashed var(--rule); color: var(--mouse); border-radius: 6px; }

.spec { background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; margin: 0; }
.spec div { display: grid; grid-template-columns: 7.5em 1fr; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--rule); }
.spec div:first-child { border-top: 0; }
.spec dt { color: var(--mouse); font-size: var(--step--1); padding-top: 2px; }
.spec dd { margin: 0; }
.spec dd .tag-list a { padding: 3px 9px; }

/* スマホ下部の固定購入バー */
.sticky-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 8px var(--gap) calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--black); border-top: 1px solid var(--plum);
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  transform: translateY(110%); transition: transform .2s ease;
}
.sticky-cta.is-visible { transform: none; }
.sticky-cta .btn { min-height: 46px; font-size: var(--step--1); }
@media (min-width: 900px) { .sticky-cta { display: none; } }
body.has-sticky { padding-bottom: 72px; }
@media (min-width: 900px) { body.has-sticky { padding-bottom: 0; } }

/* ---------- 作者・シリーズ等の見出し情報 ---------- */
.term-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--step--1); color: var(--mouse); margin: 8px 0 0; padding: 0; list-style: none; }

/* ---------- 固定ページ本文 ---------- */
.prose { max-width: 42em; background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 22px; margin-top: 12px; }
.prose h2 { font-family: var(--f-display); font-size: var(--step-1); margin: 1.6em 0 .5em; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { max-width: 40em; }

/* ---------- ライトボックス ---------- */
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(92vw, 720px); }
.lightbox::backdrop { background: rgba(0, 0, 0, .9); }
.lightbox .sample-ph { width: min(92vw, 520px); }
.lightbox-body { display: grid; place-items: center; }
.lightbox-body img { max-height: 80vh; width: auto; margin: 0 auto; }
.lightbox-count { margin: 10px 0 0; color: #fff; text-align: center; font-size: var(--step--1); }
/* 前後の画像へ（サンプル画像が2枚以上のとき） */
.lightbox-nav {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 1;
  width: 48px; height: 48px; display: grid; place-items: center; padding: 0 0 4px;
  border: 1px solid rgba(255, 255, 255, .4); border-radius: 50%; background: rgba(0, 0, 0, .55);
  color: #fff; font-size: 32px; line-height: 1; cursor: pointer;
}
.lightbox-nav:hover { background: var(--plum); border-color: var(--plum); color: var(--on-plum); }
.lightbox-prev { left: max(8px, env(safe-area-inset-left, 0px)); }
.lightbox-next { right: max(8px, env(safe-area-inset-right, 0px)); }
.lightbox-nav[hidden], .lightbox-count[hidden] { display: none; }
.lightbox-close {
  display: block; margin: 10px auto 0; border: 1px solid #fff; background: transparent; color: #fff;
  padding: 8px 20px; border-radius: 6px; font: inherit; cursor: pointer;
}


/* ---------- 3カラムレイアウト（PC） ----------
   SP: メインのみ（サイドバーは非表示）
   900〜1199px: メイン＋右サイドバー（左の内容は右の下に回す）
   1200px〜: 左サイドバー／メイン／右サイドバー */
.layout { display: block; }
.side { display: none; }
.layout main .wrap { max-width: none; padding-left: 0; padding-right: 0; }
.layout main { min-width: 0; }
@media (max-width: 899px) { .layout { padding-left: 0; padding-right: 0; } .layout main .wrap { padding-left: var(--gap); padding-right: var(--gap); } }
@media (min-width: 900px) {
  .layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; grid-template-areas: "main right" "main left"; gap: 0 32px; align-items: start; }
  .layout main { grid-area: main; }
  .side { display: block; padding-top: 20px; }
  .side-left { grid-area: left; padding-top: 0; }
  .side-right { grid-area: right; }
}
@media (min-width: 1200px) {
  .layout { grid-template-columns: 230px minmax(0, 1fr) 260px; grid-template-areas: "left main right"; gap: 0 32px; }
  .side-left { padding-top: 20px; }
}

/* サイドバーのウィジェット */
.widget { background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 14px 14px 12px; margin-bottom: 18px; }
.widget-title { font-family: var(--f-display); font-weight: 800; font-size: var(--step-0); margin: 0 0 10px; padding-left: 10px; border-left: 3px solid var(--plum); line-height: 1.3; }
.widget-note { margin: -4px 0 8px; font-size: 11px; color: var(--mouse); }
.widget-more { margin: 8px 0 0; font-size: var(--step--1); text-align: right; }
.widget .tag-list { gap: 6px; }
.widget .tag-list a { padding: 4px 9px; font-size: 12px; background: transparent; }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini { position: relative; border-top: 1px solid var(--rule); }
.mini:first-child { border-top: 0; }
.mini a { display: flex; gap: 10px; padding: 8px 0; text-decoration: none; align-items: flex-start; }
.mini-thumb { width: 44px; flex: none; aspect-ratio: 5 / 7; border-radius: 2px; background: var(--c, #666); }
.mini-body { min-width: 0; display: grid; gap: 2px; }
.mini-title { font-size: 13px; font-weight: 700; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini a:hover .mini-title { color: var(--plum); text-decoration: underline; }
.mini-meta { font-size: 11px; color: var(--mouse); }
.mini-rank {
  position: absolute; left: -4px; top: 4px; z-index: 1; width: 20px; height: 20px; border-radius: 50%;
  background: var(--plum); color: var(--on-plum); font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.author-rank { list-style: none; margin: 0; padding: 0; }
.author-rank a { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--rule); text-decoration: none; font-size: 13px; }
.author-rank li:first-child a { border-top: 0; }
.rank-num { width: 20px; flex: none; text-align: center; font-weight: 700; color: var(--plum); }
.a-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.author-rank .count { font-size: 11px; color: var(--mouse); }

/* 3カラム時は中央が狭くなるので棚・グリッドの列数を調整 */
@media (min-width: 900px) {
  .shelf--grid { grid-template-columns: repeat(4, 1fr); }
  .shelf--scroll { grid-auto-columns: calc((100% - 4 * 14px) / 5); }
  .work-detail { grid-template-columns: 240px 1fr; }
}
@media (min-width: 1400px) {
  .shelf--grid { grid-template-columns: repeat(5, 1fr); }
}

/* ---------- 年齢確認 ---------- */
.age-gate {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  background: rgba(0, 0, 0, .78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.age-gate[hidden] { display: none; }
.age-card { width: min(100%, 420px); background: var(--paper); border-top: 4px solid var(--plum); border-radius: 10px; overflow: hidden; }
.age-body { padding: 22px 22px 24px; }
.age-body h2 { font-family: var(--f-display); font-size: var(--step-2); margin: 0 0 8px; }
.age-body p { margin: 0 0 18px; color: var(--mouse); font-size: var(--step--1); }
.age-actions { display: grid; gap: 10px; }
.age-actions .btn { width: 100%; }
.age-no { background: transparent; border: 0; color: var(--mouse); font: inherit; font-size: var(--step--1); text-decoration: underline; cursor: pointer; padding: 8px; }

/* ---------- フッター ---------- */
.site-footer { margin-top: 56px; background: var(--black); border-top: 2px solid var(--plum); padding: 32px 0 calc(28px + env(safe-area-inset-bottom, 0px)); font-size: var(--step--1); color: var(--mouse); }
.footer-grid { display: grid; gap: 26px; }
@media (min-width: 900px) { .footer-grid { grid-template-columns: 1fr 1.4fr; gap: 56px; } }
.footer-name { font-family: var(--f-display); font-weight: 800; font-size: var(--step-1); color: var(--ink); margin: 0 0 8px; }
.footer-about p { max-width: 30em; margin-top: 0; }
.footer-genres h2 { font-size: var(--step-0); color: var(--ink); margin: 0 0 12px; }
.footer-genres .tag-list a { background: transparent; }
.footer-more { margin: 12px 0 0; }
.footer-pr { margin: 28px 0 0; }
.footer-legal { list-style: none; margin: 12px 0 0; padding: 16px 0 0; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: 6px 20px; }
.site-footer a { color: var(--ink); }
.site-footer a:hover { color: var(--plum); }
.copyright { margin: 14px 0 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- トップのh1・ページ番号 ---------- */
.top-title { margin: 0; font-family: var(--f-display); font-weight: 800; font-size: var(--step-1); line-height: 1.4; }
.page-no { font-size: .6em; color: var(--mouse); margin-left: 4px; }
