/* =========================================================
   CORTEX BLOG HOMEPAGE (PUBLIC LAYOUT) - BOOTSTRAP 5.3.7
   Location : /blog/blog-home-layout.css
   Purpose  : Styles ONLY for the LIVE blog homepage layout.
              Designed to work WITH Bootstrap 5 cards/grid.

   IMPORTANT:
     - Do NOT put CORTEX admin/tool styles in here.
     - Do NOT put article-page styles in here.
     - Position 1 uses a TRUE HERO style (bigger media + typography).
     - Latest cards are smaller/consistent in the grid.
   ========================================================= */


/* =========================================================
   ROOT VARIABLES
   ---------------------------------------------------------
   Notes:
   - Outer .blog-panel provides overall radius/shadow.
   - Gray "frame" wraps both media and content areas.
   - Inner white card nests inside frame to prevent corner wedges.
   - Category pills use CSS variable --blog-category-color (set per slug).
   ========================================================= */

:root {
    --blog-panel-radius: 1rem;

    --blog-panel-border: 1px solid rgba(0,0,0,0.06);
    --blog-inner-border: 1px solid rgba(0,0,0,0.06);

    --blog-panel-shadow-1: 0 10px 26px rgba(0, 0, 0, 0.10);
    --blog-panel-shadow-2: 0 3px 10px rgba(0, 0, 0, 0.06);

    --blog-frame-bg: #f1f3f5;
    --blog-frame-pad: 4px;

    --blog-inner-radius: calc(var(--blog-panel-radius) - 0.25rem);

    /* Content padding */
    --blog-hero-pad: 2rem;
    --blog-card-pad: 1.25rem;

    /* Media heights */
    --blog-hero-media-height: 420px;
    --blog-card-media-height: 240px;

    /* Category pill tuning */
    --blog-pill-font-size: .72rem;
    --blog-pill-letter-spacing: .07em;
    --blog-pill-pad-y: .45rem;
    --blog-pill-pad-x: .78rem;

    /* Sidebar tuning */
    --blog-sidebar-pad: 1.25rem;
    --blog-sidebar-gap: .9rem;
    --blog-sidebar-divider: 1px solid rgba(15, 23, 42, 0.10);
    --blog-sidebar-soft: rgba(255,255,255,0.62);
    --blog-sidebar-glass: rgba(255,255,255,0.72);
    --blog-sidebar-shadow: 0 18px 44px rgba(0,0,0,0.12), 0 8px 18px rgba(0,0,0,0.08);
}


/* =========================================================
   PAGE WRAPPER
   ========================================================= */

.blog-home-wrapper {
    padding-top: 2.5rem;
    padding-bottom: 3rem;
}

.blog-home-empty {
    font-size: 1rem;
    color: #6c757d;
}

/* Helps prevent odd global img rules from legacy code */
.blog-home-wrapper img.img-responsive {
    max-width: 100%;
    height: auto;
}


/* =========================================================
   BASE PANEL / CARD LOOK
   Applies to: HERO, LATEST cards, SIDEBAR
   ========================================================= */

.blog-panel {
    border: var(--blog-panel-border);
    border-radius: var(--blog-panel-radius);
    background: #ffffff;
    box-shadow: var(--blog-panel-shadow-1), var(--blog-panel-shadow-2);
}


/* =========================================================
   UNIFIED "FRAME + INNER CARD" SYSTEM
   Applies to: HERO + LATEST post cards
   ========================================================= */

/* The content area's gray frame (force parity with media frame) */
.blog-post-card .card-body {
    background: var(--blog-frame-bg) !important;
    padding: var(--blog-frame-pad) !important;
    box-sizing: border-box;
}

/* Inner white content card */
.blog-post-card .blog-content-card {
    background: #ffffff;
    border: var(--blog-inner-border);
    border-radius: var(--blog-inner-radius);
    box-sizing: border-box;
    margin: 0;
    height: 100%;
}

/* Latest cards need flex so CTA can sit at bottom */
.blog-card .blog-content-card {
    display: flex;
    flex-direction: column;
}


/* =========================================================
   MEDIA (TOP AREA): FRAME + INNER MEDIA CARD
   ========================================================= */

.blog-hero-media,
.blog-card-media {
    background: var(--blog-frame-bg);
    padding: var(--blog-frame-pad);
    overflow: hidden;

    display: flex;
    align-items: center;
    justify-content: center;

    box-sizing: border-box;

    border-top-left-radius: var(--blog-panel-radius);
    border-top-right-radius: var(--blog-panel-radius);
}

