/* =============================================================================
   MANGA THEME — Main Stylesheet
   Dark manga reading experience
   ============================================================================= */

/* -------------------------------------------------------------------------
   1. CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */

:root {
    /* Colors — overridden by Customizer via inline style */
    --bg-primary:   #0f1115;
    --bg-secondary: #1a1d23;
    --bg-card:      #080a0e;
    --accent:       #c9a227;
    --accent-dark:  #a07a0d;
    --hover-border: #32caf4;
    --text-primary:   #ffffff;
    --text-secondary: #9ca3af;
    --text-muted:     #6b7280;
    --border-subtle:  rgba(255, 255, 255, 0.08);
    --border-medium:  rgba(255, 255, 255, 0.15);
    --red:    #f43832;
    --green:  #22c55e;

    /* Layout */
    --container-max: 980px;
    --container-pad: clamp(1rem, 4vw, 2rem);
    --radius-sm:  6px;
    --radius-md:  12px;
    --radius-lg:  16px;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', Consolas, monospace;

    /* Animation */
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Reader */
    --reader-max-width: 800px;
}

/* -------------------------------------------------------------------------
   2. Reset & Base
   -------------------------------------------------------------------------- */

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

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

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

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

ul, ol {
    list-style: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* -------------------------------------------------------------------------
   3. Container / Layout
   -------------------------------------------------------------------------- */

.container {
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--container-pad);
}

.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-content {
    flex: 1;
}

/* -------------------------------------------------------------------------
   4. Header / Navigation
   -------------------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(15, 17, 21, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
}

.nav-inner {
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--container-pad);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    height: 60px;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.02em;
}

.logo-img {
    height: 36px;
    width: auto;
}

/* Nav Menu */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-menu li a {
    display: block;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: color var(--transition), background-color var(--transition);
}

.nav-menu li a:hover,
.nav-menu li.current-menu-item > a {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.06);
}

/* Mobile toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
}

.nav-toggle-bar {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
}

@media (max-width: 640px) {
    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        background-color: var(--bg-secondary);
        border-bottom: 1px solid var(--border-subtle);
        padding: 0.75rem;
        gap: 0.25rem;
    }

    .nav-menu.is-open {
        display: flex;
    }

    .nav-menu li a {
        padding: 0.625rem 1rem;
        border-radius: var(--radius-sm);
    }
}

/* -------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition:
        background-color var(--transition),
        border-color var(--transition),
        color var(--transition),
        box-shadow var(--transition),
        transform 80ms ease;
    white-space: nowrap;
    line-height: 1;
    text-decoration: none;
}

.btn:active {
    transform: translateY(1px);
}

.btn--accent {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #000;
}

.btn--accent:hover {
    background-color: var(--accent-dark);
    border-color: var(--accent-dark);
    box-shadow: 0 4px 16px rgba(201, 162, 39, 0.3);
}

.btn--outline {
    background-color: transparent;
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.btn--outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background-color: rgba(201, 162, 39, 0.06);
}

.btn--ghost {
    background-color: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}

.btn--ghost:hover {
    background-color: var(--border-subtle);
    color: var(--text-primary);
}

/* -------------------------------------------------------------------------
   6. Section Title
   -------------------------------------------------------------------------- */

.section-title {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* -------------------------------------------------------------------------
   7. Hero Section
   -------------------------------------------------------------------------- */

.manga-hero {
    position: relative;
    width: 100%;
    min-height: 160px;
    display: flex;
    align-items: center;
    overflow: hidden;
    background-color: var(--bg-secondary);
}

.manga-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--hero-bg, none);
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
}

.manga-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        rgba(15, 17, 21, calc(var(--overlay-opacity, 0.75) * 1.1)),
        rgba(15, 17, 21, var(--overlay-opacity, 0.75))
    );
    z-index: 1;
}

.manga-hero__inner {
    position: relative;
    z-index: 2;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-block: 2.5rem;
    gap: 1.25rem;
}

.manga-hero__title {
    font-size: clamp(1.75rem, 6vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.8);
}

