/* =========================================================
   Magazine categories (Views/Mag/MagListCategory)
   Sidebar cards reuse the .rm-* styles from read-mag.css
   ========================================================= */

:root {
    --ml-primary: #1e88e5;
    --ml-primary-soft: #e8f2fd;
    --ml-accent: #fb9017;
    --ml-ink: #1f2937;
    --ml-text: #374151;
    --ml-muted: #6b7280;
    --ml-line: #edf1f6;
    --ml-radius: 20px;
    --ml-shadow: 0 10px 30px -18px rgba(15, 35, 70, .38);
    --ml-shadow-lg: 0 24px 50px -22px rgba(15, 35, 70, .45);
    --ml-ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---------------------------------------------------------
   Hero
   --------------------------------------------------------- */
.ml-hero {
    position: relative;
    padding: 56px 0 110px;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(135deg, #0f2c52 0%, #1565c0 55%, #1e88e5 100%);
}

.ml-hero-shape {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.ml-hero-shape-1 {
    top: -120px;
    left: -80px;
    width: 340px;
    height: 340px;
    background: rgba(255, 255, 255, .07);
}

.ml-hero-shape-2 {
    bottom: -160px;
    right: 8%;
    width: 300px;
    height: 300px;
    background: rgba(251, 144, 23, .18);
    filter: blur(20px);
}

.ml-hero-inner {
    position: relative;
    max-width: 760px;
    text-align: center;
}

.ml-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 16px;
    margin-bottom: 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    font-size: 13px;
}

    .ml-breadcrumb a {
        color: rgba(255, 255, 255, .85);
    }

        .ml-breadcrumb a:hover {
            color: #fff;
            text-decoration: none;
        }

    .ml-breadcrumb > i {
        font-size: 9px;
        opacity: .6;
    }

    .ml-breadcrumb span {
        color: var(--ml-accent);
        font-weight: 700;
    }

.ml-hero h1 {
    margin: 0 0 12px;
    color: #fff;
    font-size: 34px;
    font-weight: 900;
}

.ml-hero p {
    margin: 0 0 22px;
    color: rgba(255, 255, 255, .85);
    font-size: 15px;
    line-height: 2;
}

.ml-hero-stats {
    display: inline-flex;
    gap: 10px;
}

    .ml-hero-stats span {
        padding: 6px 16px;
        border-radius: 999px;
        background: rgba(255, 255, 255, .12);
        border: 1px solid rgba(255, 255, 255, .2);
        font-size: 13px;
    }

    .ml-hero-stats b {
        color: var(--ml-accent);
        font-size: 15px;
        margin-left: 4px;
    }

/* ---------------------------------------------------------
   Layout
   --------------------------------------------------------- */
.ml-page {
    position: relative;
    z-index: 1;
    margin-top: -70px;
    padding-bottom: 40px;
}

.ml-sidebar {
    top: 110px;
}

.ml-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 14px 20px;
    background: #fff;
    border: 1px solid var(--ml-line);
    border-radius: 16px;
    box-shadow: var(--ml-shadow);
}

    .ml-section-head h2 {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 0;
        color: var(--ml-ink);
        font-size: 17px;
        font-weight: 800;
    }

        .ml-section-head h2 i {
            width: 32px;
            height: 32px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 10px;
            background: #fff3e3;
            color: var(--ml-accent);
            font-size: 14px;
        }

.ml-section-head-spaced {
    margin-top: 16px;
}

/* ---------------------------------------------------------
   Category card
   --------------------------------------------------------- */
.ml-cat {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border: 1px solid var(--ml-line);
    border-radius: var(--ml-radius);
    box-shadow: var(--ml-shadow);
    overflow: hidden;
    color: var(--ml-ink);
    transition: transform .4s var(--ml-ease), box-shadow .4s var(--ml-ease);
}

    .ml-cat:hover {
        transform: translateY(-6px);
        box-shadow: var(--ml-shadow-lg);
        color: var(--ml-ink);
        text-decoration: none;
    }

.ml-cat-media {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #e2e8f0;
}

    .ml-cat-media img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 1s var(--ml-ease);
    }

    .ml-cat-media::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0) 50%, rgba(10, 20, 40, .45) 100%);
    }

