/*
Theme Name: shikofans
Description: 至高のファンズたち 専用テーマ。作品データは投稿メタに持ち、表示はテンプレートで行う（本文に焼かない）。設計は DESIGN.md。
Version: 0.1.0
Text Domain: shikofans
*/

/* 白基調（2026-10-01 ユーザー指定）。色はここだけで決める */
:root {
  --bg: #ffffff;
  --surface: #f6f6f8;
  --surface-2: #ececf0;
  --border: #e2e2e8;
  --text: #1d1d22;
  --muted: #6e6e7a;
  --accent: #e8336f;
  --accent-text: #ffffff;
  --link: #d42a63;
  --radius: 10px;
  --wrap: 960px;
  --layout: 1320px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  font-size: 15px;
  line-height: 1.7;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; display: block; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

/* header */
.header-inner { max-width: var(--layout); margin: 0 auto; padding: 0 16px; }
.site-header { background: var(--bg); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.header-top { display: flex; align-items: center; gap: 16px; height: 60px; }
.site-logo { display: flex; align-items: center; gap: 8px; color: var(--text); flex-shrink: 0; }
.site-logo:hover { text-decoration: none; }
.logo-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 900; font-size: 17px;
}
.logo-text { font-weight: 800; font-size: 18px; letter-spacing: .02em; white-space: nowrap; }
.header-search { margin-left: auto; position: relative; width: min(340px, 45vw); }
.header-search input {
  width: 100%; height: 38px; padding: 0 40px 0 14px; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; outline: none;
}
.header-search input:focus { border-color: var(--accent); background: var(--bg); }
.header-search button {
  position: absolute; right: 4px; top: 4px; width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: transparent; cursor: pointer;
}
/* 虫眼鏡（画像を使わず CSS で描く） */
.header-search button::before {
  content: ""; position: absolute; left: 7px; top: 7px; width: 11px; height: 11px;
  border: 2px solid var(--muted); border-radius: 50%;
}
.header-search button::after {
  content: ""; position: absolute; left: 19px; top: 19px; width: 2px; height: 7px;
  background: var(--muted); transform: rotate(-45deg); transform-origin: top;
}
.global-nav { border-top: 1px solid var(--border); }
.global-nav .header-inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.global-nav a {
  position: relative; padding: 10px 14px; font-size: 14px; font-weight: 700; color: var(--muted); white-space: nowrap;
}
.global-nav a:hover { color: var(--text); text-decoration: none; }
.global-nav a.is-current { color: var(--text); }
.global-nav a.is-current::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent);
}
@media (max-width: 600px) {
  .header-top { height: 54px; gap: 10px; }
  .logo-text { font-size: 15px; }
  .header-search { width: auto; flex: 1; }
}

/*
 * 3段組み（PC）：左＝人気ランキング／中央＝本文／右＝新着・クリエイター・タグ。
 * DOM は本文→左→右の順なので、スマホでは本文の下に左→右が並ぶ。
 */
.layout { max-width: var(--layout); margin: 0 auto; padding: 0 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 28px; }
.layout-main { min-width: 0; }
.layout-left, .layout-right { min-width: 0; }
@media (min-width: 960px) {
  /* 画面が中くらいの時は2列。右の列は「人気ランキング → 新着・クリエイター・タグ」の順（ランキングを上に）。
     1行目は中身の高さぴったり（auto）、2行目が残りを受け持つ（1fr）ので、2つの箱の間に空白ができない */
  .layout { grid-template-columns: minmax(0, 1fr) 260px; grid-template-areas: "main left" "main right"; grid-template-rows: auto 1fr; align-items: start; }
  .layout-main { grid-area: main; }
  .layout-right { grid-area: right; }
  .layout-left { grid-area: left; }
}
@media (min-width: 1280px) {
  .layout { grid-template-columns: 220px minmax(0, 1fr) 260px; grid-template-areas: "left main right"; grid-template-rows: auto; }
}
/* 左の欄が無いページ（トップ・新着）は 本文＋右 の2列（2026-10-04） */
@media (min-width: 960px) {
  .layout.no-left { grid-template-columns: minmax(0, 1fr) 280px; grid-template-areas: "main right"; grid-template-rows: auto; }
}
@media (min-width: 960px) {
  .layout-left, .layout-right { padding-top: 4px; }
}

