/*
Theme Name: DMM Review
Theme URI: https://monmou.net
Description: DMMブックス作品レビューサイト用テーマ
Version: 2.0.0
Author: monmou
Text Domain: dmm-review
*/

:root {
    --color-bg: #fef7f9;
    --color-surface: #ffffff;
    --color-text: #2d1f2f;
    --color-text-sub: #8a7080;
    --color-border: #f0dde3;
    --color-primary: #e8457c;
    --color-primary-hover: #d03368;
    --color-star: #fbbf28;
    --color-star-empty: #e8d5da;
    --color-accent: #f9a8c9;
    --color-accent-light: #fdf0f5;
    --radius: 10px;
    --radius-sm: 6px;
    --max-width: 800px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.07);
    --transition: 0.25s ease;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Yu Gothic", "Hiragino Sans", Meiryo, sans-serif;
}

[data-theme="dark"] {
    --color-bg: #1a1018;
    --color-surface: #2a1f28;
    --color-text: #f0e0e8;
    --color-text-sub: #a08898;
    --color-border: #3d2e38;
    --color-primary: #f06292;
    --color-primary-hover: #f48fb1;
    --color-star: #fbbf28;
    --color-star-empty: #3d2e38;
    --color-accent: #880e4f;
    --color-accent-light: #2a1f28;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: var(--color-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-primary-hover); }

img { max-width: 100%; height: auto; display: block; }

/* HEADER */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 12px; }

.site-title a {
    font-size: 17px;
    font-weight: 700;
    color: var(--color-text);
    white-space: nowrap;
}
.site-title a:hover { color: var(--color-primary); }

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
}

.site-nav { display: flex; align-items: center; gap: 2px; list-style: none; }
.site-nav a {
    padding: 6px 12px;
    font-size: 13px;
    color: var(--color-text-sub);
    border-radius: var(--radius-sm);
    white-space: nowrap;
}
.site-nav a:hover { color: var(--color-primary); background: var(--color-bg); }

.theme-toggle {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    cursor: pointer;
    color: var(--color-text);
}
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* SEARCH */
.search-form { position: relative; display: flex; align-items: center; }
.search-form .search-input,
.search-form .search-field {
    border: none;
    border-radius: 6px;
    padding: 7px 34px 7px 12px;
    font-size: 13px;
    background: var(--color-bg);
    color: var(--color-text);
    width: 180px;
    outline: none;
    font-family: var(--font-sans);
}
.search-form .search-input:focus,
.search-form .search-field:focus {
    background: var(--color-surface);
    width: 240px;
    box-shadow: 0 0 0 2px var(--color-primary);
}
.search-form .search-btn,
.search-form .search-submit {
    position: absolute;
    right: 2px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    color: var(--color-text-sub);
}

/* BREADCRUMBS */
.breadcrumbs {
    max-width: 960px;
    margin: 0 auto;
    padding: 10px 20px;
    font-size: 13px;
    color: var(--color-text-sub);
}
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; padding: 0; }
.breadcrumbs li::after { content: "›"; margin-left: 6px; color: var(--color-border); }
.breadcrumbs li:last-child::after { display: none; }
.breadcrumbs a { color: var(--color-text-sub); }
.breadcrumbs a:hover { color: var(--color-primary); }
.breadcrumbs span { color: var(--color-text); font-weight: 500; }

/* CONTAINER */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 30px 20px;
}

