/**
 * Parent Category Carousels — stylesheet
 *
 * Design direction: quiet, high-contrast neutrals (Apple/Vercel/Linear
 * territory) with a single restrained accent used only for the interactive
 * moments — hover states, focus rings, the "View All" link. Everything is
 * namespaced under .pcc-wrapper so it never leaks into (or is overridden
 * by) the host theme.
 *
 * Typography intentionally inherits from the theme (no font-family is set
 * here) so headings/body text match the rest of the site exactly now that
 * this renders inside the same page.php grid as everything else.
 *
 * Layout: by default (.pcc-wrapper with no modifier) this fills 100% of
 * whatever contains it — the theme's .jlc-col-md-8 content column when
 * used via layout="sidebar" (the default). Add layout="full" on the
 * shortcode for the old edge-to-edge behaviour, which switches in the
 * .pcc-wrapper--full modifier below.
 */

.pcc-wrapper {
    /* ---- Color ---- */
    --pcc-bg: #ffffff;
    --pcc-ink: #0a0a0c;
    --pcc-ink-soft: #68686f;
    --pcc-ink-faint: #9a9aa1;
    --pcc-border: #e9e9ec;
    --pcc-surface: #f6f6f8;
    --pcc-accent: #4f46e5;
    --pcc-accent-ink: #ffffff;
    --pcc-shadow-rgb: 15, 15, 20;

    /* ---- Shape ---- */
    --pcc-radius-lg: 20px;
    --pcc-radius-md: 14px;
    --pcc-radius-sm: 10px;
    --pcc-radius-pill: 999px;

    /* ---- Layout ---- */
    --pcc-gutter: clamp(20px, 4vw, 20px);
    --pcc-block-gap: 56px;
    --pcc-card-gap: 20px;

    /* ---- Motion ---- */
    --pcc-ease: cubic-bezier(0.22, 0.8, 0.24, 1);
    --pcc-speed: 320ms;

    /* ---- Type ---- */

    display: block;
    color: var(--pcc-ink);
    background: var(--pcc-bg);
    /* Full width of whatever contains it by default — the theme's own
       .jlc-col-md-8 grid column already provides the gutter, so we don't
       add a second one on top of it. */
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/*
 * Opt-in modifier for layout="full": the previous edge-to-edge behaviour,
 * for placements outside the theme's page.php grid (e.g. an Elementor
 * canvas template) where the component needs to manage its own width.
 */
.pcc-wrapper--full {
    max-width: 1360px;
    margin-inline: auto;
    padding-inline: var(--pcc-gutter);
}

.pcc-wrapper *,
.pcc-wrapper *::before,
.pcc-wrapper *::after {
    box-sizing: inherit;
}

.pcc-wrapper img {
    max-width: 100%;
    display: block;
}

/* -----------------------------------------------------------------------
   Parent title
----------------------------------------------------------------------- */

.pcc-parent-header {
    padding-block: clamp(28px, 5vw, 56px) 8px;
}

.pcc-parent-title {
    font-size: clamp(2rem, 3.2vw, 2.75rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0;
}

/* -----------------------------------------------------------------------
   Category block + section header
----------------------------------------------------------------------- */

.pcc-category-block {
    padding-block: var(--pcc-block-gap);
    border-top: 1px solid var(--pcc-border);
}

.pcc-category-block:first-of-type {
    border-top: none;
}

.pcc-section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.pcc-section-heading-group {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.pcc-category-name {
    font-size: clamp(1.25rem, 1.6vw, 1.5rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
}

.pcc-article-count {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--pcc-ink-faint);
}

.pcc-view-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--pcc-ink);
    text-decoration: none;
    white-space: nowrap;
    padding-block: 4px;
    flex-shrink: 0;
}

.pcc-view-all-arrow {
    transition: transform var(--pcc-speed) var(--pcc-ease);
}

.pcc-view-all:hover,
.pcc-view-all:focus-visible {
    color: var(--pcc-accent);
}

.pcc-view-all:hover .pcc-view-all-arrow,
.pcc-view-all:focus-visible .pcc-view-all-arrow {
    transform: translateX(3px);
}

/* -----------------------------------------------------------------------
   Carousel shell + nav arrows
----------------------------------------------------------------------- */

.pcc-carousel-viewport {
    position: relative;
    /* Slide widths below are sized off THIS element's own width, not the
       viewport's. That matters now that the component can sit inside a
       jlc-col-md-8 column (~66% of the page) alongside a sidebar — sizing
       off the browser window would keep trying to cram 4 "desktop" cards
       into a column that only has room for 3. */
    container-type: inline-size;
    container-name: pcc-carousel;
}

.pcc-swiper {
    /* Let slides bleed slightly past the container edge on mobile, a
       small but deliberate cue that there is more to scroll to. */
    overflow: visible;
    padding-bottom: 4px;
}

.pcc-nav {
    position: absolute;
    top: 40%;
    transform: translateY(-50%);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--pcc-border);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    color: var(--pcc-ink) !important;
    cursor: pointer !important;
    box-shadow: 0 8px 20px -8px rgba(var(--pcc-shadow-rgb), 0.25);
    transition: background var(--pcc-speed) var(--pcc-ease),
        transform var(--pcc-speed) var(--pcc-ease),
        opacity var(--pcc-speed) var(--pcc-ease);
        padding: 0px !important;
}

