/* ============================================================
   Comic Reader Theme — Homepage Styles
   Depends on design tokens defined in style.css (:root)
   ============================================================ */

/* ── Homepage shell ──────────────────────────────────────── */
.crc-home-main {
    min-height: 80vh;
}

/* ════════════════════════════════════════════════════════════
   HERO SECTION
   ════════════════════════════════════════════════════════════ */

.crc-home-hero {
    position: relative;
/*     min-height: clamp(400px, 62vh, 660px); */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ── Background: blurred cover + gradient overlay ─────────── */
.crc-hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.crc-hero-bg__img {
    position: absolute;
    inset: -5%;           /* slight overscan to hide blur edges */
    background-size: cover;
    background-position: center;
    filter: blur(18px) brightness(0.4) saturate(1.2);
    transition: background-image 0.6s ease;
    will-change: background-image;
}

/* Bottom-up + left-to-right gradient (two layers) */
.crc-hero-bg__grad {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top,  var(--crc-bg) 0%,
                                 color-mix(in srgb, var(--crc-bg) 70%, transparent) 45%,
                                 transparent 85%),
        linear-gradient(to right, var(--crc-bg) 0%,
                                  color-mix(in srgb, var(--crc-bg) 55%, transparent) 35%,
                                  transparent 70%);
}

/* Fallback for browsers without color-mix */
@supports not (background: color-mix(in srgb, red, blue)) {
    .crc-hero-bg__grad {
        background:
            linear-gradient(to top,  #0f0f0f 0%, rgba(15,15,15,.70) 45%, transparent 85%),
            linear-gradient(to right, #0f0f0f 0%, rgba(15,15,15,.55) 35%, transparent 70%);
    }
}

/* ── Content layer ─────────────────────────────────────────── */
.crc-hero-content {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-block: 2rem 2.25rem;
}

.crc-hero-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ── Tab buttons ───────────────────────────────────────────── */
.crc-hero-tabs {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.75rem;
}

.crc-hero-tab {
    padding: .42rem 1.1rem;
    border-radius: 999px;
    font-size: .875rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    background: rgba(255, 255, 255, .1);
    color: rgba(232, 232, 232, .6);
    font-family: var(--crc-font);
    transition: background .2s, color .2s, box-shadow .2s;
    line-height: 1;
}

.crc-hero-tab:hover {
    background: rgba(255, 255, 255, .17);
    color: var(--crc-text);
}

.crc-hero-tab--active {
    background: var(--crc-accent);
    color: #fff;
    box-shadow: 0 4px 18px rgba(232, 85, 42, .4);
}

/* ── Featured comic info block ─────────────────────────────── */
.crc-hero-info {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    margin-bottom: 1.75rem;
    transition: opacity .22s ease, transform .22s ease;
}

.crc-hero-info.is-transitioning {
    opacity: 0;
    transform: translateY(10px);
}

/* Cover thumbnail */
.crc-hero-cover-link {
    flex-shrink: 0;
    display: block;
    width: clamp(100px, 14vw, 152px);
    aspect-ratio: 3 / 4;
    border-radius: var(--crc-radius-lg);
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, .12);
    box-shadow: 0 10px 36px rgba(0, 0, 0, .6);
    transition: transform .2s;
    text-decoration: none;
    color: inherit;
}

.crc-hero-cover-link:hover {
    transform: scale(1.04);
}

.crc-hero-cover {
    width: 100%;
    height: 100%;
    position: relative;
}

.crc-hero-cover__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.crc-hero-cover__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--crc-surface-2);
    font-size: 3rem;
}

/* Text block */
.crc-hero-text {
    max-width: 560px;
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

.crc-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    align-items: center;
    min-height: 1.5rem;
}

.crc-hero-status {
    font-size: .75rem;
    font-weight: 700;
}

.crc-hero-title {
    font-size: clamp(1.35rem, 3.5vw, 2.4rem);
    font-weight: 800;
    line-height: 1.2;
    color: var(--crc-text);
    text-shadow: 0 2px 14px rgba(0, 0, 0, .55);
    margin: 0;
}

.crc-hero-author {
    font-size: .88rem;
    color: var(--crc-text-muted);
    margin: 0;
}

.crc-hero-author__chapters {
    color: var(--crc-text-muted);
    opacity: .75;
}

.crc-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    padding-top: .2rem;
}

.crc-hero-btn {
    padding: .55rem 1.2rem;
    font-size: .88rem;
}

/* ── Thumbnail strip ───────────────────────────────────────── */
.crc-hero-strip {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin-top: auto;
}

.crc-hero-nav {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: rgba(232, 232, 232, .7);
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    font-family: var(--crc-font);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, color .2s;
}

.crc-hero-nav:hover {
    background: rgba(255, 255, 255, .2);
    color: var(--crc-text);
}

.crc-hero-thumbs {
    display: flex;
    gap: .4rem;
    overflow: hidden;
}

.crc-hero-thumb {
    width: 44px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    background: var(--crc-surface-2);
    padding: 0;
    opacity: .5;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .2s, border-color .2s, transform .2s, box-shadow .2s;
}

.crc-hero-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.crc-hero-thumb:hover {
    opacity: .85;
}

.crc-hero-thumb--active {
    border-color: var(--crc-accent);
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(232, 85, 42, .4);
}

/* Indicator dots */
.crc-hero-dots {
    display: flex;
    align-items: center;
    gap: .3rem;
    margin-left: .5rem;
}

.crc-hero-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .25);
    transition: width .3s ease, background .3s ease;
}

.crc-hero-dot--active {
    width: 20px;
    background: var(--crc-accent);
}

