/*
Theme Name: Joseimanga
Description: 女性向けエロ漫画（TL / BL / 男性向け）のまとめサイト用テーマ。CSVから作品を取り込み、ジャンル・作者・サークル・出版社で引ける。配色は milky（milk-key.com）を踏襲。
Version: 1.0.3
Requires at least: 6.4
Requires PHP: 8.0
Text Domain: joseimanga
*/

/* ============================================================
   色・寸法のトークン

   milky（milk-key.com）から取った配色。
     --main    #d83473  主色
     --main-d  #b92761  ボタンのベタ影とホバー
     --tint    #fdf0f5  ヘッダー地とセクションの面
     --footer  #f09199  フッター地

   フッターの文字を白にしないこと。#f09199 の上の白文字は
   コントラストが 2.28:1 で、12px前後だと読めない。
   #3d2329 なら 5.7:1。
   ============================================================ */

:root {
    --main:   #d83473;
    --main-d: #b92761;
    --tint:   #fdf0f5;
    --footer: #f09199;
    --footer-fg: #3d2329;

    --bl:     #6e4fa8;   /* BLの小札 */
    --men:    #5b6472;   /* 男性向けの小札 */

    --fg:     #313131;
    --sub:    #6e6e6e;   /* 白地で 5.2:1。これより薄くしない */
    --line:   #ece2e7;
    --rule:   #f0e7eb;
    --card:   #fff;
    --ink:    #15131a;   /* 本編の面 */

    --radius: 5px;
    --wrap:   1180px;
}

/* ============================================================
   土台
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: #fff;
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
                 "Noto Sans JP", Meiryo, sans-serif;
    font-size: 14px;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; vertical-align: bottom; }
[hidden] { display: none !important; }
a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--main-d); }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3 { line-height: 1.5; }

.wrap {
    max-width: var(--wrap);
    margin: 0 auto;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.screen-reader-text {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ============================================================
   ヘッダー  milky と同じ作り

   PC   上に主色の20px帯／ロゴ100px＋サイト説明380px＋右にアイコンナビ
   スマホ 50pxでロゴ中央、右にハンバーガー
   ============================================================ */

#header {
    width: 100%;
    background: var(--tint);
    box-shadow: 0 2px 3px rgba(0, 0, 0, .2);
    position: relative;
}

#header .general { display: none; }

#header .head-row {
    display: flex;
    align-items: center;
}

#header .logo { margin: 0; text-align: center; flex: 1 1 auto; }
#header .logo a { display: block; line-height: 50px; height: 50px; }
#header .logo img { max-height: 32px; width: auto; vertical-align: middle; }
#header .logo .sitename {
    font-family: 'Leckerli One', cursive;
    font-size: 25px; font-weight: 400; color: var(--main);
    display: inline-block; margin-right: 10px;
}
#header .logo .dir {
    font-size: 22px; color: var(--main);
    font-family: 'Kaisei Decol', serif;
}

#header .site-description { display: none; }
#header .navigation { display: none; }

/* ハンバーガー */
.menu-open {
    position: absolute; top: 0; right: 10px;
    width: 44px; height: 50px;
    border: 0; background: none; cursor: pointer; color: var(--main);
    display: flex; align-items: center; justify-content: center;
}

/* 引き出し */
.drawer { display: none; position: fixed; inset: 0; z-index: 120; }
.drawer.open { display: block; }
.drawer-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .35); border: 0; width: 100%; }
.drawer-in {
    position: absolute; top: 0; right: 0; z-index: 2;
    width: min(300px, 86vw); height: 100%;
    background: #fafafa; padding: 56px 14px 24px;
    overflow-y: auto;
}
.drawer-in h2 { margin: 0 0 14px; font-size: 16px; text-align: center; }
.drawer-in nav a {
    display: block; padding: 11px 2px; color: var(--sub);
    border-bottom: 1px solid #ddd; font-size: 13.5px;
}
.drawer-in nav a:hover { color: var(--main-d); }
.menu-close {
    position: absolute; top: 6px; right: 10px;
    width: 44px; height: 44px; border: 0; background: none; cursor: pointer; color: var(--main);
    display: flex; align-items: center; justify-content: center;
}

