/* ================================================================
   css/style.css — ユーザー画面（index.php）共通スタイル
   館内コミック検索システム v5
================================================================ */

/* ─── CSS変数・リセット ─── */
:root {
    --primary:   #c0392b;
    --primary-d: #96281b;
    --ink:       #1a1008;
    --paper:     #fdf6e3;
    --rule:      #e8d9b5;
    --accent:    #e67e22;
    --muted:     #8c7a5e;
    --white:     #ffffff;
    --radius:    8px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { scroll-behavior: smooth; }
body  {
    font-family: 'Zen Kaku Gothic New', sans-serif;
    background: var(--paper);
    color: var(--ink);
    min-height: 100vh;
    font-size: 16px;
}

/* ================================================================
   ヘッダー（検索結果ページ sticky）
================================================================ */
.site-header {
    background: var(--primary);
    background-image: repeating-linear-gradient(
        90deg, transparent, transparent 3px,
        rgba(0,0,0,.06) 3px, rgba(0,0,0,.06) 4px
    );
    box-shadow: 0 4px 12px rgba(0,0,0,.35);
    position: sticky;
    top: 0;
    z-index: 200;
}
.header-inner {
    max-width: 1100px;
    margin: auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.site-title {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--white);
    letter-spacing: .08em;
    white-space: nowrap;
    text-decoration: none;
    flex-shrink: 0;
    line-height: 1.2;
}
.site-title small {
    font-family: 'Noto Serif JP', serif;
    font-size: .62rem;
    font-weight: 400;
    opacity: .75;
    display: block;
    letter-spacing: .06em;
}
.header-search {
    flex: 1;
    display: flex;
    border: 2px solid rgba(255,255,255,.6);
    border-radius: 6px;
    overflow: hidden;
    min-width: 0;
    transition: border-color .2s;
}
.header-search:focus-within { border-color: var(--white); }
.header-search input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    font-size: .95rem;
    font-family: inherit;
    border: none;
    outline: none;
    background: rgba(255,255,255,.95);
    color: var(--ink);
}
.header-search button {
    padding: 8px 14px;
    background: var(--ink);
    color: var(--white);
    border: none;
    font-size: .95rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .2s;
}
.header-search button:hover { background: var(--accent); }

/* ================================================================
   メインコンテナ
================================================================ */
.main { max-width: 1100px; margin: 0 auto; padding: 28px 16px 60px; }

/* ================================================================
   トップページ — ヒーローエリア
================================================================ */
.top-hero {
    text-align: center;
    padding: 48px 16px 36px;
    border-bottom: 2px solid var(--rule);
    margin-bottom: 32px;
}
.top-hero-icon {
    font-size: 4rem;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 14px;
    display: block;
}
.top-hero h1 {
    font-family: 'Noto Serif JP', serif;
    font-size: clamp(1.6rem, 5vw, 2.4rem);
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 8px;
    letter-spacing: .06em;
}
.top-hero .subtitle {
    color: var(--muted);
    font-size: .95rem;
    margin-bottom: 28px;
}
.top-search-form {
    max-width: 600px;
    margin: auto;
    display: flex;
    border: 3px solid var(--primary);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 4px 4px 0 var(--primary-d);
}
.top-search-form input {
    flex: 1;
    min-width: 0;
    padding: 13px 18px;
    font-size: 1.05rem;
    font-family: inherit;
    border: none;
    outline: none;
    background: var(--white);
}
.top-search-form button {
    padding: 13px 22px;
    background: var(--primary);
    color: var(--white);
    border: none;
    font-size: .95rem;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s;
    letter-spacing: .06em;
    flex-shrink: 0;
}
.top-search-form button:hover { background: var(--primary-d); }

/* ================================================================
   ショートカット（掲載雑誌 / ジャンル / 作者）
================================================================ */
.shortcuts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.shortcut-box {
    background: var(--white);
    border: 1.5px solid var(--rule);
    border-radius: 10px;
    padding: 16px 18px;
}
.shortcut-box h2 {
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 8px;
    border-bottom: 1.5px solid var(--rule);
}
.shortcut-box h2 i { font-size: .9rem; }

/* 縦スクロールコンテナ */
.chip-scroll {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    scrollbar-width: thin;
    scrollbar-color: var(--rule) transparent;
}
.chip-scroll::-webkit-scrollbar { width: 4px; }
.chip-scroll::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 2px; }