/* FREE CHECK BANNER */
.free-check-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: linear-gradient(135deg, #e8457c 0%, #f9a8c9 100%);
    border-radius: var(--radius);
    padding: 28px 28px;
    margin-bottom: 32px;
    box-shadow: 0 4px 20px rgba(232, 69, 124, 0.25);
}
.free-check-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.free-check-title {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    line-height: 1.3;
}
.free-check-sub {
    font-size: 14px;
    color: rgba(255,255,255,0.8);
}
.free-check-banner .btn {
    flex-shrink: 0;
    white-space: nowrap;
    background: #fff;
    color: var(--color-primary);
    font-weight: 700;
    padding: 14px 32px;
    font-size: 16px;
    border-radius: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.free-check-banner .btn:hover {
    background: #fff0f3;
    color: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

/* STARS */
.star-rating { display: inline-flex; gap: 1px; vertical-align: middle; }
.star-rating svg { width: var(--star-size, 16px); height: var(--star-size, 16px); fill: var(--color-star-empty); flex-shrink: 0; }
.star-rating svg.filled { fill: var(--color-star); }

/* === SINGLE COMIC (ONE COLUMN) === */
.comic-hero {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 32px;
}

.comic-hero-img {
    width: 280px;
    flex-shrink: 0;
    display: block;
}
.comic-hero-img img {
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.comic-hero-img:hover img {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.comic-hero-info {
    flex: 1;
    min-width: 0;
}
.comic-hero-info h1 {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
}

.comic-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 14px;
    color: var(--color-text-sub);
    margin-bottom: 16px;
}
.comic-meta span { display: flex; align-items: center; gap: 4px; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: var(--font-sans);
    text-decoration: none;
    transition: var(--transition);
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* SECTIONS */
.comic-section {
    margin-bottom: 32px;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-primary);
}

.comic-description {
    font-size: 14px;
    line-height: 1.9;
    color: var(--color-text);
    padding: 16px;
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

/* RATING */
.rating-overview {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 20px;
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}
.rating-big { text-align: center; min-width: 90px; }
.rating-big .number { font-size: 36px; font-weight: 700; line-height: 1; }
.rating-big .stars-wrap { margin-top: 4px; }
.rating-big .total { font-size: 12px; color: var(--color-text-sub); margin-top: 4px; }
.distribution { flex: 1; }
.dist-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.dist-row:last-child { margin-bottom: 0; }
.dist-row .label { width: 36px; text-align: right; color: var(--color-text-sub); font-weight: 500; }
.dist-bar-wrap { flex: 1; height: 14px; background: var(--color-bg); border-radius: 7px; overflow: hidden; }
.dist-bar { height: 100%; background: var(--color-star); border-radius: 7px; transition: width 0.6s ease; }
.dist-row .pct { width: 40px; font-size: 12px; color: var(--color-text-sub); }

/* ARTICLE BODY */
.article-body { font-size: 15px; line-height: 1.9; }
.article-body h2 { font-size: 18px; font-weight: 700; margin: 28px 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--color-primary); }
.article-body h2:first-child { margin-top: 0; }
.article-body ol, .article-body ul { padding-left: 24px; margin: 12px 0; }
.article-body li { margin-bottom: 10px; line-height: 1.8; }
.article-body p { margin-bottom: 12px; }

.article-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}
.article-section h2 { margin-top: 0; }

.no-reviews {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-sub);
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

/* SAMPLE READER */
.sample-reader {
    margin-bottom: 32px;
}
.sample-reader .section-title {
    max-width: var(--max-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}
.sample-reader-viewport {
    position: relative;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}
.sample-reader-stage {
    position: relative;
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.sample-reader-stage img {
    width: 100%;
    height: auto;
    display: block;
}
.sample-reader-counter {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 12px;
}
.sample-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(0,0,0,0.4);
    color: #fff;
    border: none;
    font-size: 32px;
    width: 48px;
    height: 80px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    border-radius: 4px;
}
.sample-arrow:hover { background: rgba(0,0,0,0.7); }
.sample-arrow-prev { right: 0; }
.sample-arrow-next { left: 0; }
.sample-arrow:disabled { opacity: 0.2; cursor: default; }

.sample-reader-cta {
    text-align: center;
    padding: 32px 20px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
}
.sample-reader-cta p {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--color-text);
}
.btn-cta {
    padding: 14px 40px;
    font-size: 16px;
    border-radius: 30px;
}

/* RELATED */
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

/* COMIC CARD (ARCHIVE + RELATED) */
.comic-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
}
.comic-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }

.comic-card-img {
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--color-border);
}
.comic-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.comic-card:hover .comic-card-img img { transform: scale(1.08); }

.comic-card-body { padding: 10px 12px 14px; flex: 1; display: flex; flex-direction: column; }
.comic-card-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--color-text);
}
.comic-card-meta { font-size: 12px; color: var(--color-text-sub); margin-top: 4px; }
.comic-card-rating { display: flex; align-items: center; gap: 4px; margin-top: auto; padding-top: 6px; font-size: 12px; color: var(--color-text-sub); }

/* COMIC GRID (ARCHIVE) */
.comic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
}

/* ARCHIVE TOOLBAR */
.archive-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.archive-header h1 { font-size: 22px; font-weight: 700; }
.result-count { font-size: 13px; color: var(--color-text-sub); margin-top: 4px; }
.sort-controls { display: flex; gap: 6px; }
.sort-btn {
    display: inline-flex;
    padding: 6px 14px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 13px;
    background: var(--color-surface);
    color: var(--color-text-sub);
    cursor: pointer;
    font-family: var(--font-sans);
    text-decoration: none;
}
.sort-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.sort-btn.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* PAGINATION */
.pagination { margin-top: 40px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 8px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--color-surface);
    color: var(--color-text);
    transition: var(--transition);
}
.pagination a:hover { background: var(--color-bg); border-color: var(--color-primary); color: var(--color-primary); }
.pagination .current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* LIGHTBOX */
.lightbox { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 1000; justify-content: center; align-items: center; cursor: pointer; }
.lightbox.active { display: flex; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: var(--radius); }
.lightbox-close { position: absolute; top: 16px; right: 20px; font-size: 28px; color: #fff; background: none; border: none; cursor: pointer; z-index: 1001; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.15); border: none; color: #fff; font-size: 36px; padding: 12px 16px; cursor: pointer; border-radius: var(--radius); }
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }

