/* ====================================
   CS-HEADER TOPBAR
   Top navbar: Logo + Search + CTA
   ==================================== */

.cs-header-topbar {
    background-color: var(--cs-bg-color, #fff);
    border-bottom: 1px solid var(--cs-border-color, rgba(0, 0, 0, 0.08));
    position: relative;
    z-index: 100;
}

[data-scheme="dark"] .cs-header-topbar,
.cs-header[data-scheme="dark"] .cs-header-topbar {
    background-color: var(--cs-dark-bg, #161616);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.cs-header-topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2.5rem;
    padding: 0;
    min-height: 64px;
}

/* ---- Logo ---- */
.cs-header-topbar__logo {
    flex-shrink: 0;
}

.cs-header-topbar__logo a,
.cs-topbar-logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.cs-header-topbar__logo img {
    height: 60px;
    max-height: 60px;
    width: auto;
    display: block;
    transition: filter 0.2s ease;
}

@media (min-width: 769px) {
    .cs-header .cs-header-topbar__logo img,
    .cs-header.cs-header-sticky .cs-header-topbar__logo img,
    .cs-header.cs-header-floating .cs-header-topbar__logo img,
    .cs-header .cs-logo-mobile img {
        width: auto !important;
        transform: none !important;
    }

    .cs-header .cs-logo-mobile img {
        height: 38px !important;
        max-height: 38px !important;
    }
}

[data-scheme="dark"] .cs-header-topbar__logo img,
.cs-header[data-scheme="dark"] .cs-header-topbar__logo img {
    filter: brightness(0) invert(1);
}

[data-scheme="dark"] .cs-logo-mobile .cs-logo-dark img {
    filter: brightness(0) invert(1);
}

/* ---- Footer logo: white in dark, black in light ---- */
[data-scheme="dark"] .cs-footer__logo img {
    filter: brightness(0) invert(1);
}

/* ---- Footer logo — Mobile sizing ---- */
@media (max-width: 768px) {
    .cs-footer__logo:has(img) img {
        max-width: 9rem !important;
        height: auto !important;
    }
}

/* ---- Search Bar ---- */
.cs-header-topbar__search {
    flex: 1;
    max-width: none !important;
    min-width: 0;
}

.cs-search__form {
    display: flex;
    width: 100%;
}

.cs-search__form-group {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
}

.cs-search__input {
    flex: 1;
    height: 48px;
    padding: 0 20px;
    border: none;
    background-color: var(--cs-search-bg, #f3f3f3);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    color: var(--cs-text-color, #1a1a2e);
    outline: none;
    transition:
        background-color 0.2s ease,
        box-shadow 0.2s ease;
}

.cs-search__input::placeholder {
    color: var(--cs-text-muted, #999);
    font-weight: 400 !important;
}

.cs-search__input:focus {
    background-color: var(--cs-search-bg-focus, #eee);
    box-shadow: inset 0 0 0 1px var(--cs-primary-color, #008cff);
}

[data-scheme="dark"] .cs-search__input,
.cs-header[data-scheme="dark"] .cs-search__input {
    background-color: #fff;
    color: #1a1a2e;
}

[data-scheme="dark"] .cs-search__input::placeholder,
.cs-header[data-scheme="dark"] .cs-search__input::placeholder {
    color: #999;
}

[data-scheme="dark"] .cs-search__input:focus,
.cs-header[data-scheme="dark"] .cs-search__input:focus {
    background-color: #fff;
    box-shadow: inset 0 0 0 1px var(--cs-primary-color, #008cff);
}

/* ---- Search Submit Button (inside bar) ---- */
.cs-header-topbar__search .cs-search__form-group {
    position: relative;
}

.cs-header-topbar__search .cs-search__input {
    padding-right: 70px;
}

.cs-header-topbar__search .cs-search__submit {
    position: absolute;
    right: 0;
    top: 0;
    display: inline-flex;
    align-items: center;
    height: 48px;
    padding: 0 16px;
    border: none;
    background-color: transparent;
    color: #999;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border-radius: 0 4px 4px 0;
    transition: color 0.2s ease;
    overflow: hidden;
    white-space: nowrap;
}

.cs-header-topbar__search .cs-search__submit:hover {
    color: var(--cs-primary-color, #008cff);
}

.cs-search__icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.cs-search__btn-text {
    display: inline;
    line-height: 1.2;
}

.cs-search__btn-text span:last-child {
    display: none;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 768px) {
    .cs-search__form-container .cs-search__submit {
        pointer-events: none !important;
        cursor: default !important;
    }

    .cs-search__form-container .cs-search__submit .cs-search__btn-text {
        display: none !important;
    }

    .cs-search__form-container .cs-search__submit .cs-icon-search {
        opacity: 0.6;
    }
}

[data-scheme="dark"] .cs-header-topbar__search .cs-search__submit {
    color: #999;
}

[data-scheme="dark"] .cs-header-topbar__search .cs-search__submit:hover {
    color: var(--cs-primary-color, #008cff);
}

/* ---- CTA Button ---- */
.cs-header-topbar__cta {
    flex-shrink: 0;
}

.cs-topbar-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 0 28px;
    background-color: var(--cs-primary-color, #008cff);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    transition:
        background-color 0.2s ease,
        transform 0.15s ease;
}

.cs-topbar-cta-btn:hover {
    background-color: var(--cs-primary-hover, #0074d4);
    transform: translateY(-1px);
}

.cs-topbar-cta-btn:active {
    transform: translateY(0);
}

/* Animated text */
.cs-topbar-cta-btn__text {
    overflow: hidden;
    display: inline-flex;
    flex-direction: column;
    height: 1.2em;
    line-height: 1.2;
    position: relative;
}

.cs-topbar-cta-btn__text span {
    display: block;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cs-topbar-cta-btn:hover .cs-topbar-cta-btn__text span {
    transform: translateY(-100%);
}

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

@media (max-width: 1024px) {
    .cs-header-topbar__search {
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .cs-header-topbar__inner {
        gap: 12px;
        padding: 12px 0;
    }

    .cs-header-topbar__search {
        display: none;
        /* Hide search on mobile — use mobile menu search */
    }

    .cs-topbar-cta-btn {
        height: 40px;
        padding: 0 16px;
        font-size: 13px;
    }
}

/* ====================================
   META — always single line
   ==================================== */

.cs-entry__post-meta,
.cs-entry__meta,
.cs-entry__meta-content,
.cs-entry__meta-category,
.cs-entry__meta-date,
.cs-entry__meta-author {
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cs-entry__post-meta > *,
.cs-entry__meta > *,
.cs-entry__meta-content > * {
    flex-shrink: 0;
}

/* ====================================
   OFFCANVAS & BURGER MENU POSITIONING
   Ensure menus open BELOW the full header
   (topbar + nav row) instead of overlapping it
   ==================================== */

/*
 * The original theme positions .cs-offcanvas at top:0 and
 * .cs-burger-menu at top: var(--cs-header-initial-height, 71px).
 * Since we added a topbar row, the total header is taller.
 * We use the full header height so menus open below both rows.
 */

.cs-offcanvas {
    /* Position fixed, slide from left, start below the full header + extra spacing */
    top: calc(var(--cs-header-full-height, 140px) + 30px) !important;
    height: calc(100vh - var(--cs-header-full-height, 140px) - 30px) !important;
}

.cs-burger-menu {
    /* Position the burger dropdown below the full header + extra spacing */
    top: calc(var(--cs-header-full-height, 140px) + 30px) !important;
    max-height: calc(
        100vh - var(--cs-header-full-height, 140px) - 30px
    ) !important;
}

/* Keep the header above menus so close button & nav stay clickable */
.cs-offcanvas-active .cs-header,
.cs-burger-active .cs-header {
    z-index: 120;
}

/* Also ensure overlay sits below the header */
.cs-site-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 105;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.3s ease,
        visibility 0.3s ease;
}

.cs-offcanvas-active .cs-site-overlay {
    opacity: 1;
    visibility: visible;
}

/* On mobile, overlay behind offcanvas but above header */
@media (max-width: 768px) {
    .cs-offcanvas-active .cs-site-overlay {
        z-index: 125;
    }
}

/* Hide topbar on mobile for a cleaner mobile header */
@media (max-width: 768px) {
    .cs-header-topbar {
        display: none;
    }

    /* On mobile, offcanvas is fullscreen — covers the header */
    .cs-offcanvas {
        top: 0 !important;
        height: 100vh !important;
        height: 100dvh !important;
        z-index: 130 !important;
    }

    .cs-burger-menu {
        top: var(--cs-header-initial-height, 71px) !important;
        max-height: calc(
            100vh - var(--cs-header-initial-height, 71px)
        ) !important;
    }
}

/* ====================================
   ADVERTISEMENT BANNER — visible on mobile
   ==================================== */

.cs-banner-entry {
    display: block !important;
}

/* ====================================
   TOPBAR BORDER — Thicker separator line
   ==================================== */

.cs-header-topbar {
    border-bottom-width: 2px !important;
    padding: 0 !important;
}

/* Light mode — black border */
body[data-scheme="light"] .cs-header-topbar {
    border-bottom-color: #000 !important;
}

/* ====================================
   BURGER MENU — Desktop positioning fix
   ==================================== */

@media (min-width: 1400px) {
    .cs-burger-menu {
        top: 72px !important;
        max-height: calc(100vh - 113px) !important;
    }

    /* Homepage latest articles section — bottom margin */
    .elementor-element-aa6f4c5 {
        margin-bottom: 7rem !important;
    }

    /* Sidebar placeholder image — visible */
    .widget_block .wp-block-image.size-full {
        display: block !important;
    }

    .widget_block .wp-block-image.size-full img {
        display: block !important;
        width: 100% !important;
        height: auto !important;
    }

    /* Most Popular section — remove top margin */
    .elementor-2236 .elementor-element.elementor-element-68d1e28 {
        --margin-top: 0px !important;
    }

    /* Most Popular section — tile card (center column, first article) */
    [data-id="5ca8403"] .cs-entry__title {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }
}

/* ====================================
   RECOMMENDED FOR YOU — article show
   Ensure images are visible in cards
   ==================================== */

.cs-read-next__item .cs-overlay-background {
    display: block !important;
    background-size: cover !important;
    background-position: center !important;
}

.cs-read-next__item .cs-entry__thumbnail {
    display: block !important;
    overflow: hidden !important;
}

.cs-read-next__item .wp-post-image {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    object-fit: cover !important;
}

/* ====================================
   RECOMMENDED FOR YOU — margin bottom
   ==================================== */

@media (max-width: 991px) {
    /* Most Popular section — remove top margin on tablet */
    .elementor-2236 .elementor-element.elementor-element-68d1e28 {
        --margin-top: 0px !important;
    }
}

.cs-post-carousel {
    margin-bottom: 6rem !important;
}