/* Genre Badges */
.manga-hero__genres {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.genre-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 999px;
    background-color: rgba(201, 162, 39, 0.15);
    color: var(--accent);
    border: 1px solid rgba(201, 162, 39, 0.3);
    letter-spacing: 0.01em;
    transition: background-color var(--transition), border-color var(--transition);
}

.genre-badge:hover {
    background-color: rgba(201, 162, 39, 0.25);
    border-color: rgba(201, 162, 39, 0.5);
}

/* -------------------------------------------------------------------------
   8. Manga Meta Bar
   -------------------------------------------------------------------------- */

.manga-meta-bar {
    background-color: rgba(26, 29, 35, 0.95);
    border-bottom: 1px solid var(--border-subtle);
    padding-block: 1rem;
}

.manga-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem 1.5rem;
}

@media (min-width: 640px) {
    .manga-meta-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    min-width: 0;
}

.meta-item svg {
    flex-shrink: 0;
    color: var(--accent);
    opacity: 0.8;
}

.meta-label {
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
}

.meta-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.meta-status {
    font-weight: 600;
}

.meta-status--ongoing  { color: var(--green); }
.meta-status--completed { color: var(--accent); }
.meta-status--hiatus   { color: #f59e0b; }
.meta-status--cancelled { color: var(--red); }

/* -------------------------------------------------------------------------
   9. Chapter List Section
   -------------------------------------------------------------------------- */

.chapter-section {
    padding-block: 3rem;
}

/* Quick Nav Buttons */
.chapter-quick-nav {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 480px) {
    .chapter-quick-nav {
        flex-direction: row;
    }

    .chapter-quick-nav .btn {
        flex: 1;
    }
}

/* Chapter Search */
.chapter-search {
    margin-bottom: 1.5rem;
}

.chapter-search__input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.chapter-search__input-wrap svg {
    position: absolute;
    left: 0.875rem;
    color: var(--text-muted);
    pointer-events: none;
}

.chapter-search__input {
    width: 100%;
    height: 48px;
    padding: 0 1rem 0 2.75rem;
    background-color: var(--bg-secondary);
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: textfield;
    -moz-appearance: textfield;
}

.chapter-search__input::-webkit-inner-spin-button,
.chapter-search__input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.chapter-search__input::placeholder {
    color: var(--text-muted);
}

.chapter-search__input:focus {
    outline: none;
    border-color: var(--hover-border);
    box-shadow: 0 0 0 3px rgba(50, 202, 244, 0.12);
}

.chapter-search__result {
    margin-top: 0.625rem;
    font-size: 0.875rem;
    min-height: 1.4em;
}

.chapter-search__result--found   { color: var(--green); }
.chapter-search__result--notfound { color: var(--red); }

/* Chapter Grid */
.chapter-list-wrapper {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1rem;
    position: relative;
    overflow: hidden;
    max-height: 420px;
    transition: max-height 0.4s ease;
}

.chapter-list-wrapper.is-expanded {
    max-height: none;
}

/* Gradient fade at bottom when collapsed */
.chapter-list-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(transparent, var(--bg-secondary));
    pointer-events: none;
    transition: opacity 0.3s;
}

.chapter-list-wrapper.is-expanded::after {
    opacity: 0;
    pointer-events: none;
}

.chapter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.625rem;
}

@media (min-width: 480px) {
    .chapter-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Chapter Card */
.chapter-card {
    display: block;
    text-decoration: none;
    outline-offset: 2px;
}

.chapter-card:focus-visible .chapter-card__inner {
    border-color: var(--hover-border);
    outline: 2px solid var(--hover-border);
}

.chapter-card__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    padding: 0.875rem 1rem;
    transition:
        border-color var(--transition),
        background-color var(--transition),
        box-shadow var(--transition);
}

.chapter-card:hover .chapter-card__inner {
    background-color: rgba(26, 29, 35, 0.8);
    border-color: var(--hover-border);
    box-shadow: 0 2px 12px rgba(50, 202, 244, 0.1);
}

.chapter-card--latest {
    border-color: rgba(201, 162, 39, 0.4) !important;
    box-shadow: 0 2px 12px rgba(201, 162, 39, 0.08);
}