/* 両脇の誘導欄 */
.side-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin: 18px 0 0; background: var(--bg); }
.side-title-head { font-size: 15px; margin: 0 0 10px; padding-left: 8px; border-left: 3px solid var(--accent); }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li + li { margin-top: 10px; }
.side-item { display: flex; align-items: center; gap: 10px; color: var(--text); }
.side-item:hover { text-decoration: none; }
.side-item:hover .side-title { color: var(--link); }
.side-thumb { flex-shrink: 0; width: 56px; height: 56px; border-radius: 0; overflow: hidden; background: var(--surface-2); }
.side-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; }
.side-title { font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rank {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: var(--muted); background: var(--surface-2);
}
.rank-1 { background: #e8b923; color: #fff; }
.rank-2 { background: #a8adb7; color: #fff; }
.rank-3 { background: #c98a4b; color: #fff; }
.side-links { list-style: none; margin: 0; padding: 0; }
.side-links a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; font-size: 14px; color: var(--text); border-bottom: 1px solid var(--border); }
.side-links li:last-child a { border-bottom: 0; }
.side-links span { color: var(--muted); font-size: 12px; }
.side-more { display: block; text-align: right; font-size: 13px; margin-top: 10px; }

/* /creators/・/tags/ */
.creator-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.creator-item { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
.creator-item:hover { text-decoration: none; border-color: var(--accent); }
.creator-thumb { width: 52px; height: 52px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: var(--surface-2); }
.creator-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; }
.creator-name { font-weight: 700; font-size: 14px; flex: 1; }
.creator-count { font-size: 12px; color: var(--muted); }
.tag-cloud .tag span { margin-left: 6px; color: var(--muted); font-size: 11px; }

.site-footer { margin-top: 48px; padding: 24px 0 40px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 8px; }
.site-footer a { color: var(--muted); }

/* breadcrumb / PR */
.breadcrumb { font-size: 12px; color: var(--muted); margin: 14px 0 6px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb span + span::before { content: "›"; margin: 0 6px; }
.pr-note { display: inline-block; font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 6px; margin-bottom: 6px; }

/* work page */
.work-title { font-size: 21px; line-height: 1.45; margin: 4px 0 14px; }
/* 縦動画（スマホ撮影）が多いので比率は固定しない。画面からはみ出さないよう高さだけ抑える */
/* 作品画像（カバー）。元の比率のまま中央に。押すと myfans へ。マウスを乗せると白く光る（再生ボタンは付けない） */
.work-cover { display: flex; justify-content: center; }
.cover-frame { position: relative; display: inline-block; max-width: 100%; border-radius: 0; overflow: hidden; line-height: 0; } /* 角は四角（2026-10-04） */
.cover-frame img { display: block; max-width: 100%; max-height: 80vh; width: auto; height: auto; }
a.cover-frame::after { content: ""; position: absolute; inset: 0; background: #fff; opacity: 0; transition: opacity .2s; pointer-events: none; }
a.cover-frame:hover::after, a.cover-frame:focus-visible::after { opacity: .45; }

/* 枠は動画と同じ大きさ（黒い余白を作らない）。中央寄せ、縦長は画面の高さに収める */
.work-video { display: flex; justify-content: center; }
.video-frame { position: relative; display: inline-block; max-width: 100%; border-radius: var(--radius); overflow: hidden; line-height: 0; }
.video-frame video { display: block; max-width: 100%; max-height: 80vh; width: auto; height: auto; }
.work-video.placeholder { aspect-ratio: 16 / 9; border-radius: var(--radius); }
.play-button {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 88px; height: 60px; padding: 0; cursor: pointer;
  background: rgba(40, 40, 46, .55); border: 2px solid rgba(255, 255, 255, .9); border-radius: 14px;
  backdrop-filter: blur(2px);
}
.play-button::after {
  content: ""; position: absolute; top: 50%; left: 52%; transform: translate(-50%, -50%);
  border-style: solid; border-width: 13px 0 13px 22px; border-color: transparent transparent transparent #fff;
}
.play-button:hover { background: rgba(40, 40, 46, .7); }
.work-video:not(.is-idle) .play-button { display: none; }
.work-video.placeholder, .card-thumb.placeholder { display: grid; place-items: center; color: var(--muted); font-size: 13px; background: var(--surface-2); }

.cta {
  display: block; text-align: center; margin: 16px 0;
  background: var(--accent); color: var(--accent-text);
  font-weight: 800; font-size: 17px; padding: 15px 16px; border-radius: var(--radius);
}
.cta:hover { text-decoration: none; filter: brightness(1.08); }
.cta small { display: block; font-weight: 400; font-size: 12px; opacity: .9; }


.meta-table { width: 100%; border-collapse: collapse; margin: 14px 0 6px; font-size: 14px; }
.meta-table th, .meta-table td { border-bottom: 1px solid var(--border); padding: 9px 4px; text-align: left; vertical-align: top; }
.meta-table th { width: 7em; color: var(--muted); font-weight: 400; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 10px; font-size: 13px; color: var(--text); }

.section-title { font-size: 18px; margin: 32px 0 12px; padding-left: 10px; border-left: 4px solid var(--accent); }

/* 切り抜かず、元の比率のまま段組みで上から詰める（縦長・横長が混ざってもそのまま。2026-10-01 ユーザー判断で最初の形に戻した） */
.gallery { columns: 2; column-gap: 6px; }
@media (min-width: 720px) { .gallery { columns: 3; } }
.tile { display: block; break-inside: avoid; margin-bottom: 6px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.tile img { width: 100%; height: auto; }

.description { font-size: 14px; line-height: 1.9; white-space: normal; overflow-wrap: anywhere; }
.summary-title { font-size: 15px; margin: 0 0 8px; }
.summary { color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; }

.pager { display: flex; justify-content: space-between; gap: 10px; margin: 18px 0; font-size: 13px; }
.pager a { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; color: var(--text); }
.pager .next { text-align: right; }
.pager small { display: block; color: var(--muted); }

/* cards */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .cards { gap: 18px; } } /* 横は常に2つ（2026-10-04 ユーザー希望：3つだと画像が小さい） */
.card { display: block; color: var(--text); }
.card:hover { text-decoration: none; }
.card-thumb { position: relative; border-radius: 0; overflow: hidden; aspect-ratio: 16 / 10; background: var(--surface-2); }
/* 一覧のサムネは小さいので切り抜く。顔は上寄りに写っていることが多いので、中央ではなく上寄りを残す */
.card-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; }
.card-title { font-size: 13px; line-height: 1.5; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: 12px; color: var(--muted); }
.more { display: block; text-align: right; font-size: 14px; margin-top: 10px; }

.archive-head h1 { font-size: 20px; margin: 18px 0 6px; }
.term-intro { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 18px; font-size: 14px; line-height: 1.9; }
.term-intro p { margin: 0 0 .8em; }
.term-intro p:last-child { margin-bottom: 0; }
.archive-head p { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.pagination { margin: 24px 0; display: flex; gap: 6px; flex-wrap: wrap; }
.pagination .page-numbers { border: 1px solid var(--border); border-radius: 6px; padding: 2px 10px; color: var(--text); }
.pagination .current { border-color: var(--accent); }

/* age gate：本文は最初から HTML にある。JS でかぶせるだけ（クローラーには影響させない） */
.age-gate { position: fixed; inset: 0; z-index: 1000; background: rgba(255, 255, 255, .98); display: none; place-items: center; padding: 16px; }
.age-gate.is-open { display: grid; }
.age-gate-box { max-width: 420px; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px 20px; text-align: center; }
.age-gate-box h2 { margin: 0 0 8px; font-size: 18px; }
.age-gate-box p { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.age-gate-box .cta { margin: 0 0 10px; }
.age-gate-box .leave { color: var(--muted); font-size: 13px; }

/* 固定ページ（運営者情報・プライバシーポリシー・お問い合わせ） */
.static-body { font-size: 15px; line-height: 1.9; max-width: 760px; }
.static-body h2 { font-size: 17px; margin: 28px 0 8px; padding-left: 10px; border-left: 4px solid var(--accent); }
.static-body table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.static-body th, .static-body td { border-bottom: 1px solid var(--border); padding: 10px 6px; text-align: left; vertical-align: top; }
.static-body th { width: 9em; color: var(--muted); font-weight: 400; }
.contact-form { display: grid; gap: 14px; max-width: 560px; margin-top: 12px; }
.contact-form label { display: grid; gap: 4px; font-size: 14px; font-weight: 700; }
.contact-form input, .contact-form select, .contact-form textarea {
  font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text);
}
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus { outline: none; border-color: var(--accent); }
.contact-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-form .cta { border: 0; cursor: pointer; font: inherit; font-weight: 800; }
.contact-note { font-size: 13px; color: var(--muted); margin: 0; }
.contact-done, .contact-error { padding: 14px 16px; border-radius: var(--radius); }
.contact-done { background: #eaf7ee; }
.contact-error { background: #fdecef; color: #a3123a; }

/* ===== クリックの機会を増やす枠（2026-10-03） ===== */
/* カードの右上のクリエイター名バッジ・浮き上がり */
.card-badge {
  position: absolute; top: 8px; right: 8px; max-width: calc(100% - 16px);
  padding: 2px 10px; border-radius: 999px; color: #fff;
  background: rgba(0, 0, 0, .45);                                   /* 古いブラウザ向け */
  background: color-mix(in srgb, var(--accent) 55%, transparent);  /* 透かし（2026-10-04 ユーザー希望。画像が見えるように） */
  font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.card { transition: transform .15s; }
.card:hover { transform: translateY(-2px); }
.card .card-thumb { box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.card-title { font-weight: 700; }

/* ピックアップ（ヘッダー下で横に流れる） */
.pickup { max-width: var(--layout); margin: 14px auto 6px; padding: 0 16px; }
.pickup-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: 72%; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; padding-bottom: 4px;
}
.pickup-track::-webkit-scrollbar { display: none; }
/* 一覧が横2つで大きくなったので、ピックアップは小さめに（2026-10-04 ユーザー希望：3つ／4つ → 4つ／6つ → 5つ／8つ） */
@media (min-width: 720px) { .pickup-track { grid-auto-columns: calc((100% - 48px) / 5); } }
@media (min-width: 1280px) { .pickup-track { grid-auto-columns: calc((100% - 84px) / 8); } }
@media (min-width: 720px) { .pickup-title { font-size: 12px; margin-top: 5px; } }
.pickup-card { scroll-snap-align: start; color: var(--text); display: block; }
.pickup-card:hover { text-decoration: none; }
.pickup-card:hover .pickup-thumb img { transform: scale(1.03); }
.pickup-thumb { position: relative; display: block; aspect-ratio: 16 / 10; border-radius: 0; overflow: hidden; background: var(--surface-2); }
.pickup-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; transition: transform .25s; }
.pickup-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 8px; font-size: 15px; font-weight: 800; line-height: 1.5; }
.pickup-dots { display: flex; justify-content: center; gap: 8px; margin-top: 8px; }
.pickup-dots button { width: 9px; height: 9px; padding: 0; border: 0; border-radius: 50%; background: var(--border); cursor: pointer; }
.pickup-dots button.is-current { background: var(--text); }

/* 横の人気ランキング（大きい画像のカード） */
.side-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.side-card { display: block; color: var(--text); }
.side-card:hover { text-decoration: none; }
.side-card:hover .side-title { color: var(--link); }
.side-card-thumb { position: relative; display: block; aspect-ratio: 16 / 10; border-radius: 0; overflow: hidden; background: var(--surface-2); }
.side-card-thumb.placeholder { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.side-card-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; }
.side-card-thumb .rank { position: absolute; top: 6px; left: 6px; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.side-card .side-title { display: -webkit-box; margin-top: 5px; font-weight: 700; -webkit-line-clamp: 2; }

/* ピックアップの左右の矢印 */
.pickup { position: relative; }
.pickup-arrow {
  position: absolute; top: calc(50% - 34px); z-index: 2; width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .92); color: var(--text); box-shadow: 0 2px 10px rgba(0, 0, 0, .18); cursor: pointer;
  display: grid; place-items: center; font-size: 26px; line-height: 1; padding: 0 0 3px;
}
.pickup-arrow:hover { background: #fff; color: var(--accent); }
.pickup-arrow.prev { left: 4px; }
.pickup-arrow.next { right: 4px; }
.pickup-arrow[disabled] { opacity: 0; pointer-events: none; }
@media (max-width: 719px) { .pickup-arrow { width: 34px; height: 34px; font-size: 22px; } }

/* おすすめ作品：36件のうち12件だけ見せる（どれを見せるかは site.js が毎回ランダムに並べ替える。JS が無ければ先頭12件） */
.recommend .cards > :nth-child(n+13) { display: none; }

/* PC の左右の余白（2026-10-04 ユーザー希望：ノートPCの幅だと 16px で窮屈）。左右とも同じ幅 */
@media (min-width: 960px) {
  .wrap, .header-inner, .layout, .pickup { padding-left: 40px; padding-right: 40px; }
}
