/* =========================================================
   CORTEX BLOG CATEGORY LIST (PUBLIC LAYOUT) - BOOTSTRAP 5.3.7
   Location : /blog/blog-article-list.css
   Purpose  : Styles ONLY for /blog/category/<slug>/ listing pages.

   IMPORTANT:
     - Do NOT put CORTEX admin/tool styles in here.
     - Keep public styles scoped via .ctb-category-wrapper.
     - Category color is injected by CF on the category page:
         .ctb-category-wrapper { --blog-category-color: ...; }
   ========================================================= */


/* =========================================================
   TOKENS (SCOPED)
   ========================================================= */

.ctb-category-wrapper {
    --ctb-radius: 1rem;
    --ctb-inner-radius: calc(var(--ctb-radius) - 0.25rem);

    --ctb-border: 1px solid rgba(0,0,0,0.08);
    --ctb-soft-border: 1px solid rgba(15, 23, 42, 0.08);

    --ctb-shadow-1: 0 18px 44px rgba(0,0,0,0.10);
    --ctb-shadow-2: 0 6px 16px rgba(0,0,0,0.06);

    --ctb-title-size: 1.75rem;
    --ctb-title-weight: 950;

    --ctb-subtext: rgba(15, 23, 42, 0.62);

    --ctb-pill-font-size: .74rem;
    --ctb-pill-letter-spacing: .08em;
    --ctb-pill-pad-y: .46rem;
    --ctb-pill-pad-x: .85rem;

    --ctb-accent-width: 6px;

    --ctb-frame-bg: #f1f3f5;
    --ctb-frame-pad: 6px;

    --ctb-row-hover: rgba(15, 23, 42, 0.03);
    --ctb-row-focus: rgba(56, 121, 183, 0.18);

    --ctb-cta-bg: rgba(15, 23, 42, 0.06);
    --ctb-cta-bg-hover: rgba(15, 23, 42, 0.10);

    --ctb-accent: var(--blog-category-color, #64748b);
}


/* =========================================================
   WRAPPER + SAFE IMAGE RULE
   ========================================================= */

.ctb-category-wrapper {
    padding-top: 2.75rem;
    padding-bottom: 3.25rem;
}

.ctb-category-wrapper img.img-responsive {
    max-width: 100%;
    height: auto;
}


/* =========================================================
   HEADER CARD
   ========================================================= */

.ctb-category-header {
    position: relative;
    border-radius: var(--ctb-radius);
    border: var(--ctb-border);
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
    box-shadow: var(--ctb-shadow-1), var(--ctb-shadow-2);
    padding: 1.6rem 1.7rem;
}

/* Left accent rail (always visible) */
.ctb-category-header::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--ctb-accent-width);
    background: var(--ctb-accent);
    opacity: 0.95;
}

.ctb-category-title {
    margin: 0;
    font-size: var(--ctb-title-size);
    font-weight: var(--ctb-title-weight);
    letter-spacing: 0.01em;
    line-height: 1.12;
    color: #111827;
}

.ctb-category-title .ctb-category-title-slug {
    color: #111827;
}

.ctb-category-subhead {
    margin-top: .45rem;
    color: var(--ctb-subtext);
    font-size: .98rem;
}


/* =========================================================
   CATEGORY PILL (PUBLIC)
   Reads: background: var(--blog-category-color, #64748b)
   ========================================================= */

.blog-category-badge.ctb-category-pill {
    margin-top: .85rem;
    display: inline-flex;
    align-items: center;

    padding: var(--ctb-pill-pad-y) var(--ctb-pill-pad-x);
    padding-left: calc(var(--ctb-pill-pad-x) + 0.7rem);

    border-radius: 999px;

    font-size: var(--ctb-pill-font-size);
    font-weight: 950;
    letter-spacing: var(--ctb-pill-letter-spacing);
    text-transform: uppercase;

    color: #ffffff;
    background: var(--blog-category-color, #64748b);
    line-height: 1;

    border: 1px solid rgba(255,255,255,0.22);
    box-shadow:
        0 10px 22px rgba(15, 23, 42, 0.16),
        0 3px 10px rgba(15, 23, 42, 0.10),
        inset 0 1px 0 rgba(255,255,255,0.22);

    position: relative;
    transform: translateZ(0);
}

/* Dot (no markup change) */
.blog-category-badge.ctb-category-pill::after {
    content: "";
    width: .55rem;
    height: .55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.10);
    position: absolute;
    left: .6rem;
    top: 50%;
    transform: translateY(-50%);
}