.chapter-card--new {
    border-color: rgba(244, 56, 50, 0.3) !important;
}

.chapter-card__title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex: 1;
    min-width: 0;
    transition: color var(--transition);
}

.chapter-card:hover .chapter-card__title {
    color: var(--text-primary);
}

.chapter-card__subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapter-badge {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    white-space: nowrap;
    flex-shrink: 0;
}

.chapter-badge--hot { color: var(--red); }
.chapter-badge--new { color: var(--red); }

/* Toggle button */
.chapter-list__toggle {
    display: flex;
    justify-content: center;
    padding-top: 1rem;
    position: relative;
    z-index: 2;
}

/* Hidden chapters */
.chapter-card.is-hidden {
    display: none;
}

.no-chapters {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

/* -------------------------------------------------------------------------
   10. Why Read Section
   -------------------------------------------------------------------------- */

.why-read-section {
    padding-block: 3rem 2rem;
    background-color: rgba(26, 29, 35, 0.4);
}

.why-read__content {
    max-width: 720px;
    margin-inline: auto;
    margin-bottom: 2.5rem;
    text-align: center;
    color: var(--text-secondary);
    line-height: 1.8;
}

.why-read__content p + p {
    margin-top: 1rem;
}

.why-read__content strong {
    color: var(--text-primary);
}

/* Feature Cards */
.features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.feature-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.feature-card:hover {
    border-color: rgba(201, 162, 39, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.feature-card__icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--accent);
}

.feature-card__icon--1 { background-color: rgba(201, 162, 39, 0.12); }
.feature-card__icon--2 { background-color: rgba(50, 202, 244, 0.12); color: var(--hover-border); }
.feature-card__icon--3 { background-color: rgba(34, 197, 94, 0.12); color: var(--green); }

.feature-card__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.feature-card__desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* -------------------------------------------------------------------------
   11. FAQ Section
   -------------------------------------------------------------------------- */

.faq-section {
    padding-block: 3rem;
}

.faq-list {
    max-width: 720px;
    margin-inline: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.faq-item {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition);
}

.faq-item:has(.faq-question[aria-expanded="true"]) {
    border-color: rgba(201, 162, 39, 0.25);
}

.faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background-color var(--transition);
}

.faq-question:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.faq-chevron {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform var(--transition);
}

.faq-question[aria-expanded="true"] .faq-chevron {
    transform: rotate(180deg);
    color: var(--accent);
}

.faq-answer {
    padding: 0 1.25rem 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.75;
    border-top: 1px solid var(--border-subtle);
}

.faq-answer[hidden] {
    display: none;
}

/* -------------------------------------------------------------------------
   11b. Synopsis / About Section
   -------------------------------------------------------------------------- */

.manga-synopsis {
    padding-block: 2rem;
}

.manga-synopsis__card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    position: relative;
    overflow: hidden;
}

.manga-synopsis__heading {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.manga-synopsis__body {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.8;
    /* Collapsed: show 3 lines then fade */
    max-height: 5.4em; /* 3 × 1.8em */
    overflow: hidden;
    position: relative;
    transition: max-height 0.4s ease;
}

.manga-synopsis__body.is-expanded {
    max-height: 1000px; /* big enough for any text */
}

/* Gradient fade at the bottom when collapsed */
.manga-synopsis__body:not(.is-expanded)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2.5rem;
    background: linear-gradient(transparent, var(--bg-secondary));
    pointer-events: none;
}

.manga-synopsis__body p + p { margin-top: 0.75rem; }
.manga-synopsis__body strong { color: var(--text-primary); }
.manga-synopsis__body a { color: var(--accent); text-decoration: underline; }

/* Trigger button for the synopsis expand/collapse */
.manga-synopsis__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.875rem;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    transition: opacity var(--transition);
}

.manga-synopsis__toggle:hover {
    opacity: 0.8;
}

.synopsis-toggle-icon {
    transition: transform var(--transition);
}

.manga-synopsis__toggle[aria-expanded="true"] .synopsis-toggle-icon {
    transform: rotate(180deg);
}