.blog-hero-media { height: var(--blog-hero-media-height); }
.blog-card-media { height: var(--blog-card-media-height); }

/* Inner white “image card” */
.blog-media-card {
    width: 100%;
    height: 100%;

    background: #ffffff;
    border: var(--blog-inner-border);
    border-radius: var(--blog-inner-radius);
    overflow: hidden;

    display: flex;
    align-items: center;
    justify-content: center;

    box-sizing: border-box;
}

/* Default image behavior: cover */
.blog-hero-image,
.blog-card-image {
    width: 100%;
    height: 100%;
    display: block;

    object-fit: cover;
    object-position: center;

    transition: transform 0.4s ease;
}

/* Placeholder behavior: contain */
.blog-media-placeholder .blog-hero-image,
.blog-media-placeholder .blog-card-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}


/* =========================================================
   CONTENT PADDING (HERO VS LATEST)
   ========================================================= */

.blog-hero-card .blog-content-card {
    padding: var(--blog-hero-pad);
}

.blog-card .blog-content-card {
    padding: var(--blog-card-pad);
}

.blog-post-card .card-body {
    border-bottom-left-radius: var(--blog-panel-radius);
    border-bottom-right-radius: var(--blog-panel-radius);
}


/* =========================================================
   TYPOGRAPHY
   ========================================================= */

.blog-card-title {
    font-weight: 800;
    line-height: 1.15;
    margin: 0;
}

/* HERO title */
.blog-hero-card .blog-card-title {
    font-size: 1.9rem;
    padding-top: 12px;
    color: #212529;
}

/* LATEST title */
.blog-card .blog-card-title {
    font-size: 1.25rem;
    padding-top: 10px;
}

.blog-card-text {
    color: #6c757d;
}

.blog-card-lead {
    font-style: italic;
    padding-bottom: 14px;
}

/* HERO lead slightly larger */
.blog-hero-card .blog-card-lead {
    font-size: 1.05rem;
}


/* =========================================================
   CATEGORY BADGES (HOMEPAGE) - PREMIUM CHIP STYLE
   ---------------------------------------------------------
   - Keeps your existing --blog-category-color pipeline
   - Adds a color dot (bigger) for quick scanning
   - Calmer typography + subtle depth (non-cartoon)
   ========================================================= */

.blog-category-badge {
    --blog-category-color: #64748b;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* space between dot + label */

    padding: 7px 12px;
    border-radius: 999px;

    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: none;
    line-height: 1;

    color: rgba(15, 23, 42, 0.88);
    background: rgba(255,255,255,0.55);

    border: 1px solid rgba(15, 23, 42, 0.12);

    /* inner color ring */
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.60),
        inset 0 0 0 2px var(--blog-category-color),
        0 10px 20px rgba(0,0,0,0.08);

    position: relative;
    transform: translateZ(0);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

/* Bigger dot */
.blog-category-badge::before {
    content: "";
    width: 10px;              /* dot size */
    height: 10px;             /* dot size */
    border-radius: 999px;
    background: var(--blog-category-color);

    /* tiny highlight so it feels “designed” not “cartoon” */
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.55),
        0 0 0 1px rgba(15, 23, 42, 0.10);
}

/* =========================================================
   CATEGORY BADGE HOVER - “CARTOON / STICKER” ONLY ON HOVER
   ---------------------------------------------------------
   - Rest state stays premium chip
   - Hover/focus switches to the old glossy badge look
   ========================================================= */

/* Add an overlay layer (off by default) */
.blog-category-badge::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;

    /* sheen */
    background: linear-gradient(
        180deg,
        rgba(255,255,255,0.28) 0%,
        rgba(255,255,255,0.10) 45%,
        rgba(0,0,0,0.10) 100%
    );

    opacity: 0;
    transition: opacity 0.18s ease;
}

/* Hover / keyboard focus = sticker mode */
.blog-category-badge:hover,
.blog-category-badge:focus-visible {
    color: rgba(255,255,255,0.96);
    background: var(--blog-category-color);
    border: 1px solid rgba(255,255,255,0.22);

    box-shadow:
        0 14px 28px rgba(15, 23, 42, 0.22),
        0 6px 16px rgba(15, 23, 42, 0.14),
        inset 0 1px 0 rgba(255,255,255,0.24);

    transform: translateY(-1px);
    filter: saturate(1.08);
}