.ml-cat:hover .ml-cat-media img {
    transform: scale(1.08);
}

.ml-cat-count {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 1;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    color: var(--ml-primary);
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
}

.ml-cat-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 18px 20px 18px;
}

    .ml-cat-body h3 {
        margin: 0 0 8px;
        font-size: 18px;
        font-weight: 800;
        transition: color .2s ease;
    }

.ml-cat:hover .ml-cat-body h3 {
    color: var(--ml-primary);
}

.ml-cat-body p {
    margin: 0 0 14px;
    color: var(--ml-muted);
    font-size: 13px;
    line-height: 2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ml-cat-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px dashed var(--ml-line);
    color: var(--ml-muted);
    font-size: 12px;
}

    .ml-cat-foot i {
        color: var(--ml-primary);
        margin-left: 4px;
    }

.ml-cat-go {
    color: var(--ml-accent);
    font-size: 13px;
    font-weight: 800;
}

    .ml-cat-go i {
        color: var(--ml-accent) !important;
        margin: 0 4px 0 0 !important;
        transition: transform .3s var(--ml-ease);
    }

.ml-cat:hover .ml-cat-go i {
    transform: translateX(-5px);
}

/* ---------------------------------------------------------
   Latest posts
   --------------------------------------------------------- */
.ml-post {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--ml-shadow);
    color: var(--ml-ink);
    transition: transform .4s var(--ml-ease), box-shadow .4s var(--ml-ease);
}

    .ml-post:hover {
        transform: translateY(-6px);
        box-shadow: var(--ml-shadow-lg);
        color: var(--ml-ink);
        text-decoration: none;
    }

.ml-post-media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #e2e8f0;
}

    .ml-post-media img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform .8s var(--ml-ease);
    }

.ml-post:hover .ml-post-media img {
    transform: scale(1.08);
}

.ml-post-badge {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--ml-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.ml-post-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 14px 16px 16px;
}

    .ml-post-body h4 {
        margin: 0 0 10px;
        font-size: 14px;
        font-weight: 800;
        line-height: 1.9;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        transition: color .2s ease;
    }

.ml-post:hover .ml-post-body h4 {
    color: var(--ml-primary);
}

.ml-post-date {
    margin-top: auto;
    color: var(--ml-muted);
    font-size: 12px;
}

    .ml-post-date i {
        color: var(--ml-primary);
        margin-left: 4px;
    }

/* empty state */
.ml-empty {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1.5px dashed #d6dde8;
    border-radius: 16px;
    background: #fff;
    color: var(--ml-muted);
}

    .ml-empty i {
        color: var(--ml-primary);
        font-size: 22px;
    }

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */
@media (max-width: 767.98px) {
    .ml-hero {
        padding: 40px 0 90px;
    }

        .ml-hero h1 {
            font-size: 26px;
        }

    .ml-page {
        margin-top: -56px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ml-page * {
        transition: none !important;
    }
}

/* =========================================================
   Category article list (Views/Mag/MagList)
   ========================================================= */
.ml-hero-cat {
    isolation: isolate;
    background: #0f1d33;
}

.ml-hero-bg {
    position: absolute;
    inset: -20px;
    z-index: -2;
    background-size: cover;
    background-position: center;
    filter: blur(3px) saturate(115%);
    transform: scale(1.05);
}

.ml-hero-cat::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(10, 20, 40, .6) 0%, rgba(10, 20, 40, .85) 100%);
}

/* category chips */
.ml-cat-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 10px;
    overflow-x: auto;
    background: #fff;
    border: 1px solid var(--ml-line);
    border-radius: 16px;
    box-shadow: var(--ml-shadow);
    scrollbar-width: thin;
}

.ml-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 999px;
    background: #f5f8fc;
    color: var(--ml-text);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    transition: background .2s ease, color .2s ease;
}

    .ml-chip:hover {
        background: var(--ml-primary-soft);
        color: var(--ml-primary);
        text-decoration: none;
    }

    .ml-chip.is-active {
        background: var(--ml-primary);
        color: #fff;
    }

    .ml-chip i {
        font-size: 12px;
    }

