/* ==========================================================================
   Home Page - Clean, Modern Layout
   ========================================================================== */

/* ══════════════════════════════════════════════════════
   Hero + Featured Combined Section
   ══════════════════════════════════════════════════════ */
.page-content:has(.hero-featured) {
    padding-top: 0;
}

.hero-featured {
    position: relative;
    min-height: 520px;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin-bottom: 40px;
    margin-left: calc(-1 * var(--space-md));
    margin-right: calc(-1 * var(--space-md));
}

/* ── Crossfading Backgrounds ── */
.hf-backgrounds {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hf-bg {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.hf-bg.active {
    opacity: 1;
}

.hf-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    filter: blur(2px) brightness(0.35);
    transform: scale(1.05);
}

/* ── Overlay ── */
.hf-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(to bottom, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.3) 50%, rgba(0, 0, 0, 0.75) 100%),
        radial-gradient(ellipse at 50% 15%, var(--color-primary-light) 0%, transparent 60%);
    pointer-events: none;
    opacity: 0.9;
}

/* Fallback background when no featured images */
.hero-featured:not(:has(.hf-backgrounds)) {
    background: var(--color-bg);
}

.hero-featured:not(:has(.hf-backgrounds)) .hf-overlay {
    background: radial-gradient(ellipse at 50% 30%, var(--color-primary-light) 0%, transparent 60%);
    opacity: 0.4;
}

/* ── Content Layer ── */
.hf-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    padding: var(--space-2xl) calc(var(--space-xl) + var(--space-md));
    min-height: 520px;
}

/* ── Welcome Area (top, centered) ── */
.hf-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-md);
    padding-top: var(--space-lg);
}

.hero-title {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.08;
    margin: 0;
    color: #fff;
    letter-spacing: -0.035em;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.75);
    max-width: 440px;
    margin: 0 auto;
    line-height: 1.6;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* When no featured images, use theme colors */
.hero-featured:not(:has(.hf-backgrounds)) .hero-title {
    color: var(--color-heading);
    text-shadow: none;
}

.hero-featured:not(:has(.hf-backgrounds)) .hero-subtitle {
    color: var(--color-text-muted);
    text-shadow: none;
}

.hero-search {
    max-width: 440px;
    width: 100%;
    margin-top: var(--space-xs);
    position: relative;
}

.hero-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--color-text-muted);
    pointer-events: none;
    z-index: 2;
}

.hero-search input {
    width: 100%;
    padding: 0.75rem 1.25rem 0.75rem 2.5rem;
    font-size: var(--text-sm);
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.hero-search input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.hero-search input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-light), 0.3);
    background: rgba(255, 255, 255, 0.15);
}

/* Search input without featured images - use theme styles */
.hero-featured:not(:has(.hf-backgrounds)) .hero-search input {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.hero-featured:not(:has(.hf-backgrounds)) .hero-search input::placeholder {
    color: var(--color-text-muted);
}

.hero-featured:not(:has(.hf-backgrounds)) .hero-search input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* ── Bottom Area (featured info + indicators) ── */
.hf-bottom {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-lg);
}

.hf-featured-info {
    display: grid;
    align-items: end;
    max-width: 520px;
    min-height: 180px;
}

.hf-slide-info {
    grid-area: 1 / 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    text-decoration: none;
    color: inherit;
    opacity: 0;
    transform: translateX(0);
    transition: opacity 0.6s ease, transform 0.6s ease;
    pointer-events: none;
}

.hf-slide-info.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

/* Featured text styles (white on dark bg) */
.hero-featured .featured-type {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-primary);
    margin-bottom: 6px;
}