/* -------------------------------------------------------------------------
   12. Footer — matches screenshot layout
   -------------------------------------------------------------------------- */

.site-footer {
    background-color: #0d0f13; /* slightly darker than page bg, matches screenshot */
    border-top: 1px solid var(--border-subtle);
    margin-top: 2.5rem;
    padding-block: 2.25rem 1.75rem;
}

.footer-inner {
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--container-pad);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    text-align: center;
}

/* ─── Social Icons ─── */
.footer-social {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.875rem;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition:
        background-color var(--transition),
        color var(--transition),
        border-color var(--transition),
        transform var(--transition);
    text-decoration: none;
}

.social-link:hover {
    background-color: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* Per-network accent on hover (optional, subtle) */
.social-link.social-twitter:hover   { color: #1d9bf0; border-color: rgba(29,155,240,0.4); }
.social-link.social-facebook:hover  { color: #1877f2; border-color: rgba(24,119,242,0.4); }
.social-link.social-instagram:hover { color: #e1306c; border-color: rgba(225,48,108,0.4); }
.social-link.social-youtube:hover   { color: #ff0000; border-color: rgba(255,0,0,0.4); }
.social-link.social-discord:hover   { color: #5865f2; border-color: rgba(88,101,242,0.4); }
.social-link.social-reddit:hover    { color: #ff4500; border-color: rgba(255,69,0,0.4); }
.social-link.social-github:hover    { color: #ffffff; border-color: rgba(255,255,255,0.4); }

/* ─── Footer Navigation ─── */
.footer-nav {
    width: 100%;
}

.footer-nav-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0 0.25rem; /* links are separated by spacing, not pipes */
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Divider pipe between links (via ::before on li except first) */
.footer-nav-list li + li::before {
    content: '|';
    color: var(--border-medium);
    margin-right: 0.25rem;
    pointer-events: none;
    font-size: 0.8125rem;
}

.footer-nav-list a,
.footer-nav-list li a {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
    white-space: nowrap;
}

.footer-nav-list a:hover,
.footer-nav-list li a:hover {
    color: var(--text-primary);
}

/* ─── Copyright Block ─── */
.footer-copyright {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.footer-copyright__main {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.footer-copyright__sub {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* -------------------------------------------------------------------------
   13. Chapter Reader
   -------------------------------------------------------------------------- */

.reader-page {
    background-color: var(--bg-primary);
}

/* Reader Header */
.reader-header {
    background-color: rgba(15, 17, 21, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 60px;
    z-index: 50;
    padding-block: 1rem;
}

.reader-header__inner {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--accent);
    transition: color var(--transition);
}

.breadcrumb a:hover {
    color: var(--accent-dark);
}

.breadcrumb__sep {
    color: var(--border-medium);
}

/* Reader Title */
.reader-title {
    font-size: clamp(1.125rem, 3vw, 1.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.625rem;
}

.reader-title__sub {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-muted);
}

/* Reader Navigation */
.reader-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.reader-nav__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.reader-nav__btn:hover:not(.reader-nav__btn--disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background-color: rgba(201, 162, 39, 0.06);
}

.reader-nav__btn--disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.reader-nav__btn--home {
    color: var(--text-muted);
}

/* Chapter Selector */
.chapter-selector {
    flex: 1;
    min-width: 140px;
    max-width: 220px;
}

.chapter-selector select {
    width: 100%;
    padding: 0.5rem 0.875rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    appearance: auto;
    transition: border-color var(--transition);
}

.chapter-selector select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Reader Settings */
.reader-settings {
    display: flex;
    gap: 0.5rem;
}

.reader-settings__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.reader-settings__btn:hover,
.reader-settings__btn[aria-pressed="true"] {
    border-color: var(--accent);
    color: var(--accent);
}

/* Manga Pages */
.reader-content {
    padding-block: 1.5rem;
}

.reader-pages {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    max-width: var(--reader-max-width);
    margin-inline: auto;
}

.reader-content.is-wide .reader-pages {
    max-width: min(95vw, 1200px);
}

.reader-page-figure {
    width: 100%;
    line-height: 0;
    position: relative;
}

.reader-page-img {
    width: 100%;
    height: auto;
    display: block;
    /* Smooth loading */
    background-color: var(--bg-secondary);
    min-height: 200px;
}

.reader-page-img.is-loading {
    filter: blur(2px);
}

/* No pages placeholder */
.reader-no-pages {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    padding: 3rem;
}

.reader-no-pages__inner {
    text-align: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.reader-no-pages__inner svg {
    opacity: 0.3;
}

.reader-no-pages__hint {
    font-size: 0.8125rem;
    opacity: 0.7;
}

/* Footer nav */
.reader-footer-nav {
    padding-block: 2rem;
    border-top: 1px solid var(--border-subtle);
}

/* Related Chapters */
.related-chapters {
    padding-block: 2.5rem 3rem;
    border-top: 1px solid var(--border-subtle);
}

.related-chapters__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem;
}

@media (min-width: 640px) {
    .related-chapters__grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* -------------------------------------------------------------------------
   14. Pages / Blog
   -------------------------------------------------------------------------- */

.page-content {
    padding-block: 3rem;
}

.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.page-title {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.page-body {
    color: var(--text-secondary);
    line-height: 1.8;
    max-width: 72ch;
}

.page-body h2, .page-body h3, .page-body h4 {
    color: var(--text-primary);
    margin: 1.5rem 0 0.75rem;
}

.page-body p { margin-bottom: 1rem; }
.page-body a { color: var(--accent); text-decoration: underline; }
.page-body ul, .page-body ol { list-style: revert; padding-left: 1.5rem; margin-bottom: 1rem; }

/* Post cards */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-block: 2rem;
}

.post-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.post-card__title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.post-card__title a:hover { color: var(--accent); }
.post-card__meta { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 1rem; }
.post-card__excerpt { color: var(--text-secondary); margin-bottom: 1.25rem; }

/* -------------------------------------------------------------------------
   15. 404 Page
   -------------------------------------------------------------------------- */

.error-404 {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    padding: 3rem 1rem;
}

.error-404__content {
    text-align: center;
    max-width: 480px;
}

.error-404__code {
    display: block;
    font-size: clamp(5rem, 15vw, 8rem);
    font-weight: 900;
    color: var(--accent);
    opacity: 0.15;
    line-height: 1;
    letter-spacing: -0.05em;
    margin-bottom: 0.5rem;
}

.error-404__title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
}

.error-404__message {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.7;
}

.error-404__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

/* -------------------------------------------------------------------------
   16. Pagination
   -------------------------------------------------------------------------- */

.pagination {
    display: flex;
    justify-content: center;
    padding-block: 2rem;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-links a,
.nav-links .current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--border-subtle);
    transition: all var(--transition);
}

.nav-links a {
    color: var(--text-secondary);
    background-color: var(--bg-secondary);
}

.nav-links a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.nav-links .current {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #000;
    font-weight: 700;
}

/* -------------------------------------------------------------------------
   17. Utilities / Misc
   -------------------------------------------------------------------------- */

.no-content {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-muted);
}

.no-content h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.no-content p {
    margin-bottom: 1.5rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.12);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

/* Focus visible */
:focus-visible {
    outline: 2px solid var(--hover-border);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background-color: rgba(201, 162, 39, 0.25);
    color: var(--text-primary);
}

/* -------------------------------------------------------------------------
   18. Responsive Tweaks
   -------------------------------------------------------------------------- */

@media (max-width: 480px) {
    .reader-header {
        top: 0;
    }

    .reader-nav {
        gap: 0.375rem;
    }

    .reader-nav__btn {
        padding: 0.4rem 0.625rem;
        font-size: 0.8125rem;
    }

    .manga-meta-grid {
        grid-template-columns: 1fr;
    }

    .chapter-quick-nav .btn {
        width: 100%;
        text-align: center;
    }
}

@media print {
    .site-header,
    .reader-header,
    .reader-nav,
    .reader-footer-nav,
    .reader-settings,
    .related-chapters,
    .site-footer {
        display: none !important;
    }

    .reader-pages {
        max-width: 100%;
    }
}