/* チップ */
.chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: .84rem;
    line-height: 1;
    font-weight: 700;
    text-decoration: none;
    color: var(--ink);
    transition: background .15s, color .15s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: content-box;
}
.chip:hover { background: var(--primary); color: var(--white); }
.chip i { font-size: .8rem; flex-shrink: 0; opacity: .55; line-height: 1; }

/* ================================================================
   結果バー
================================================================ */
.result-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--rule);
}
.result-kw   { font-size: 1.25rem; font-weight: 900; color: var(--primary); }
.result-badge {
    font-size: .82rem;
    color: var(--muted);
    background: var(--rule);
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}
.result-range { font-size: .78rem; color: var(--muted); }
.back-link {
    margin-left: auto;
    font-size: .82rem;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}
.back-link:hover { color: var(--primary); }
.sort-btns {
    display: flex; align-items: center; gap: 4px; margin-left: auto;
    background: var(--rule); border-radius: 6px; padding: 3px;
}
.sort-label { font-size: .72rem; color: var(--muted); padding: 0 4px; white-space: nowrap; }
.sort-btn {
    font-size: .8rem; padding: 4px 12px; border-radius: 4px;
    border: none; color: var(--muted);
    text-decoration: none; white-space: nowrap; font-weight: 700;
    transition: background .15s, color .15s;
}
.sort-btn:hover  { background: rgba(255,255,255,.7); color: var(--ink); }
.sort-btn.active { background: var(--white); color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.fuzzy-note {
    width: 100%;
    font-size: .75rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.fuzzy-tag {
    background: #fff8e1;
    color: #7a5c00;
    border: 1px solid #ffe082;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: .7rem;
}

/* ================================================================
   テーブル（PC・タブレット）
================================================================ */
.comic-table-wrap {
    border: 2px solid var(--rule);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 2px 4px 16px rgba(0,0,0,.07);
}
.comic-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}
.comic-table thead th {
    background: var(--ink);
    color: var(--white);
    padding: 11px 14px;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .08em;
    white-space: nowrap;
}
.comic-table tbody tr {
    border-bottom: 1px solid var(--rule);
    transition: background .15s;
}
.comic-table tbody tr:last-child { border-bottom: none; }
.comic-table tbody tr:hover      { background: #fef9ef; }
.comic-table td {
    padding: 9px 14px;
    font-size: .9rem;
    vertical-align: middle;
}
/* 書影列 */
.td-cover { width: 66px !important; padding: 6px 8px !important; }
.cover-wrap {
    width: 52px;
    height: 74px;
    overflow: hidden;
    border-radius: 3px;
    border: 1px solid var(--rule);
    background: #f0ece0;
}
.cover-wrap .cover-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.no-img-box {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--muted);
    font-size: .5rem;
    font-weight: 700;
    text-align: center;
}
.no-img-box i  { font-size: 1rem; opacity: .45; }
mark           { background: #ffe066; color: var(--ink); border-radius: 2px; padding: 0 1px; }
.badge-genre   { display: inline-block; font-size: .68rem; padding: 2px 7px; border-radius: 3px; background: var(--rule); color: var(--muted); font-weight: 700; }

/* ================================================================
   カードリスト（スマホ）
================================================================ */
.comic-card-list { display: none; flex-direction: column; gap: 10px; }
.comic-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 10px 12px;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
}
.card-cover-sm {
    width: 48px;
    height: 68px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 3px;
    border: 1px solid var(--rule);
    background: #f0ece0;
}
.card-cover-sm img       { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-cover-sm .no-img-box { height: 100%; }
.card-body    { flex: 1; min-width: 0; }
.card-title   { font-weight: 900; font-size: .95rem; color: var(--ink); margin-bottom: 2px; line-height: 1.3; }
.card-author  { font-size: .78rem; color: var(--muted); margin-bottom: 4px; }
.card-meta    { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.card-magazine { font-size: .72rem; color: var(--primary); font-weight: 700; }
.card-vol     { font-size: .68rem; color: var(--muted); background: #f0f4f8; padding: 1px 6px; border-radius: 3px; }

/* ================================================================
   Amazonアフィリエイトリンク
================================================================ */
/* 書影をリンク化したときのスタイルリセット */
a.cover-link { display: block; text-decoration: none; }
a.cover-link:hover .cover-wrap  { opacity: .85; }
a.cover-link:hover .card-cover-sm { opacity: .85; }

/* 「Amazonで見る」ボタン（テーブル行内） */
.btn-amazon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #ff9900;
    color: #111;
    border-radius: 4px;
    font-size: .72rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, transform .1s;
    letter-spacing: .02em;
}
.btn-amazon:hover {
    background: #e68a00;
    color: #111;
    transform: translateY(-1px);
}
.btn-amazon i { font-size: .78rem; }

/* カードリスト内のAmazonボタン */
.card-amazon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    padding: 5px 12px;
    background: #ff9900;
    color: #111;
    border-radius: 4px;
    font-size: .75rem;
    font-weight: 700;
    text-decoration: none;
    transition: background .15s;
}
.card-amazon:hover { background: #e68a00; color: #111; }
.card-amazon i { font-size: .8rem; }

/* 詳細へのヒント（カードリスト） */
.detail-hint { font-size: .7rem; color: var(--primary); margin-top: 5px; display: inline-flex; align-items: center; gap: 3px; }
a.comic-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.13); transform: translateY(-2px); transition: box-shadow .18s, transform .18s; }

/* ================================================================
   空・エラー
================================================================ */
.empty-box { text-align: center; padding: 60px 16px; color: var(--muted); }
.empty-box i { font-size: 2.8rem; display: block; margin-bottom: 12px; opacity: .5; }
.empty-box p { font-size: .95rem; }

/* ================================================================
   ページャ
================================================================ */
.pager { display: flex; gap: 5px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }
.pager a, .pager span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 2px solid var(--rule);
    border-radius: 6px;
    font-size: .88rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--ink);
    background: var(--white);
    transition: all .15s;
}
.pager a:hover    { border-color: var(--primary); color: var(--primary); }
.pager .active    { background: var(--primary); border-color: var(--primary); color: var(--white); }
.pager .disabled  { opacity: .35; pointer-events: none; }