/* search + sort */
.ml-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.ml-search {
    position: relative;
    flex: 1 1 260px;
    max-width: 420px;
    margin: 0;
}

    .ml-search i {
        position: absolute;
        top: 50%;
        right: 16px;
        transform: translateY(-50%);
        color: var(--ml-muted);
        pointer-events: none;
    }

    .ml-search input {
        width: 100%;
        height: 46px;
        padding: 0 44px 0 16px;
        border: 1.5px solid #e2e8f0;
        border-radius: 14px;
        background: #fff;
        color: var(--ml-ink);
        font-size: 14px;
        box-shadow: var(--ml-shadow);
        transition: border-color .2s ease, box-shadow .2s ease;
    }

        .ml-search input:focus {
            outline: none;
            border-color: var(--ml-primary);
            box-shadow: 0 0 0 4px rgba(30, 136, 229, .15);
        }

.ml-sort {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--ml-line);
    box-shadow: var(--ml-shadow);
}

.ml-sort-btn {
    height: 36px;
    padding: 0 16px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--ml-muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

    .ml-sort-btn:hover {
        color: var(--ml-ink);
    }

    .ml-sort-btn.is-active {
        background: var(--ml-primary);
        color: #fff;
    }

    .ml-sort-btn:focus {
        outline: none;
    }

/* larger post card with excerpt */
.ml-post-lg .ml-post-body {
    padding: 16px 18px 18px;
}

    .ml-post-lg .ml-post-body h4 {
        font-size: 16px;
        margin-bottom: 8px;
    }

.ml-post-badge i {
    margin-left: 3px;
}

.ml-post-excerpt {
    margin: 0 0 12px;
    color: var(--ml-muted);
    font-size: 13px;
    line-height: 2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ml-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px dashed var(--ml-line);
    color: var(--ml-muted);
    font-size: 12px;
}

    .ml-post-meta i {
        color: var(--ml-primary);
        margin-left: 4px;
    }

.ml-post-more {
    margin-top: 12px;
    color: var(--ml-accent);
    font-size: 13px;
    font-weight: 800;
}

    .ml-post-more i {
        transition: transform .3s var(--ml-ease);
    }

.ml-post:hover .ml-post-more i {
    transform: translateX(-5px);
}

.ml-empty a {
    margin-right: auto;
    color: var(--ml-primary);
    font-weight: 700;
}

/* phones: compact "latest articles" list and tighter cards */
@media (max-width: 575.98px) {
    .ml-page .row > [class*="col-"].mb-4 {
        margin-bottom: 14px !important;
    }

    .ml-post:not(.ml-post-lg) {
        flex-direction: row;
        align-items: stretch;
        border-radius: 16px;
    }

        .ml-post:not(.ml-post-lg) .ml-post-media {
            flex: 0 0 116px;
            aspect-ratio: auto;
            min-height: 96px;
        }

        .ml-post:not(.ml-post-lg) .ml-post-badge {
            right: 6px;
            bottom: 6px;
            max-width: calc(100% - 12px);
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            font-size: 10px;
        }

        .ml-post:not(.ml-post-lg) .ml-post-body {
            padding: 10px 12px;
        }

            .ml-post:not(.ml-post-lg) .ml-post-body h4 {
                margin-bottom: 6px;
                font-size: 13.5px;
            }

    .ml-post-lg .ml-post-media,
    .ml-cat-media {
        aspect-ratio: 16 / 8;
    }

    .ml-cat-body {
        padding: 14px 16px;
    }

        .ml-cat-body h3 {
            font-size: 16px;
        }

    .ml-hero p {
        font-size: 13px;
    }

    .ml-hero-stats {
        flex-wrap: wrap;
        justify-content: center;
    }

    .ml-section-head {
        padding: 12px 14px;
    }

    .ml-toolbar {
        margin-bottom: 14px;
    }

    .ml-search {
        max-width: none;
        flex-basis: 100%;
    }

    .ml-sort {
        width: 100%;
    }

    .ml-sort-btn {
        flex: 1;
    }
}
