/* ======================================================
   EBOOKS
====================================================== */

.ebooks-page {
    width: 100%;
}

.ebooks-page .container {
    width: min(1120px, calc(100% - 32px));
    margin-inline: auto;
}


/* ======================================================
   HERO
====================================================== */

.ebooks-hero {
    padding: 72px 0;
    background: var(--color-surface, #f8fafc);
}

.ebooks-eyebrow,
.section-eyebrow {
    display: inline-block;
    margin-bottom: 12px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ebooks-hero h1 {
    max-width: 780px;
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.1;
}

.ebooks-hero p {
    max-width: 720px;
    margin: 20px 0 0;
    font-size: 1.1rem;
    line-height: 1.7;
}


/* ======================================================
   SECTIONS
====================================================== */

.ebooks-categories,
.ebooks-list,
.ebook-description,
.ebook-download-cta {
    padding: 64px 0;
}

.section-header {
    max-width: 720px;
    margin-bottom: 32px;
}

.section-header h2 {
    margin: 0;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    line-height: 1.2;
}

.section-header p {
    margin-top: 12px;
    line-height: 1.7;
}


/* ======================================================
   CATEGORY GRID
====================================================== */

.ebooks-category-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.ebook-category-card {
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    background: #fff;
}

.ebook-category-card img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.ebook-category-card__content {
    padding: 24px;
}

.ebook-category-card h3 {
    margin: 0;
    font-size: 1.35rem;
}

.ebook-category-card h3 a {
    text-decoration: none;
}

.ebook-category-card p {
    margin: 12px 0 20px;
    line-height: 1.6;
}

.ebook-category-card__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    text-decoration: none;
}


/* ======================================================
   EBOOK GRID
====================================================== */

.ebooks-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px;
    align-items: stretch;
}

.ebook-card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.06);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.ebook-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.1);
}

.ebook-card__cover {
    display: block;
    overflow: hidden;
    background: #f1f5f9;
}

.ebook-card__cover img {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.ebook-card:hover .ebook-card__cover img {
    transform: scale(1.02);
}

.ebook-card__content {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 24px 22px 22px;
}

.ebook-card__category {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ebook-card h3 {
    margin: 0;
    font-size: 1.3rem;
    line-height: 1.3;
}

.ebook-card h3 a {
    text-decoration: none;
}

.ebook-card p {
    margin: 14px 0 20px;
    line-height: 1.6;
}


/* ======================================================
   DISCOUNT BADGE
====================================================== */

.ebook-card__discount {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 30px;
    padding: 0 12px;

    border-radius: 999px;

    background: #16a34a;
    color: #fff;

    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}


/* ======================================================
   PRICING
====================================================== */

.ebook-card__pricing {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: auto;
    margin-bottom: 18px;
}

.ebook-card__original-price {
    color: #94a3b8;
    font-size: 0.9rem;
    text-decoration: line-through;
}

.ebook-card__sale-price {
    color: #16a34a;
    font-size: 1.45rem;
    line-height: 1.2;
}


/* ======================================================
   CARD ACTIONS
====================================================== */

.ebook-card__actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: auto;
}

.ebook-card__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 46px;
    padding: 0 18px;

    border-radius: 9px;

    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;

    text-align: center;
    text-decoration: none;

    transition:
        transform 0.2s ease,
        opacity 0.2s ease,
        box-shadow 0.2s ease;
}

.ebook-card__button:hover {
    transform: translateY(-2px);
    opacity: 0.94;
}

.ebook-card__button--free {
    background: #16a34a;
    color: #fff;
    box-shadow: 0 6px 14px rgba(22, 163, 74, 0.2);
}

.ebook-card__button--buy {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.2);
}


/* ======================================================
   BREADCRUMB
====================================================== */

.ebooks-breadcrumb {
    display: inline-block;
    margin-bottom: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
}


/* ======================================================
   CATEGORY PAGE
====================================================== */

.ebooks-category-hero {
    padding-bottom: 64px;
}


/* ======================================================
   EBOOK DETAIL / LANDING PAGE
====================================================== */

.ebook-hero {
    padding: 72px 0;
}

.ebook-hero__grid {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: 64px;
    align-items: center;
}

.ebook-hero__cover {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.ebook-hero__cover img {
    display: block;
    width: 100%;
    max-width: 360px;
    height: auto;
    margin-inline: auto;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.14);
}

