@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap');

.ctd-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0 auto;
    padding: 25px 20px;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    width: 100%;
}

/* Stacked Pages effect (Kiribati style top layers) */
.ctd-category-item {
    position: relative;
    overflow: visible; /* To allow badges and stacked pages to overflow */
    background: #ffffff; /* Explicit white background */
    border: 1px solid var(--card-border, rgba(255, 77, 109, 0.15));
    width: 252px !important;
    height: 82px !important;
    flex-shrink: 0;
    
    /* Double stacked page border shadow style */
    box-shadow: 
        2px 2px 0 var(--card-border, rgba(255, 77, 109, 0.12)),
        4px 4px 0 #ffffff,
        5px 5px 0 var(--card-border, rgba(255, 77, 109, 0.12)),
        0 4px 8px rgba(0, 0, 0, 0.015);
        
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    font-family: 'Outfit', sans-serif;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    z-index: 3;
}

/* First Stacked Page top layer */
.ctd-category-item::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 8px;
    right: 8px;
    height: 100%;
    background: #ffffff;
    border: 1px solid var(--card-border, rgba(255, 77, 109, 0.15));
    border-radius: inherit;
    z-index: -1;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-sizing: border-box;
}

/* Second Stacked Page top layer */
.ctd-category-item::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 16px;
    right: 16px;
    height: 100%;
    background: #ffffff;
    border: 1px solid var(--card-border, rgba(255, 77, 109, 0.15));
    border-radius: inherit;
    z-index: -2;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-sizing: border-box;
}

/* Lift stacked card on hover and expand stack margins */
.ctd-category-item:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 8px 18px var(--card-border, rgba(255, 77, 109, 0.12)),
        0 4px 6px rgba(0, 0, 0, 0.02);
}

.ctd-category-item:hover::before {
    top: -6px;
}

.ctd-category-item:hover::after {
    top: -11px;
}

.ctd-category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none !important;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

/* Badge styling - New (Top Left) */
.ctd-badge {
    position: absolute;
    top: -8px;
    left: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    color: #ffffff;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 10;
    line-height: 1;
    display: inline-block;
}

/* Badge styling - PNG (Top Right - Small Pill style) */
.ctd-png-badge {
    position: absolute;
    top: -8px;
    right: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: #212529; /* Solid dark black pill style */
    color: #ffffff;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 10;
    line-height: 1;
    display: inline-block;
}

.ctd-category-desc, .ctd-category-date {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    max-height: 2.6em;
    width: 100%;
    margin: 0;
    color: #646970;
    font-size: 11px;
    font-weight: 500;
}

/* Lazy loading */
.ctd-lazy {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.ctd-lazy.loaded {
    opacity: 1;
}

/* Grid Header Row */
.ctd-grid-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-wrap: wrap;
    gap: 15px;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

.ctd-header-text {
    flex: 1;
    min-width: 250px;
}

.ctd-grid-title {
    margin: 0 0 5px 0 !important;
    font-weight: 700;
    line-height: 1.2;
}

.ctd-grid-subtitle {
    margin: 0 !important;
    line-height: 1.4;
}

.ctd-header-action {
    display: flex;
    align-items: center;
}

/* Action styles */
.ctd-action-btn {
    text-decoration: none !important;
    font-weight: 600;
    display: inline-block;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.ctd-action-link {
    background: none !important;
    border: none !important;
    padding: 0 !important;
}

.ctd-action-button {
    padding: 8px 18px !important;
    border-radius: 8px !important;
    text-align: center;
    border: none !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.ctd-action-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

/* Responsive Carousel Styles */
.ctd-carousel-wrapper {
    position: relative;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    padding: 20px 0; /* Space for the top badges */
}

/* Center Carousel display container, add side margins to buffer arrows */
.ctd-carousel-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    cursor: grab;
    padding: 12px 30px; /* Side padding to host arrows without overlap */
    box-sizing: border-box;
}

.ctd-carousel-container:active {
    cursor: grabbing;
}

.ctd-carousel-track {
    display: flex;
    flex-wrap: nowrap !important;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    box-sizing: border-box;
}

.ctd-carousel-track .ctd-category-item {
    flex-shrink: 0;
    box-sizing: border-box;
    margin-bottom: 0 !important;
}

/* Side navigation arrows - Perfectly centered and inside container padding */
.ctd-carousel-arrow {
    position: absolute;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: #333333 !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08) !important;
    transition: all 0.3s ease !important;
    z-index: 10;
    padding: 0 !important;
    line-height: 1 !important;
}

.ctd-carousel-arrow:hover {
    background: var(--accent-color, #007cba) !important;
    color: #ffffff !important;
    border-color: var(--accent-color, #007cba) !important;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12) !important;
}

.ctd-carousel-prev {
    left: 10px; /* Sit inside the 30px container side padding */
}

.ctd-carousel-next {
    right: 10px; /* Sit inside the 30px container side padding */
}

/* Dot pagination indicators */
.ctd-carousel-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    box-sizing: border-box;
}

.ctd-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cccccc;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ctd-carousel-dot.active {
    background: #007cba;
    width: 20px;
    border-radius: 4px;
}