/* ════════════════════════════════════════════════════════════
   COMIC ROWS
   ════════════════════════════════════════════════════════════ */

.crc-home-rows {
    padding-block: 3rem 3.5rem;
}

/* Vertical spacing between rows */
.crc-home-rows .crc-container > .crc-home-row + .crc-home-row {
    margin-top: 2.75rem;
}

/* Row header */
.crc-home-row__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .8rem;
}

.crc-home-row__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--crc-text);
    border-left: 3px solid var(--crc-accent);
    padding-left: .65rem;
    line-height: 1.3;
}

@media (min-width: 640px) {
    .crc-home-row__title { font-size: 1.1rem; }
}

.crc-home-row__see-all {
    flex-shrink: 0;
    font-size: .8rem;
    font-weight: 600;
    color: var(--crc-accent);
    display: flex;
    align-items: center;
    gap: .2rem;
    transition: color .2s;
    text-decoration: none;
}

.crc-home-row__see-all:hover {
    color: var(--crc-accent-hover);
}

/* Row scroll area with arrow buttons */
.crc-home-row__wrap {
    position: relative;
}

.crc-row-arrow {
    position: absolute;
    top: 38%;
    transform: translateY(-50%);
    z-index: 5;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(15, 15, 15, .88);
    color: var(--crc-text);
    border: 1px solid var(--crc-border);
    cursor: pointer;
    font-size: 1.3rem;
    /* hidden by default, shown on row hover via JS */
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 14px rgba(0, 0, 0, .45);
    transition: background .2s;
    font-family: var(--crc-font);
    line-height: 1;
}

.crc-row-arrow:hover {
    background: var(--crc-surface-2);
}

.crc-row-arrow--prev { left:  -15px; }
.crc-row-arrow--next { right: -15px; }

/* Show arrows when row is hovered (desktop) */
@media (hover: hover) {
    .crc-home-row__wrap:hover .crc-row-arrow {
        display: flex;
    }
}

/* Horizontal scroll container */
.crc-home-row__scroll {
    display: flex;
    gap: .75rem;
    overflow-x: auto;
    padding-bottom: .5rem;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.crc-home-row__scroll::-webkit-scrollbar {
    display: none;
}

/* ════════════════════════════════════════════════════════════
   HOME COMIC CARD
   ════════════════════════════════════════════════════════════ */

.crc-home-card {
    flex-shrink: 0;
    width: clamp(110px, 14vw, 148px);
    scroll-snap-align: start;
}

.crc-home-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: var(--crc-radius-lg);
    overflow: hidden;
    background: var(--crc-surface);
    border: 1px solid var(--crc-border);
    transition: transform .2s, box-shadow .2s;
}

.crc-home-card__link:hover {
    transform: translateY(-5px);
    box-shadow: var(--crc-shadow);
    color: inherit;
}

/* Cover */
.crc-home-card__cover {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--crc-surface-2);
}

.crc-home-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}

.crc-home-card__link:hover .crc-home-card__img {
    transform: scale(1.06);
}

.crc-home-card__no-cover {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--crc-text-muted);
}

/* Badge (top-left corner) */
.crc-home-card__badge {
    position: absolute;
    top: .4rem;
    left: .4rem;
    padding: .12rem .45rem;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    background: var(--crc-accent);
    color: #fff;
    pointer-events: none;
}

/* Hover overlay */
.crc-home-card__hover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s;
    font-size: .82rem;
    font-weight: 700;
    color: #fff;
    pointer-events: none;
}

.crc-home-card__link:hover .crc-home-card__hover-overlay {
    opacity: 1;
}

/* Body */
.crc-home-card__body {
    padding: .5rem .6rem .65rem;
}

.crc-home-card__title {
    font-size: .82rem;
    font-weight: 600;
    color: var(--crc-text);
    margin: 0 0 .2rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.crc-home-card__author {
    font-size: .72rem;
    color: var(--crc-text-muted);
    margin: 0 0 .3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crc-home-card__foot {
    display: flex;
    align-items: center;
    gap: .3rem;
    flex-wrap: wrap;
}

.crc-home-card__chapters {
    font-size: .7rem;
    color: var(--crc-accent);
    font-weight: 600;
}

/* ════════════════════════════════════════════════════════════
   EMPTY STATE
   ════════════════════════════════════════════════════════════ */

.crc-home-empty {
    text-align: center;
    padding: 6rem 1rem;
    color: var(--crc-text-muted);
}

.crc-home-empty__icon {
    font-size: 4.5rem;
    margin-bottom: 1.25rem;
}

.crc-home-empty__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--crc-text);
    margin-bottom: .5rem;
}

.crc-home-empty__text {
    font-size: .9rem;
    color: var(--crc-text-muted);
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
    /* Hero */
    .crc-home-hero { min-height: clamp(360px, 75vw, 440px); }
    .crc-hero-cover-link { width: clamp(84px, 22vw, 108px); }
    .crc-hero-info { gap: .9rem; margin-bottom: 1.25rem; }
    .crc-hero-title { font-size: 1.25rem; }
    .crc-hero-author { font-size: .8rem; }
    .crc-hero-tabs { margin-bottom: 1.2rem; }
    .crc-hero-btn { padding: .45rem .9rem; font-size: .82rem; }

    /* Rows */
    .crc-home-rows { padding-block: 2rem 2.5rem; }
    .crc-home-rows .crc-container > .crc-home-row + .crc-home-row { margin-top: 2rem; }
    .crc-home-card { width: clamp(100px, 38vw, 130px); }

    /* Hide row arrows on touch */
    .crc-row-arrow { display: none !important; }
}