/* ================================================================
   リクエストボタン（トップ・一覧共通）
================================================================ */
.top-request-wrap {
    text-align: center;
    margin: 40px 0 8px;   /* 上余白を28px→40pxに増加 */
}
.list-request-wrap {
    text-align: center;
    margin: 40px 0 0;     /* 上余白を32px→40pxに増加 */
}
.btn-top-request,
.btn-list-request {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 32px;
    background: var(--primary);
    color: var(--white);
    border-radius: 8px;
    font-weight: 700;
    font-size: .95rem;
    text-decoration: none;
    letter-spacing: .04em;
    box-shadow: 3px 3px 0 var(--primary-d);
    transition: background .15s, transform .1s, box-shadow .1s;
}
.btn-top-request:hover,
.btn-list-request:hover {
    background: var(--primary-d);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 3px 5px 0 var(--primary-d);
}
.btn-top-request i,
.btn-list-request i { font-size: 1rem; }

/* ================================================================
   フッター
================================================================ */
footer {
    text-align: center;
    padding: 28px 16px;
    color: var(--muted);
    font-size: .8rem;
    border-top: 2px solid var(--rule);
    margin-top: 48px;
}
footer a { color: var(--muted); }
.footer-logo { height: 28px; width: auto; opacity: .75; }

/* ================================================================
   レスポンシブ
================================================================ */
/* スマホ（〜767px）*/
@media (max-width: 767px) {
    .comic-table-wrap { display: none; }
    .comic-card-list  { display: flex; }

    .site-title       { font-size: .95rem; }
    .site-title small { display: none; }

    .top-hero               { padding: 32px 12px 28px; }
    .top-search-form input  { padding: 11px 14px; font-size: .95rem; }
    .top-search-form button { padding: 11px 14px; font-size: .88rem; }

    .shortcuts   { grid-template-columns: 1fr; gap: 12px; }
    .chip-scroll { max-height: 160px; }
}

/* タ�
/* ================================================================
   作者索引
================================================================ */
.author-index {
    padding: 4px 0;
    max-height: 220px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--rule) transparent;
}
.author-row {
    display: flex;
    flex-direction: column;
    padding: 0;
}
.author-row + .author-row { margin-top: 1px; }
/* 折りたたみトグルボタン */
.author-row-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: none;
    border: none;
    padding: 4px 4px;
    cursor: pointer;
    text-align: left;
}
.author-row-label {
    flex: 0 0 3.2em;
    font-size: .72rem;
    color: var(--muted);
    font-weight: 700;
    text-align: right;
}
.author-row-caret {
    font-size: .72rem;
    color: var(--muted);
    transition: transform .2s;
}
.author-row-toggle[aria-expanded="true"] .author-row-caret {
    transform: rotate(90deg);
}
.author-row-names {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0 4px 3.5em;
}
/* グループ間のスペース */
.author-row:not(:last-child) { margin-bottom: 1px; }