/* 検索窓 */
.search-form { display: flex; align-items: center; }
.search-form input[type="search"] {
    flex: 1 1 auto; min-width: 0; height: 38px; padding: 0 13px;
    font: inherit; font-size: 13px; color: var(--fg);
    background: #fff; border: 1px solid #e7dce2; border-right: 0;
    border-radius: var(--radius) 0 0 var(--radius);
}
.search-form input[type="search"]:focus { outline: none; border-color: var(--main); }
.search-form button {
    flex: 0 0 auto; height: 38px; width: 46px;
    border: 0; border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--main); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

@media (min-width: 1080px) {
    #header .general {
        display: block; margin: 0;
        background: var(--main); text-align: right;
        height: 20px; line-height: 20px;
    }
    #header .general a {
        font-size: 13px; color: #fff;
        display: inline-block; padding: 0 30px;
    }
    #header .logo { flex: 0 0 auto; text-align: left; padding: 0 15px 0 30px; }
    #header .logo a { line-height: 100px; height: 100px; }
    #header .logo img { max-height: 56px; }
    #header .logo .sitename { font-size: 32px; }
    #header .logo .dir { font-size: 30px; }

    #header .site-description {
        flex: 0 0 auto; margin: 0; display: flex; align-items: center;
        width: 380px; font-size: 12px; line-height: 1.7; color: var(--sub);
    }
    #header .navigation { display: block; flex: 0 0 auto; margin-left: auto; padding-right: 30px; }
    /*
     * #header を付けて限定する。付けないと the_posts_pagination() が出す
     * <nav class="navigation pagination"> にも当たり、ページ送りが
     * 高さ100pxの横並びになる。
     */
    #header .navigation ul { display: flex; align-items: center; height: 100px; }
    #header .navigation ul li { flex: 0 0 auto; margin: 0 10px; text-align: center; }
    #header .navigation ul li a { display: block; width: 64px; font-size: 12px; color: var(--main); }
    #header .navigation ul li a svg { display: block; margin: 0 auto 2px; }
    #header .navigation ul li a:hover { color: var(--main-d); }

    .menu-open { display: none; }
}

/* ============================================================
   見出し
   ============================================================ */