.hero-featured .featured-name {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: #fff;
    line-height: 1.15;
    letter-spacing: -0.025em;
    margin: 0 0 var(--space-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.hero-featured .featured-desc {
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--text-sm);
    line-height: 1.6;
    margin-bottom: var(--space-md);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-featured .featured-meta {
    display: flex;
    gap: var(--space-md);
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: var(--space-lg);
    align-items: center;
}

.hero-featured .featured-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.hero-featured .featured-status {
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.hf-slide-info .btn {
    align-self: flex-start;
}

/* ── Dot Indicators ── */
.hf-indicators {
    display: flex;
    gap: 6px;
    align-items: center;
    padding-bottom: var(--space-xs);
    flex-shrink: 0;
}

.hf-dot {
    width: 24px;
    height: 3px;
    border-radius: 2px;
    border: none;
    padding: 0;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.hf-dot:hover {
    background: rgba(255, 255, 255, 0.6);
}

.hf-dot.active {
    background: var(--color-primary);
    width: 32px;
}

/* ══════════════════════════════════════════════════════
   Light Theme Overrides
   ══════════════════════════════════════════════════════ */
:root[data-theme="light"] .hf-overlay {
    background:
        linear-gradient(to bottom, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0.8) 100%),
        radial-gradient(ellipse at 50% 15%, var(--color-primary-light) 0%, transparent 60%);
}

:root[data-theme="light"] .hf-bg img {
    filter: blur(2px) brightness(0.55);
}

:root[data-theme="light"] .hero-featured .featured-name {
    color: var(--color-heading);
    text-shadow: 0 1px 4px rgba(255, 255, 255, 0.5);
}

:root[data-theme="light"] .hero-featured .featured-desc {
    color: var(--color-text-secondary);
}

:root[data-theme="light"] .hero-featured .featured-meta {
    color: var(--color-text-muted);
}

:root[data-theme="light"] .hero-featured .featured-status {
    background: var(--color-hover-bg);
}

:root[data-theme="light"] .hero-title {
    color: var(--color-heading);
    text-shadow: 0 1px 4px rgba(255, 255, 255, 0.3);
}

:root[data-theme="light"] .hero-subtitle {
    color: var(--color-text-muted);
    text-shadow: none;
}

:root[data-theme="light"] .hero-search input {
    border-color: var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

:root[data-theme="light"] .hero-search input::placeholder {
    color: var(--color-text-muted);
}

:root[data-theme="light"] .hero-search input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

:root[data-theme="light"] .hf-dot {
    background: rgba(0, 0, 0, 0.2);
}

:root[data-theme="light"] .hf-dot:hover {
    background: rgba(0, 0, 0, 0.4);
}

:root[data-theme="light"] .hf-dot.active {
    background: var(--color-primary);
}

/* ══════════════════════════════════════════════════════
   Reduced Motion
   ══════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .hf-bg {
        transition: opacity 0.01s;
    }

    .hf-slide-info {
        transition: opacity 0.01s;
        transform: none !important;
    }
}

/* ── Splide Overrides ── */
.splide__arrow {
    background: var(--color-surface) !important;
    border: 1px solid var(--color-border) !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: var(--radius-full) !important;
    opacity: 1 !important;
    transition: all var(--transition-fast) !important;
    box-shadow: var(--shadow-md);
}

.splide__arrow svg {
    fill: var(--color-heading) !important;
    width: 14px !important;
    height: 14px !important;
}

.splide__arrow:disabled {
    display: none !important;
}

/* Desktop: hide arrows until carousel is hovered */
@media (hover: hover) {
    .splide__arrow {
        opacity: 0 !important;
    }

    .splide:hover .splide__arrow:not(:disabled) {
        opacity: 1 !important;
    }

    .splide__arrow:hover {
        background: var(--color-primary) !important;
        border-color: var(--color-primary) !important;
    }

    .splide__arrow:hover svg {
        fill: white !important;
    }
}

/* ── Sections ── */
.section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.section-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-heading);
    margin: 0;
    letter-spacing: -0.01em;
}

.section-link {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-muted);
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--transition-fast);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.section-link:hover {
    color: var(--color-primary);
}

/* ── Continue Reading ── */
.continue-card {
    display: block;
    text-decoration: none;
    color: inherit;
}

.continue-cover {
    position: relative;
    aspect-ratio: 5 / 7;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-bg-tertiary);
}

.continue-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (hover: hover) {
    .continue-cover img {
        transition: transform 0.3s ease;
    }

    .continue-card:hover .continue-cover img {
        transform: scale(1.05);
    }
}

.continue-cover-placeholder {
    width: 100%;
    height: 100%;
    background: var(--color-bg-tertiary);
}

.continue-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-sm);
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    display: flex;
    align-items: flex-end;
}

.continue-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--color-primary);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.continue-title {
    margin-top: 6px;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* Splide slides — fix iOS double-tap on links */
.splide__slide .comic-card .card-cover,
.splide__slide .continue-card a {
    touch-action: manipulation;
    -webkit-touch-callout: none;
}

.splide__slide .comic-card .card-cover img,
.splide__slide .continue-card img {
    pointer-events: none;
    -webkit-user-drag: none;
}

/* Trending slides */
#trending-splide .splide__slide {
    min-width: 0;
}

/* ══════════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════════ */
@media (min-width: 768px) {
    .hero-featured {
        min-height: 560px;
        margin-left: calc(-1 * var(--space-lg));
        margin-right: calc(-1 * var(--space-lg));
    }

    .hf-content {
        min-height: 560px;
        padding: var(--space-2xl) calc(var(--space-2xl) + var(--space-lg));
    }

    .hero-title {
        font-size: 3rem;
    }

    .hero-subtitle {
        font-size: var(--text-base);
    }

    .section {
        margin-bottom: 56px;
    }

    .section-title {
        font-size: var(--text-xl);
    }

    .hero-featured .featured-name {
        font-size: var(--text-3xl);
    }

    .hero-featured .featured-desc {
        -webkit-line-clamp: 3;
    }
}

@media (min-width: 1024px) {
    .hero-featured {
        min-height: 600px;
    }

    .hf-content {
        min-height: 600px;
        padding: var(--space-2xl) calc(var(--space-3xl) + var(--space-lg));
    }

    .hero-title {
        font-size: 3.5rem;
    }

    .section {
        margin-bottom: 64px;
    }

    .section-title {
        font-size: var(--text-2xl);
    }

    .hf-featured-info {
        max-width: 560px;
    }
}

/* Mobile */
@media (max-width: 639px) {
    .hero-featured {
        min-height: 580px;
    }

    .hf-content {
        min-height: 580px;
        padding: var(--space-xl) calc(var(--space-md) + var(--space-md));
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hf-bottom {
        flex-direction: column;
        align-items: flex-start;
    }

    .hf-featured-info {
        max-width: 100%;
        width: 100%;
    }

    .hero-featured .featured-name {
        font-size: var(--text-xl);
    }

    .hero-featured .featured-desc {
        -webkit-line-clamp: 2;
        font-size: var(--text-xs);
    }

    .hero-featured .featured-meta {
        margin-bottom: var(--space-md);
    }

    .splide__arrow {
        width: 28px !important;
        height: 28px !important;
    }

    .splide__arrow svg {
        width: 10px !important;
        height: 10px !important;
    }
}