/* FOOTER */
.site-footer {
    text-align: center;
    padding: 30px 20px;
    font-size: 13px;
    color: var(--color-text-sub);
    border-top: 1px solid var(--color-border);
    margin-top: 60px;
    background: var(--color-surface);
}

/* BACK TO TOP */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    border: none;
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    z-index: 80;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity var(--transition), visibility var(--transition), transform var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--color-primary-hover); }

/* 404 */
.not-found { text-align: center; padding: 60px 20px; }
.not-found-code { font-size: 96px; font-weight: 800; color: var(--color-border); line-height: 1; margin-bottom: 16px; }
.not-found h1 { font-size: 24px; margin-bottom: 12px; }
.not-found p { color: var(--color-text-sub); margin-bottom: 24px; }
.not-found .search-form { justify-content: center; }
.not-found .search-input { width: 300px; }

/* ANIMATIONS */
.fade-in { opacity: 0; transform: translateY(16px); transition: opacity 0.5s ease, transform 0.5s ease; }
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* === HOME PAGE === */
.home-hero {
    background: linear-gradient(135deg, #e8457c 0%, #f9a8c9 100%);
    padding: 48px 20px;
    text-align: center;
    color: #fff;
}
.home-hero-inner {
    max-width: 600px;
    margin: 0 auto;
}
.home-hero-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 10px;
    line-height: 1.3;
}
.home-hero-desc {
    font-size: 15px;
    opacity: 0.85;
    margin-bottom: 24px;
    line-height: 1.6;
}
.home-search {
    display: flex;
    gap: 8px;
    max-width: 440px;
    margin: 0 auto;
}
.home-search-input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-family: var(--font-sans);
    outline: none;
}
.home-search-input:focus {
    box-shadow: 0 0 0 3px rgba(255,255,255,0.4);
}
.home-search .btn {
    flex-shrink: 0;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.4);
    padding: 12px 24px;
}
.home-search .btn:hover {
    background: rgba(255,255,255,0.3);
}

.home-section {
    margin-bottom: 40px;
}
.home-section-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.home-section-sub {
    font-size: 13px;
    color: var(--color-text-sub);
}
.home-section-link {
    margin-left: auto;
    font-size: 13px;
    font-weight: 600;
}

/* TOP RATED CARDS */
.home-top-rated {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.top-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 12px 16px;
    transition: var(--transition);
    text-decoration: none;
}
.top-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.top-card-rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e8457c, #f9a8c9);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.top-card-img {
    width: 45px;
    flex-shrink: 0;
}
.top-card-img img {
    width: 100%;
    border-radius: 4px;
    aspect-ratio: 3 / 4;
    object-fit: cover;
}
.top-card-body {
    flex: 1;
    min-width: 0;
}
.top-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.top-card-author {
    font-size: 12px;
    color: var(--color-text-sub);
    margin-top: 2px;
}
.top-card-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    font-size: 13px;
}
.top-card-score {
    font-weight: 700;
    color: var(--color-text);
}

.home-more {
    text-align: center;
    margin-top: 24px;
}
.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    padding: 12px 32px;
    border-radius: 30px;
    font-weight: 600;
}
.btn-outline:hover {
    background: var(--color-primary);
    color: #fff;
}

/* RESPONSIVE */
@media (max-width: 600px) {
    .comic-hero {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .comic-hero-img { width: 200px; }
    .comic-meta { justify-content: center; }
    .comic-hero-info h1 { font-size: 18px; }
    .comic-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .comic-card-body { padding: 8px 8px 10px; }
    .comic-card-title { font-size: 12px; }
    .container { padding: 20px 12px; }
    .rating-overview { flex-direction: column; align-items: stretch; }
    .rating-big { display: flex; align-items: center; gap: 12px; text-align: left; }
    .sample-gallery { grid-template-columns: repeat(3, 1fr); }
    .related-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }

    .home-hero { padding: 32px 16px; }
    .home-hero-title { font-size: 22px; }
    .home-search { flex-direction: column; }
    .home-search .btn { width: 100%; justify-content: center; }

    .mobile-menu-btn { display: flex; }
    .header-right {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        flex-direction: column;
        padding: 16px;
        gap: 12px;
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
        z-index: 95;
        box-shadow: var(--shadow-md);
    }
    body.menu-open .header-right { transform: translateY(0); opacity: 1; pointer-events: all; }
    .site-nav { flex-direction: column; width: 100%; }
    .site-nav a { padding: 10px 12px; width: 100%; }
    .search-form .search-input { width: 100%; }
    .breadcrumbs { padding: 8px 12px; font-size: 12px; }
}