/* Turn the sheen on ONLY during hover/focus */
.blog-category-badge:hover::after,
.blog-category-badge:focus-visible::after {
    opacity: 0.9;
}

/* Dot flips to “highlight” on hover so it pops */
.blog-category-badge:hover::before,
.blog-category-badge:focus-visible::before {
    background: rgba(255,255,255,0.95);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.65),
        0 0 0 2px rgba(255,255,255,0.22);
}

/* =========================================================
   MICRO BOUNCE (SUBTLE) - CATEGORY BADGES
   ========================================================= */

.blog-category-badge {
    /* Add transform to the transition so the bounce is smooth */
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        filter 0.18s ease;
}

/* Slight “lift” + tiny bounce */
.blog-category-badge:hover,
.blog-category-badge:focus-visible {
    animation: blogPillMicroBounce 240ms ease-out 1;
}

/* Keyframes: tiny up → settle */
@keyframes blogPillMicroBounce {
    0%   { transform: translateY(0); }
    45%  { transform: translateY(-2px); }
    100% { transform: translateY(-1px); }
}


/* =========================================================
   STRETCHED-LINK ESCAPE - CLICKABLE ELEMENTS
   ---------------------------------------------------------
   When card CTA type is "card", the entire card becomes
   clickable via Bootstrap's stretched-link (z-index: 1).
   These elements need z-index: 2 to remain clickable
   above the stretched-link overlay.
   ========================================================= */

.ctb-category-pill-link,
.blog-readmore-link,
.blog-post-card .btn.btn-primary {
    position: relative;
    z-index: 2;
}


/* =========================================================
   AUTHOR AVATARS / LIST (HOMEPAGE)
   ---------------------------------------------------------
   Stack name + date
   ========================================================= */

.blog-author-list {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem .75rem;
    margin: 0;
    padding: 0;
    list-style: none;
    flex: 0 0 auto;
}

.blog-author-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    white-space: nowrap;
}

.blog-author-avatar {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 2px solid rgba(0,0,0,0.0);
    background: #ffffff;
    object-fit: cover;
    display: block;
    margin-top: 10px;
}

.blog-author-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.blog-author-name {
    font-size: .92rem;
    font-weight: 300;
    color: #212529;
    line-height: 1;
    display: block;
    margin-top: 18px;
}

.blog-author-date {
    display: block;
    margin-top: 3px;
    font-size: .82rem;
    font-style: italic;
    color: rgba(15, 23, 42, 0.55);
}


/* =========================================================
   BUTTONS (HERO + LATEST)
   ========================================================= */

.blog-post-card .btn {
    font-weight: 800;
    letter-spacing: 0.3px;
    border-radius: .85rem;
    padding-top: .6rem;
    padding-bottom: .6rem;

    transition: transform 0.2s ease, box-shadow 0.2s ease;
}


/* =========================================================
   CTA: READ MORE LINK (TEXT + ARROW)
   Used when buttonText == "__READMORE__"
   ========================================================= */

.blog-readmore-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;
}

.blog-readmore-link:hover,
.blog-readmore-link:focus {
    opacity: 1;
    transform: translateX(2px);
    text-decoration: none;
}

.blog-readmore-link:focus-visible {
    outline: 2px solid rgba(0,0,0,0.25);
    outline-offset: 3px;
    border-radius: .4rem;
}

/* =========================================================
   ARROW (READ MORE) - SHORT ICON STYLE (CSS-ONLY)
   ---------------------------------------------------------
   - Hides the text arrow character and draws a short arrow
   - Adds a subtle rounded-square "box" feel
   - Keeps your existing hover rotate behavior
   ========================================================= */

.blog-readmore-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 */
.blog-readmore-arrow::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 28%;

    width: 34%;
    height: 2px;

    background: currentColor;
    transform: translateY(-50%);
}

/* Arrow head */
.blog-readmore-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);
}

.blog-readmore-link:hover .blog-readmore-arrow,
.blog-readmore-link:focus .blog-readmore-arrow,
.blog-readmore-link:focus-visible .blog-readmore-arrow {
    transform: translateY(-2px) rotate(-45deg);
}


/* =========================================================
   LATEST GRID
   ========================================================= */

.blog-home-wrapper .blog-latest-grid {
    justify-content: center;
}

.blog-home-wrapper .blog-latest-grid > [class*="col-"] {
    display: flex;
}

.blog-card {
    width: 100%;
}


/* =========================================================
   SIDEBAR (UPGRADED - GLASS + INTERACTIVE ROWS)
   ========================================================= */