/* Sheen */
.blog-category-badge.ctb-category-pill::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
        180deg,
        rgba(255,255,255,0.22) 0%,
        rgba(255,255,255,0.06) 48%,
        rgba(0,0,0,0.08) 100%
    );
    pointer-events: none;
    opacity: 0.85;
}


/* =========================================================
   COUNT LINE
   ========================================================= */

.ctb-category-meta {
    margin-top: 1.15rem;
}

.ctb-category-count {
    color: var(--ctb-subtext);
}


/* =========================================================
   LIST GROUP (CARD ROWS)
   ========================================================= */

.ctb-category-list {
    border-radius: var(--ctb-radius);
    border: var(--ctb-border);
    padding: var(--ctb-frame-pad);
    overflow: hidden;
    box-shadow: var(--ctb-shadow-2);

    /* Subtle tint toward the category color (Chrome-safe; falls back to frame bg) */
    background: var(--ctb-frame-bg);
    background: color-mix(in srgb, var(--ctb-accent) 7%, var(--ctb-frame-bg));
}

/* Row item */
.ctb-category-item {
    position: relative;

    border: var(--ctb-soft-border);
    border-radius: var(--ctb-inner-radius);

    padding: 1.1rem 1.2rem;
    padding-left: calc(1.2rem + var(--ctb-accent-width));

    margin: 0 0 6px 0;
    background: #ffffff;

    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.ctb-category-item:last-child {
    margin-bottom: 0;
}

/* Zebra (subtle) */
.ctb-category-item.ctb-row-odd  { background: #ffffff; }
.ctb-category-item.ctb-row-even { background: #fbfcfe; }

/* Left accent rail (HIDDEN by default; shows on hover/focus) */
.ctb-category-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;

    width: 0;
    border-radius: 999px;

    background: var(--ctb-accent);
    opacity: 0.95;

    transition: width 0.18s ease;
}

.ctb-category-item:hover::before,
.ctb-category-item:focus::before {
    width: var(--ctb-accent-width);
}

/* Hover / focus lift */
.ctb-category-item:hover,
.ctb-category-item:focus {
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(0,0,0,0.10), 0 6px 14px rgba(0,0,0,0.06);
}

.ctb-category-item:focus-visible {
    outline: 0;
    box-shadow:
        0 0 0 4px var(--ctb-row-focus),
        0 14px 30px rgba(0,0,0,0.10),
        0 6px 14px rgba(0,0,0,0.06);
}

.ctb-item-inner {
    gap: 1rem;
}

.ctb-item-title {
    font-weight: 950;
    letter-spacing: 0.01em;
    color: #111827;
    line-height: 1.2;
}

.ctb-item-meta {
    color: rgba(15, 23, 42, 0.62);
}

.ctb-meta-sep {
    margin: 0 .4rem;
    opacity: 0.7;
}

/* CTA chip */
.ctb-item-cta {
    display: inline-flex;
    align-items: center;
    gap: .35rem;

    opacity: 1;

    font-weight: 900;
    letter-spacing: 0.02em;

    padding: .48rem .8rem;
    border-radius: 999px;

    background: var(--ctb-cta-bg);
    border: 1px solid rgba(15, 23, 42, 0.10);

    transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.ctb-category-item:hover .ctb-item-cta {
    transform: translateX(2px);
    background: var(--ctb-cta-bg-hover);
    border-color: rgba(15, 23, 42, 0.14);
}


/* =========================================================
   EMPTY / ALERT BLOCK
   ========================================================= */

.ctb-category-alert {
    border-radius: var(--ctb-radius);
    box-shadow: var(--ctb-shadow-2);
}

/* =========================================================
   BACK TO BLOG LINK (CATEGORY LIST) - READMORE STYLE (LEFT)
   ========================================================= */

.ctb-category-wrapper .ctb-back-link {
    display: inline-flex;
    align-items: center;
    gap: .45rem;

    font-weight: 800;
    letter-spacing: 0.3px;
    text-decoration: none;

    color: inherit;
    opacity: 0.92;

    transition: opacity 0.15s ease, transform 0.15s ease;
}

.ctb-category-wrapper .ctb-back-link:hover,
.ctb-category-wrapper .ctb-back-link:focus {
    opacity: 1;
    transform: translateX(-2px);
    text-decoration: none;
}

.ctb-category-wrapper .ctb-back-link:focus-visible {
    outline: 2px solid rgba(0,0,0,0.25);
    outline-offset: 3px;
    border-radius: .4rem;
}

/* =========================================================
   ARROW (BACK LINK) - SHORT ICON STYLE (CSS-ONLY, LEFT)
   ---------------------------------------------------------
   - Hides the literal "←" character and draws a short arrow
   - Matches blog-readmore-arrow size/feel
   ========================================================= */

.ctb-category-wrapper .ctb-back-arrow {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 1.8rem;
    height: 2.1rem;

    line-height: 0;

    /* Hide the literal "←" character without changing HTML meaning */
    font-size: 0;

    transform-origin: 50% 55%;
    transition: transform 0.18s ease;
}

/* Short arrow shaft (mirrored) */
.ctb-category-wrapper .ctb-back-arrow::before {
    content: "";
    position: absolute;
    top: 50%;
    right: 28%;

    width: 34%;
    height: 2px;

    background: currentColor;
    transform: translateY(-50%);
}

/* Arrow head (left) */
.ctb-category-wrapper .ctb-back-arrow::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 28%;

    width: 0.62rem;
    height: 0.62rem;

    border-left: 2px solid currentColor;
    border-top: 2px solid currentColor;

    transform: translateY(-50%) rotate(-45deg);
}

.ctb-category-wrapper .ctb-back-link:hover .ctb-back-arrow,
.ctb-category-wrapper .ctb-back-link:focus .ctb-back-arrow,
.ctb-category-wrapper .ctb-back-link:focus-visible .ctb-back-arrow {
    transform: translateY(-2px) rotate(45deg);
}



/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 991px) {
    .ctb-category-title {
        font-size: 1.45rem;
    }

    .ctb-category-header {
        padding: 1.35rem 1.25rem;
    }
}

@media (max-width: 767px) {
    .ctb-category-wrapper {
        padding-top: 2rem;
        padding-bottom: 2.5rem;
    }

    .ctb-category-title {
        font-size: 1.3rem;
    }

    .ctb-category-item {
        padding: 1.05rem 1.05rem;
        padding-left: calc(1.05rem + var(--ctb-accent-width));
    }
}

/* =========================================================
   ZEBRA STRIPING – STRONGER (APPEND ONLY)
   Location : /blog/blog-article-list.css
   Scope    : .ctb-category-wrapper only
   ========================================================= */

.ctb-category-wrapper {
    /* bump contrast a bit */
    --ctb-zebra-odd:  #ffffff;
    --ctb-zebra-even: #eef2f6;   /* stronger than before */
}

/* force zebra backgrounds */
.ctb-category-wrapper .ctb-category-item.ctb-row-odd {
    background: var(--ctb-zebra-odd) !important;
}

.ctb-category-wrapper .ctb-category-item.ctb-row-even {
    background: var(--ctb-zebra-even) !important;
}

/* keep hover clearly different (still subtle) */
.ctb-category-wrapper .ctb-category-item:hover,
.ctb-category-wrapper .ctb-category-item:focus {
    background: #ffffff !important;
}

.ctb-category-pill-link,
.ctb-category-pill-link:hover,
.ctb-category-pill-link:focus,
.ctb-category-pill-link:active {
    text-decoration: none;
    color: inherit;
}

.ctb-category-pill-link {
    display: inline-flex;
}


/* =========================================================
   CTA (CATEGORY LIST) - "READ" ARROW MATCHING HOMEPAGE
   ========================================================= */

.ctb-category-wrapper .ctb-item-cta {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}

/* Arrow box (copied behavior from .blog-readmore-arrow) */
.ctb-category-wrapper .ctb-read-arrow {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 1.8rem;
    height: 2.1rem;

    line-height: 0;

    /* Hide the literal "→" character without changing HTML */
    font-size: 0;

    transform-origin: 50% 55%;
    transition: transform 0.18s ease;
}

/* Short arrow shaft */
.ctb-category-wrapper .ctb-read-arrow::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 28%;

    width: 34%;
    height: 2px;

    background: currentColor;
    transform: translateY(-50%);
}