.ebook-hero__content {
    min-width: 0;
}

.ebook-hero__content h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.1;
}

.ebook-hero__description {
    margin: 24px 0 0;
    font-size: 1.15rem;
    line-height: 1.7;
}

.ebook-hero__author {
    margin-top: 18px;
    font-weight: 600;
}


/* ======================================================
   DETAIL — PRICING
====================================================== */

.ebook-hero__pricing {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-top: 20px;
}

.ebook-hero__discount {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 30px;
    padding: 0 12px;

    border-radius: 999px;

    background: #16a34a;
    color: #fff;

    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.ebook-hero__original-price {
    color: #94a3b8;
    font-size: 0.95rem;
    text-decoration: line-through;
}

.ebook-hero__sale-price {
    color: #16a34a;
    font-size: 1.8rem;
    line-height: 1.2;
}


/* ======================================================
   DETAIL — ACTIONS
====================================================== */

.ebook-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.ebook-hero__actions .ebook-download-button,
.ebook-purchase-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 52px;
    padding: 0 28px;

    border-radius: 10px;

    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;

    transition:
        transform 0.2s ease,
        opacity 0.2s ease,
        box-shadow 0.2s ease;
}

.ebook-hero__actions .ebook-download-button {
    margin-top: 0;
    background: #16a34a;
    color: #fff;
    box-shadow: 0 6px 14px rgba(22, 163, 74, 0.2);
}

.ebook-purchase-button {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.2);
}

.ebook-hero__actions .ebook-download-button:hover,
.ebook-purchase-button:hover {
    transform: translateY(-2px);
    opacity: 0.94;
}


/* ======================================================
   DOWNLOAD BUTTON
====================================================== */

.ebook-download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 52px;
    margin-top: 28px;
    padding: 0 28px;

    border-radius: 10px;

    font-weight: 700;
    text-decoration: none;
}

.ebook-hero__note {
    margin-top: 12px;
    font-size: 0.85rem;
    opacity: 0.75;
}


/* ======================================================
   DESCRIPTION
====================================================== */

.ebook-content {
    max-width: 820px;
    margin-inline: auto;
}

.ebook-description__text {
    font-size: 1.05rem;
    line-height: 1.8;
}

.ebook-description__text p {
    margin: 0 0 20px;
}


/* ======================================================
   DOWNLOAD CTA
====================================================== */

.ebook-download-cta {
    text-align: center;
    background: var(--color-surface, #f8fafc);
}

.ebook-download-cta__content {
    max-width: 720px;
    margin-inline: auto;
}

.ebook-download-cta h2 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
}

.ebook-download-cta p {
    margin: 14px 0 0;
    line-height: 1.7;
}


/* ======================================================
   NAVIGATION
====================================================== */

.ebook-navigation {
    padding: 40px 0;
}

.ebook-navigation .container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}


/* ======================================================
   EMPTY STATE
====================================================== */

.ebooks-empty {
    padding: 80px 0;
    text-align: center;
}

.ebooks-empty h2 {
    margin: 0;
}

.ebooks-empty p {
    margin-top: 12px;
}


/* ======================================================
   RESPONSIVE
====================================================== */

@media (max-width: 900px) {

    .ebooks-category-grid,
    .ebooks-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ebook-hero__grid {
        grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
        gap: 40px;
    }

    .ebook-hero__cover img {
        max-width: 320px;
    }
}


@media (max-width: 640px) {

    .ebooks-hero,
    .ebook-hero {
        padding: 48px 0;
    }

    .ebooks-categories,
    .ebooks-list,
    .ebook-description,
    .ebook-download-cta {
        padding: 48px 0;
    }

    .ebooks-category-grid,
    .ebooks-grid,
    .ebook-hero__grid {
        grid-template-columns: 1fr;
    }

    .ebook-hero__cover img {
        max-width: 300px;
    }

    .ebook-card__content {
        padding: 22px 20px 20px;
    }

    .ebook-download-button {
        width: 100%;
    }

    .ebook-hero__actions {
        flex-direction: column;
    }

    .ebook-hero__actions .ebook-download-button,
    .ebook-purchase-button {
        width: 100%;
    }

    .ebook-navigation .container {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
}