.blog-sidebar {
    box-shadow: var(--blog-sidebar-shadow);
}

.blog-sidebar-body {
    padding: var(--blog-sidebar-pad);
    position: relative;
}

/* Subtle glass layer inside the card */
.blog-sidebar-body::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--blog-panel-radius);
    background: linear-gradient(
        180deg,
        var(--blog-sidebar-glass) 0%,
        rgba(255,255,255,0.60) 40%,
        rgba(255,255,255,0.78) 100%
    );
    pointer-events: none;
}

.blog-sidebar-body > * {
    position: relative;
    z-index: 1;
}

/* Header */
.blog-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: .9rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.10);
}

.blog-sidebar-title {
    font-weight: 950;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(15, 23, 42, 0.90);
    font-size: 26px;
}

/* List container */
.blog-sidebar-list {
    border-radius: .9rem;
    overflow: hidden;
    background: rgba(255,255,255,0.55);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

/* Rows */
.blog-sidebar-item {
    background: transparent;
    padding: .95rem 1rem;
    border-color: rgba(15, 23, 42, 0.10);
    transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.blog-sidebar-item:first-child {
    border-top: 0;
}

.blog-sidebar-item:hover {
    background: rgba(255,255,255,0.78);
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.10);
}

/* Left / Right alignment helpers (future-proof hooks) */
.blog-sidebar-left,
.blog-sidebar-right {
    display: flex;
    align-items: center;
}

/* Pills in the sidebar look slightly more “button-like” */
.blog-sidebar-pill {
    margin-left: 0;
    transform: translateZ(0);
}

/* Counts become a “chip” instead of a plain badge */
.blog-sidebar-count {
    font-weight: 900;
    min-width: 2.25rem;
    text-align: center;

    border-radius: .7rem;
    padding: .42rem .55rem;

    background: rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(15, 23, 42, 0.10);
    color: rgba(15, 23, 42, 0.80);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.65);
}


/* =========================================================
   CARD HOVER INTERACTIONS (HERO + LATEST)
   ========================================================= */

.blog-post-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* Keep media clipping ONLY where needed */
.blog-post-card .blog-media-card {
    overflow: hidden;
}

/* Allow content to breathe (prevents author list clipping) */
.blog-post-card.blog-panel {
    overflow: visible;
}

.blog-post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 34px rgba(0,0,0,0.14), 0 6px 14px rgba(0,0,0,0.08);
}

.blog-post-card:hover .blog-hero-image,
.blog-post-card:hover .blog-card-image {
    transform: scale(1.06);
}

.blog-post-card:hover .btn {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.18);
}

.blog-post-card:hover .blog-readmore-link {
    transform: translateX(3px);
    opacity: 1;
}

.blog-post-card:hover .blog-category-badge {
    transform: translateY(-1px);
    box-shadow:
        0 14px 28px rgba(0,0,0,0.10),
        0 6px 16px rgba(0,0,0,0.06),
        inset 0 1px 0 rgba(255,255,255,0.70);
    filter: none;
}

/* =========================================================
   HERO EMPHASIS
   ========================================================= */

.blog-hero-card {
    box-shadow: 0 18px 44px rgba(0,0,0,0.18), 0 8px 18px rgba(0,0,0,0.10);
}


/* =========================================================
   HERO → LATEST SPACING
   ========================================================= */

.blog-home-wrapper > .container-xl > .row:first-of-type {
    margin-bottom: 4rem;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 991px) {
    :root {
        --blog-hero-media-height: 300px;
    }

    .blog-hero-card .blog-card-title {
        font-size: 1.75rem;
    }
}

@media (max-width: 767px) {
    .blog-home-wrapper {
        padding-top: 1.75rem;
        padding-bottom: 2.25rem;
    }

    :root {
        --blog-hero-media-height: 250px;
        --blog-card-media-height: 220px;
    }

    .blog-hero-card .blog-card-title {
        font-size: 1.5rem;
    }

    .blog-card .blog-card-title {
        font-size: 1.15rem;
    }
}



/* =========================================================
   BLOG META (DATE + READ TIME) - DIVIDER STYLE
   Targets: .blog-post-meta .blog-meta-item
   ========================================================= */

.blog-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2.5rem;
    align-items: center;

    padding: .55rem 0;
    border-top: 1px solid rgba(15, 23, 42, 0.10);
    border-bottom: 1px solid rgba(15, 23, 42, 0.10);
    margin-top: 25px;
}