.pcc-nav:hover {
    background: white !important;
    color: black !important;
    transform: translateY(-50%) scale(1.06);
}

.pcc-nav:focus-visible {
    outline: 2px solid var(--pcc-accent);
    outline-offset: 2px;
}

.pcc-nav-prev {
    left: 4px;
}

.pcc-nav-next {
    right: 4px;
}

.pcc-nav.swiper-button-disabled {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 640px) {
    /* Off-canvas circular arrows fight for space on small screens; swipe
       gestures carry the interaction there instead. */
    .pcc-nav {
        display: none;
    }
    .pcc-theme-layout>.jlc-container{
        padding: 0px 10px 0px 10px !important;
    }
}

/* -----------------------------------------------------------------------
   Post card
----------------------------------------------------------------------- */

.pcc-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: var(--pcc-radius-lg);
    overflow: hidden;
    background: var(--pcc-surface);
    transition: transform var(--pcc-speed) var(--pcc-ease),
        box-shadow var(--pcc-speed) var(--pcc-ease);
    will-change: transform;
}


.pcc-card:focus-visible {
    outline: 2px solid var(--pcc-accent);
    outline-offset: 3px;
}

.pcc-card-media {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--pcc-border);
}

.pcc-card-image {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    transition: transform 640ms var(--pcc-ease);
}

.pcc-card:hover .pcc-card-image {
    transform: scale(1.08);
}

.pcc-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #1c1c22, #3a3a44);
}

.pcc-card-placeholder span {
    font-size: 2.5rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.65);
}

.pcc-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 5px 12px;
    border-radius: var(--pcc-radius-pill);
    background: rgba(10, 10, 12, 0.55);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.pcc-card-body {
    padding: 16px 18px 18px;
}

.pcc-card-title {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.35;
    letter-spacing: -0.005em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pcc-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pcc-card-date {
    font-size: 0.8rem;
    color: var(--pcc-ink-soft);
}

.pcc-card-readmore {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--pcc-bg);
    color: var(--pcc-ink);
    flex-shrink: 0;
    transition: transform var(--pcc-speed) var(--pcc-ease),
        background var(--pcc-speed) var(--pcc-ease),
        color var(--pcc-speed) var(--pcc-ease);
}

.pcc-card:hover .pcc-card-readmore {
    background: #FA5860 !important;
    color: var(--pcc-accent-ink);
    transform: translateX(2px);
}

/* -----------------------------------------------------------------------
   Slide widths — mirrors the JS breakpoints (breakpointsBase: 'container'
   in parent-category-carousels.js) so layout never jumps once Swiper
   takes over; these rules also act as the pre-JS / no-JS fallback.

   These are keyed to the CAROUSEL'S OWN width via @container, not the
   viewport, on purpose: 1 card < 480px, 2 ≥ 480px, 3 ≥ 760px, 4 ≥ 1040px
   of *available carousel width*. With no sidebar that plateaus at 4 cards
   on a normal desktop, same as before; with the sidebar showing, the
   jlc-col-md-8 column is narrower than the viewport, so it settles on
   however many cards actually fit comfortably instead of overcrowding.
----------------------------------------------------------------------- */

.pcc-swiper .swiper-slide {
    width: 82%;
}

@container pcc-carousel (min-width: 480px) {
    .pcc-swiper .swiper-slide {
        width: calc((100% - var(--pcc-card-gap)) / 2);
    }
}

@container pcc-carousel (min-width: 760px) {
    .pcc-swiper .swiper-slide {
        width: calc((100% - (var(--pcc-card-gap) * 2)) / 3);
    }
}

@container pcc-carousel (min-width: 1040px) {
    .pcc-swiper .swiper-slide {
        width: calc((100% - (var(--pcc-card-gap) * 3)) / 4);
    }
}

/* -----------------------------------------------------------------------
   Admin-only diagnostic notice
----------------------------------------------------------------------- */

.pcc-admin-notice {
    font-size: 0.9rem;
    line-height: 1.5;
    padding: 14px 18px;
    border-radius: var(--pcc-radius-sm);
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #7c2d12;
    max-width: 100%;
    margin-block: 24px;
}

/* -----------------------------------------------------------------------
   Reduced motion
----------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .pcc-card,
    .pcc-card-image,
    .pcc-card-readmore,
    .pcc-nav,
    .pcc-view-all-arrow {
        transition: none !important;
    }

    .pcc-card:hover {
        transform: none;
    }
}