/* Arrow head */
.ctb-category-wrapper .ctb-read-arrow::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 28%;

    width: 0.62rem;
    height: 0.62rem;

    border-right: 2px solid currentColor;
    border-top: 2px solid currentColor;

    transform: translateY(-50%) rotate(45deg);
}

/* Hover/Focus animation: when the row is hovered/focused */
.ctb-category-wrapper .ctb-category-item:hover .ctb-read-arrow,
.ctb-category-wrapper .ctb-category-item:focus .ctb-read-arrow,
.ctb-category-wrapper .ctb-category-item:focus-visible .ctb-read-arrow {
    transform: translateY(-2px) rotate(-45deg);
}


/* =========================================================
   THUMBNAIL STYLES
   ========================================================= */

.ctb-item-thumb {
    width: 120px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    flex-shrink: 0;
}

.ctb-thumb-img {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.ctb-item-right {
    margin-left: auto;
    flex-shrink: 0;
}


/* =========================================================
   MOBILE RESPONSIVE (< 768px)
   ========================================================= */

@media (max-width: 767.98px) {

    /* Wrapper spacing */
    .ctb-category-wrapper {
        padding-top: 1.5rem !important;
        padding-bottom: 2rem !important;
    }

    .ctb-category-header {
        margin-bottom: 1.5rem !important;
    }

    .ctb-category-title {
        font-size: 1.35rem;
        word-break: break-word;
    }

    .ctb-category-subhead {
        font-size: 0.875rem;
    }

    .ctb-category-list {
        border-radius: 8px;
    }

    .ctb-category-item {
        padding: 1rem;
        padding-left: 1rem;
        position: relative;
    }

    /* Remove left accent on mobile */
    .ctb-category-item::before {
        display: none;
    }

    /* Stack everything vertically */
    .ctb-item-inner {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0 !important;
    }

    /* Title first - centered */
    .ctb-item-main {
        order: 1;
        width: 100%;
        text-align: center;
        margin-bottom: 0.75rem;
    }

    .ctb-item-title {
        font-size: 1rem;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        margin-bottom: 0;
    }

    /* Thumbnail second - CENTERED */
    .ctb-item-right {
        order: 2;
        width: 100%;
        margin-left: 0;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .ctb-item-thumb {
        margin: 0 0 0.75rem 0;
    }

    /* CTA - remove pill styling on mobile, keep text + arrow */
    .ctb-item-cta {
        font-size: 0.75rem;
        padding: 0;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        gap: 0.25rem;
    }

    .ctb-read-arrow {
        width: 1.2rem;
        height: 1.4rem;
    }

    .ctb-read-arrow::before {
        width: 30%;
    }

    .ctb-read-arrow::after {
        width: 0.45rem;
        height: 0.45rem;
    }

    /* Meta info third - with decorative lines */
    .ctb-item-meta {
        order: 3;
        display: flex;
        justify-content: center;
        font-size: 0.85rem;
        padding: 0.5rem 0;
        margin: 0 1rem;
        border-top: 1px solid rgba(15, 23, 42, 0.12);
        border-bottom: 1px solid rgba(15, 23, 42, 0.12);
    }

    /* Author - bottom right corner */
    .ctb-item-author {
        position: absolute;
        bottom: 0.75rem;
        right: 1rem;
        font-size: 0.75rem;
        font-style: italic;
        opacity: 0.7;
    }

    /* Hide author from meta row on mobile (it moves to corner) */
    .ctb-item-meta .ctb-item-author,
    .ctb-item-meta .ctb-item-author + .ctb-meta-sep {
        display: none;
    }

    /* Center back links */
    .ctb-category-meta,
    .ctb-category-footer {
        text-align: center;
    }

}


/* =========================================================
   SMALL MOBILE (< 480px)
   ========================================================= */

@media (max-width: 479.98px) {

    .ctb-category-title {
        font-size: 1.2rem;
    }

    .ctb-item-title {
        font-size: 0.95rem;
    }

    .ctb-item-cta {
        font-size: 0.8rem;
        padding: 0.3rem 0.55rem;
    }

}