.sec { padding-top: 44px; }
.sec.band { padding-bottom: 44px; }
.sec-last { padding-bottom: 44px; }
.sec-hd { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.sec-ttl {
    display: flex; align-items: center; gap: 10px; margin: 0;
    font-family: 'Kaisei Decol', serif; font-weight: 700;
    font-size: 19px; letter-spacing: .01em;
}
.sec-ttl::before {
    content: ""; width: 5px; height: 22px;
    border-radius: 999px; background: var(--main);
}
.more { margin-left: auto; font-size: 12px; color: var(--main-d); white-space: nowrap; }
.more:hover { text-decoration: underline; }

.band { background: var(--tint); }

.page-head { padding-top: 26px; }
.page-head h1 {
    margin: 0; font-family: 'Kaisei Decol', serif; font-weight: 700;
    font-size: 27px; letter-spacing: .01em; text-wrap: balance;
}
.page-tagline {
    margin: 9px 0 0; font-size: 13.5px; font-weight: 700;
    color: var(--main-d); letter-spacing: .02em;
}
.page-lead { margin-top: 13px; max-width: 64ch; font-size: 13.5px; line-height: 1.95; color: #4f4a4d; }
.page-lead p { margin: 0 0 .7em; }
.page-lead p:last-child { margin-bottom: 0; }

/* ============================================================
   パンくず
   ============================================================ */

.crumb { padding-top: 12px; font-size: 11.5px; color: var(--sub); }
.crumb ol { display: flex; flex-wrap: wrap; gap: 6px; }
.crumb li::after { content: "›"; margin-left: 6px; color: #b9a2ab; }
.crumb li:last-child::after { content: ""; }
.crumb a { color: var(--main-d); }
.crumb a:hover { text-decoration: underline; }

/* ============================================================
   作品カード
   ============================================================ */

.grid {
    margin-top: 18px;
    display: grid; gap: 18px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
}
.grid.five { gap: 20px; grid-template-columns: repeat(5, minmax(0, 1fr)); }

.cv {
    position: relative; aspect-ratio: 3 / 4; max-width: 100%;
    border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--line); background: #f7eef2;
}
.cv img { width: 100%; height: 100%; object-fit: cover; }
.card:hover .cv { border-color: var(--main); }

.c-ttl {
    margin: 7px 0 0; font-size: 12.5px; line-height: 1.45; font-weight: 700;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card:hover .c-ttl { color: var(--main-d); }
.c-sub { margin: 3px 0 0; font-size: 11px; color: var(--sub); }

/* 区分の小札 */
.badge {
    position: absolute; top: 0; left: 0;
    padding: 2px 7px; font-size: 10px; font-weight: 700; font-style: normal;
    color: #fff; background: var(--main);
    border-radius: var(--radius) 0 var(--radius) 0; letter-spacing: .04em;
}
.badge.bl  { background: var(--bl); }
.badge.men { background: var(--men); }

/* ランキングの番号 */
.rank {
    position: absolute; right: 0; bottom: 0;
    width: 26px; height: 26px; border-radius: var(--radius) 0 0 0;
    font-style: normal; background: rgba(255, 255, 255, .94);
    color: var(--main-d); font-weight: 700; font-size: 13px;
    display: flex; align-items: center; justify-content: center;
}
.rank.top { background: var(--main); color: #fff; }

/* ============================================================
   ボタン  milky のベタ影
   ============================================================ */

.btn {
    display: inline-block; padding: 13px 30px;
    font-size: 14px; font-weight: 700; color: #fff;
    background: var(--main); border-radius: var(--radius);
    box-shadow: 0 5px 0 var(--main-d);
}
.btn:hover { color: #fff; transform: translateY(2px); box-shadow: 0 3px 0 var(--main-d); }

.btn-cta {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 17px 34px; font-size: 16px; font-weight: 700; color: #fff;
    background: var(--main); border-radius: var(--radius);
    box-shadow: 0 5px 0 var(--main-d);
}
.btn-cta:hover { color: #fff; transform: translateY(2px); box-shadow: 0 3px 0 var(--main-d); }

.btn-ghost {
    display: inline-block; padding: 12px 24px;
    font-size: 13px; font-weight: 700; color: var(--main-d);
    background: #fff; border: 1px solid var(--main); border-radius: var(--radius);
}
.btn-ghost:hover { background: var(--tint); color: var(--main-d); }

/* ============================================================
   タブ（ランキング）
   ============================================================ */

.tabs { display: flex; gap: 8px; }
.tab {
    font: inherit; font-size: 13px; font-weight: 700;
    padding: 9px 20px; min-height: 40px; cursor: pointer;
    border: 1px solid #e7dce2; background: #fff; color: var(--sub);
    border-radius: 999px; text-decoration: none;
    display: inline-flex; align-items: center;
}
.tab:hover { border-color: var(--main); color: var(--main-d); }
.tab.on, .tab[aria-selected="true"] { background: var(--main); border-color: var(--main); color: #fff; }

/* ============================================================
   ピル（ジャンル）
   ============================================================ */

.pills { display: flex; flex-wrap: wrap; gap: 9px; }
.pills.tight { gap: 7px; }
.pill {
    display: inline-flex; align-items: baseline; gap: 5px;
    padding: 7px 13px; font-size: 12.5px;
    background: #fff; border: 1px solid var(--line); border-radius: 999px;
}
.pills.tight .pill { padding: 5px 11px; font-size: 12px; }
.pill b { font-size: 10px; color: #8a7079; font-weight: 400; }
.pill:hover { border-color: var(--main); color: var(--main-d); }

/* 名前順の索引 */
.plain-list {
    margin-top: 14px;
    display: grid; gap: 0 26px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.plain-list li {
    display: flex; gap: 8px; align-items: baseline;
    padding: 8px 0; border-bottom: 1px solid var(--rule); min-width: 0;
}
.plain-list li a { flex: 1 1 auto; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plain-list li span { flex: 0 0 auto; font-size: 11px; color: var(--sub); }

/* ============================================================
   作品ページ
   ============================================================ */

.work-title {
    margin: 14px 0 0;
    font-family: 'Kaisei Decol', serif; font-weight: 700;
    font-size: 27px; letter-spacing: .01em; text-wrap: balance;
}

.work-top {
    margin-top: 22px;
    display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start;
}
.work-cover { flex: 0 0 auto; width: 260px; }
.work-cover .cv { background: #f7eef2; }
.work-meta { flex: 999 1 420px; min-width: 0; }
.work-nocover {
    display: flex; align-items: center; justify-content: center;
    aspect-ratio: 3 / 4; border: 1px dashed var(--line); border-radius: var(--radius);
    font-size: 12px; color: #b3261e; text-align: center; padding: 10px;
}

.meta { margin: 0; display: grid; grid-template-columns: 6em 1fr; font-size: 13px; }
.meta dt { padding: 9px 0; color: var(--sub); font-size: 12px; border-top: 1px solid var(--rule); }
.meta dd { margin: 0; padding: 9px 0; border-top: 1px solid var(--rule); min-width: 0; }
.meta dd a { color: var(--main-d); }
.meta dd a:hover { text-decoration: underline; }
.meta dd .sep { color: #9c8a92; }

.work-body { margin-top: 14px; max-width: 64ch; font-size: 13.5px; line-height: 1.95; color: #4f4a4d; }

/* 本編 */
.reader { background: var(--ink); margin-top: 18px; padding: 18px 0 22px; }
.reader-page {
    position: relative;
    max-width: var(--reader-max, 560px);
    margin: 0 auto var(--reader-gap, 6px);
    background: #201c26;
    content-visibility: auto;
    contain-intrinsic-size: auto 747px;
}
.reader-page img { display: block; width: 100%; height: auto; }
.reader-no {
    position: absolute; right: 8px; bottom: 8px;
    font-size: 11px; font-style: normal; color: rgba(255, 255, 255, .55);
}

.cite { margin: 12px 0 0; font-size: 11.5px; color: var(--sub); }
.cite a { color: var(--sub); text-decoration: underline; }
.cite a:hover { color: var(--main-d); }

.cta { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

/* ============================================================
   コメント
   ============================================================ */

.cmt-list { margin: 16px 0 24px; }
.cmt-list .children { margin: 10px 0 0 20px; }
.cmt { margin-bottom: 10px; }
.cmt-in { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.cmt-meta { display: flex; gap: 10px; align-items: baseline; margin: 0 0 6px; font-size: 12px; color: var(--sub); }
.cmt-name { font-weight: 700; color: var(--fg); }
.cmt-body { font-size: 13px; line-height: 1.75; }
.cmt-body p { margin: 0 0 8px; }
.cmt-body p:last-child { margin-bottom: 0; }
.cmt-reply { margin: 8px 0 0; font-size: 12px; }
.cmt-hold, .cmt-thanks {
    margin: 0 0 14px; padding: 11px 14px; font-size: 13px; font-weight: 700;
    background: var(--tint); color: var(--main-d);
    border: 1px solid var(--main); border-radius: 8px;
}
.cmt-closed { color: var(--sub); font-size: 13px; }

.comment-respond {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 10px; padding: 16px;
}
.comment-reply-title { margin: 0 0 10px; font-size: 16px; font-weight: 800; }
.comment-reply-title small { margin-left: 10px; font-size: 12px; font-weight: 400; }
.comment-note { margin: 0 0 12px; font-size: 12px; color: var(--sub); }
.comment-form-comment, .comment-form-author { margin: 0 0 12px; }
.comment-form label { display: block; margin-bottom: 4px; font-size: 12px; color: var(--sub); }
.comment-form textarea,
.comment-form input[type="text"] {
    width: 100%; padding: 10px 12px; font: inherit; font-size: 13px;
    color: var(--fg); background: #fff;
    border: 1px solid var(--line); border-radius: 8px;
}
.comment-form textarea { resize: vertical; min-height: 104px; }
.comment-form input[type="text"] { max-width: 280px; }
.comment-form textarea:focus,
.comment-form input[type="text"]:focus {
    outline: none; border-color: var(--main);
    box-shadow: 0 0 0 3px var(--tint);
}
.comment-form .form-submit { margin: 0; }
.comment-form input[type="submit"] {
    padding: 11px 26px; font: inherit; font-weight: 700;
    color: #fff; background: var(--main);
    border: 0; border-radius: var(--radius); cursor: pointer;
}
.comment-form input[type="submit"]:hover { background: var(--main-d); }

/* トップの新着コメント */
.cmt-feed li { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.cmt-feed li:last-child { border-bottom: 0; }
.cmt-feed a { display: block; }
.cmt-feed a:hover .cmt-feed-work { color: var(--main-d); }
.cmt-feed-work {
    display: block; font-size: 13px; font-weight: 700;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cmt-feed-text { display: block; margin-top: 2px; font-size: 13px; color: var(--sub); }
.cmt-feed-meta { display: flex; gap: 10px; margin: 4px 0 0; font-size: 11px; color: var(--sub); }

/* ============================================================
   ページ送り
   ============================================================ */

.pagination { margin-top: 28px; }
.nav-links { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.page-numbers {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 38px; height: 38px; padding: 0 12px;
    font-size: 13px; background: #fff;
    border: 1px solid var(--line); border-radius: var(--radius);
}
.page-numbers:hover { border-color: var(--main); color: var(--main-d); }
.page-numbers.current { background: var(--main); border-color: var(--main); color: #fff; }
.page-numbers.dots { border-color: transparent; }

.empty { margin: 20px 0; color: var(--sub); }

/* ============================================================
   固定ページ
   ============================================================ */

.entry { max-width: 72ch; margin-top: 18px; font-size: 14px; line-height: 1.95; }
.entry h2 { margin: 1.8em 0 .6em; font-family: 'Kaisei Decol', serif; font-size: 19px; }
.entry h3 { margin: 1.5em 0 .5em; font-size: 16px; }
.entry p { margin: 0 0 1.2em; }
.entry ul { list-style: disc; margin: 0 0 1.2em; padding-left: 1.4em; }
.entry ol { list-style: decimal; margin: 0 0 1.2em; padding-left: 1.6em; }
.entry a { color: var(--main-d); text-decoration: underline; }
.entry table { border-collapse: collapse; width: 100%; margin: 0 0 1.2em; font-size: 13px; }
.entry th, .entry td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.entry th { background: var(--tint); }

/* ============================================================
   フッター  milky と同じ作り
   ============================================================ */

#footer { overflow: hidden; background: var(--footer); margin-top: 50px; }
#footer a { color: var(--footer-fg); }
#footer a:hover { color: #fff; }

.footer-pc { display: none; }

.footer-sp .to-top a {
    display: block; text-align: center; padding: 14px;
    font-size: 13px; font-weight: 700; color: var(--footer-fg);
}
.footer-sec h2 {
    margin: 0; padding: 9px 14px; font-size: 14px; font-weight: 700;
    background: var(--main); color: #fff;
}
.footer-list { padding: 4px 14px 16px; }
.footer-list li { border-bottom: 1px solid rgba(0, 0, 0, .13); }
.footer-list a { display: block; padding: 11px 2px; font-size: 13px; }

.copyright { text-align: center; padding: 11px; background: rgba(0, 0, 0, .09); }
.copyright a { font-size: 11.5px; }

@media (min-width: 1080px) {
    .footer-sp { display: none; }
    .footer-pc {
        display: flex; flex-wrap: wrap; gap: 26px 48px;
        max-width: var(--wrap); margin: 0 auto; padding: 28px 30px 30px;
    }
    .footer-pc ul { font-size: 12.5px; line-height: 2.1; }
    .footer-pc .social a { display: flex; align-items: center; gap: 8px; }
}

/* ============================================================
   狭い画面
   ============================================================ */

@media (max-width: 1079px) {
    .grid, .grid.five { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .plain-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    body { font-size: 13.5px; }
    .sec { padding-top: 32px; }
    .sec.band, .sec-last { padding-bottom: 32px; }
    .sec-ttl { font-size: 16px; }
    .sec-ttl::before { width: 4px; height: 19px; }

    .page-head h1, .work-title { font-size: 21px; }

    .grid, .grid.five { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
    .plain-list { grid-template-columns: 1fr; }

    .work-top { gap: 20px; }
    .work-cover { width: 150px; }
    .work-meta { flex: 1 1 100%; }
    .meta { grid-template-columns: 5.5em 1fr; }

    /*
     * 本編はスマホでは端まで使う。白い余白はコマ枠との境界を曖昧にする。
     *
     * 負の margin は入れない。.reader は single.php で .wrap の外（article の
     * 直下）に置いてあり、すでに画面の幅いっぱいある。そこに負の margin を
     * 付けると左右へ16pxずつはみ出して、ページ全体が横スクロールする。
     */
    .reader { padding: 14px 0 18px; }
    .reader-page { max-width: 100%; margin-bottom: var(--reader-gap, 4px); }

    .btn-cta { width: 100%; justify-content: center; padding: 16px 20px; }
    .cmt-list .children { margin-left: 12px; }
    .comment-respond { padding: 14px; }
}