.blog-post-meta .blog-meta-item {
    display: inline-flex;
    align-items: center;
    gap: .45rem;

    padding: 0;
    border: 0;
    background: transparent;

    font-size: .9rem;
    line-height: 1;
    font-weight: 400;

    color: rgba(15, 23, 42, 0.72);
}

.blog-post-meta .blog-meta-item i {
    font-size: .95rem;
    line-height: 1;
    opacity: .65;
}

@media (max-width: 575px) {
    .blog-post-meta {
        gap: .75rem;
        padding: .5rem 0;
    }

    .blog-post-meta .blog-meta-item {
        font-size: .85rem;
    }
}



.h1-blog-title{
    font-size: 2.3rem;
}


/* =========================================================
   CATEGORY BADGES - CARD OVERRIDE (HERO + LATEST ONLY) - FLAT
   ---------------------------------------------------------
   - Applies ONLY when .blog-card-pill is present
   - Dot + text = solid category color
   - Background = transparent tint
   - Border = transparent tint
   - NO shadows (flat design)
   ========================================================= */

.blog-category-badge.blog-card-pill {
    font-size: 10px;
    padding: 5px 9px;
    gap: 6px;

    letter-spacing: 0.2px;
    font-weight: 400;

    /* Text = solid category color */
    color: var(--blog-category-color);

    /* Background tint */
    background: rgba(0,0,0,0.0);
    background: color-mix(in srgb, var(--blog-category-color) 10%, transparent);

    /* Border tint */
    border: 1px solid rgba(0,0,0,0.0);
    border-color: color-mix(in srgb, var(--blog-category-color) 5%, transparent);

    /* FLAT: remove all depth */
    box-shadow: none !important;
    filter: none;
    transform: none;
}

.blog-category-badge.blog-card-pill::before {
    width: 8px;
    height: 8px;

    /* Dot = solid category color */
    background: var(--blog-category-color);

    /* FLAT */
    box-shadow: none !important;
}

/* Hover: sticker mode still OK, but FLAT (no shadow / no lift) */
.blog-category-badge.blog-card-pill:hover,
.blog-category-badge.blog-card-pill:focus-visible {
    color: rgba(255,255,255,0.96);
    background: var(--blog-category-color);
    border-color: rgba(255,255,255,0.25);

    /* FLAT */
    box-shadow: none !important;
    filter: none;
    transform: none;
}

.blog-category-badge.blog-card-pill:hover::before,
.blog-category-badge.blog-card-pill:focus-visible::before {
    background: rgba(255,255,255,0.95);
    box-shadow: none !important;
}

/* =========================================================
   CATEGORY BADGES - SIDEBAR OVERRIDE (RIGHT PANEL) - FLAT + BIGGER
   ---------------------------------------------------------
   Goal:
   - Match .blog-card-pill look nearly exactly
   - Only difference: bigger sizing for sidebar readability
   - Scoped to .blog-sidebar so card pills are not affected
   ========================================================= */

.blog-sidebar .blog-category-badge {
    font-size: 13px;
    padding: 7px 12px;
    gap: 8px;

    letter-spacing: 0.2px;
    font-weight: 900;

    /* Text = solid category color */
    color: var(--blog-category-color);

    /* Background tint */
    background: rgba(0,0,0,0.0);
    background: color-mix(in srgb, var(--blog-category-color) 15%, transparent);

    /* Border tint */
    border: 1px solid rgba(0,0,0,0.0);
    border-color: color-mix(in srgb, var(--blog-category-color) 25%, transparent);

    /* FLAT: remove all depth */
    box-shadow: none !important;
    filter: none;
    transform: none;
}

.blog-sidebar .blog-category-badge::before {
    width: 10px;
    height: 10px;

    /* Dot = solid category color */
    background: var(--blog-category-color);

    /* FLAT */
    box-shadow: none !important;
}

/* Hover: same behavior as card pill (flat, no lift, no shadow) */
.blog-sidebar .blog-category-badge:hover,
.blog-sidebar .blog-category-badge:focus-visible {
    color: rgba(255,255,255,0.96);
    background: var(--blog-category-color);
    border-color: rgba(255,255,255,0.25);

    /* FLAT */
    box-shadow: none !important;
    filter: none;
    transform: none;
}

.blog-sidebar .blog-category-badge:hover::before,
.blog-sidebar .blog-category-badge:focus-visible::before {
    background: rgba(255,255,255,0.95);
    box-shadow: none !important;
}
