/**
 * akuajae views — Structural & Base CSS
 *
 * Menggunakan CSS Custom Properties (--cv-columns) yang di-inject
 * dari PHP/JS agar kolom bisa dikontrol penuh dari Elementor panel.
 *
 * @author Bli Ajae (Ahmad Jaelani)
 * @package ContentViews
 * @version 2.0.0
 */

/* ==========================================================================
   BASE LAYOUT WRAPPER
   ========================================================================== */

.cv-layout {
    --cv-columns: 3;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

/* ==========================================================================
   GRID LAYOUT
   ========================================================================== */

.cv-layout-grid > .cv-card,
.cv-layout-grid > .cv-skeleton-card {
    flex: 0 0 calc((100% - (var(--cv-columns) - 1) * 20px) / var(--cv-columns));
    max-width: calc((100% - (var(--cv-columns) - 1) * 20px) / var(--cv-columns));
    min-width: 0;
}

/* ==========================================================================
   MASONRY LAYOUT
   ========================================================================== */

.cv-layout-masonry {
    display: block;
    columns: var(--cv-columns, 3);
    column-gap: 20px;
    gap: unset;
}

.cv-layout-masonry > .cv-card {
    break-inside: avoid;
    margin-bottom: 20px;
    width: 100%;
}

.cv-layout-masonry .cv-skeleton-card {
    break-inside: avoid;
    margin-bottom: 20px;
    width: 100%;
}

/* ==========================================================================
   MAGAZINE LAYOUT
   ========================================================================== */

.cv-layout-magazine {
    display: grid;
    grid-template-columns: repeat(var(--cv-columns, 3), 1fr);
    gap: 20px;
}

.cv-layout-magazine > .cv-card:first-child,
.cv-layout-magazine > .cv-skeleton-card:first-child {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: row;
    gap: 24px;
}

.cv-layout-magazine > .cv-card:first-child .cv-card-media {
    flex: 0 0 55%;
    margin-bottom: 0;
}

.cv-layout-magazine > .cv-card:first-child .cv-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cv-layout-magazine > .cv-card:first-child .cv-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.cv-layout-magazine > .cv-card:not(:first-child),
.cv-layout-magazine > .cv-skeleton-card:not(:first-child) {
    grid-column: auto;
}

/* ==========================================================================
   LIST LAYOUT
   ========================================================================== */

.cv-layout-list {
    flex-direction: column;
}

.cv-layout-list .cv-card,
.cv-layout-list .cv-skeleton-card {
    display: flex;
    flex-direction: row;
    gap: 20px;
    width: 100%;
}

.cv-layout-list .cv-card-media,
.cv-layout-list .cv-skeleton-img {
    width: 30%;
    flex-shrink: 0;
}

.cv-layout-list .cv-card-content,
.cv-layout-list .cv-skeleton-content {
    flex: 1;
    min-width: 0;
}

/* ==========================================================================
   CAROUSEL LAYOUT
   ========================================================================== */

.cv-layout-carousel {
    display: block;
    overflow: hidden;
}

/* ==========================================================================
   CARD BASE
   ========================================================================== */

.cv-card {
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
}

/* Entire-card click overlay */
.cv-card--clickable-whole {
    position: relative;
}

.cv-card-link-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: block;
    text-decoration: none;
    color: transparent;
    cursor: pointer;
}

.cv-card-image-link,
.cv-card-excerpt-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.cv-card-button,
.cv-card-meta,
.cv-meta-category a {
    position: relative;
    z-index: 2;
}

.cv-card:hover {
    transform: translateY(-4px); /* default — overridden by Elementor control */
}

/* ==========================================================================
   IMAGE / MEDIA — Fix: overflow:hidden on wrapper for proper border-radius
   clipping during hover zoom effects.
   ========================================================================== */

.cv-card-media {
    overflow: hidden;   /* Clips image during zoom — must stay on wrapper */
    flex-shrink: 0;
    position: relative;
}

/* Default: no object sizing (set by Elementor height control) */
.cv-card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --------------------------------------------------------------------------
   Image Hover Effects — applied via class on .cv-card-media
   -------------------------------------------------------------------------- */

/* Zoom In (default) */
.cv-img-effect-zoom_in img {
    transform: scale(1);
    transition: transform 0.5s ease;
}
.cv-card:hover .cv-img-effect-zoom_in img {
    transform: scale(var(--cv-hover-scale, 1.08));
}

/* Zoom Out — starts zoomed, shrinks on hover */
.cv-img-effect-zoom_out img {
    transform: scale(var(--cv-hover-scale, 1.08));
    transition: transform 0.5s ease;
}
.cv-card:hover .cv-img-effect-zoom_out img {
    transform: scale(1);
}

/* Pan — shifts horizontally */
.cv-img-effect-pan img {
    transform: translateX(-4%);
    transition: transform 0.6s ease;
}
.cv-card:hover .cv-img-effect-pan img {
    transform: translateX(4%);
}

/* Fade — dims on hover */
.cv-img-effect-fade img {
    transition: opacity 0.4s ease;
}
.cv-card:hover .cv-img-effect-fade img {
    opacity: 0.75;
}

/* None — no effect */
.cv-img-effect-none img {
    transition: none;
}
.cv-card:hover .cv-img-effect-none img {
    transform: none;
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Placeholder (no featured image)
   -------------------------------------------------------------------------- */

.cv-placeholder-img {
    width: 100%;
    height: 200px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   TYPOGRAPHY ELEMENTS
   ========================================================================== */

.cv-card-title a {
    text-decoration: none;
    color: inherit;
}

.cv-card-title a:hover {
    text-decoration: none;
}

.cv-card-excerpt p:last-child {
    margin-bottom: 0;
}

.cv-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
}

.cv-meta-sep {
    opacity: 0.4;
}

.cv-meta-category a {
    text-decoration: none;
    color: inherit;
}

.cv-btn {
    display: inline-block;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* ==========================================================================
   SKELETON LOADING
   ========================================================================== */

.cv-skeleton-card {
    border: 1px solid #ebebeb;
    border-radius: 8px;
    padding: 15px;
    overflow: hidden;
}

.cv-skeleton-img {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    height: 160px;
    margin-bottom: 15px;
    border-radius: 4px;
    animation: cv-shimmer 1.5s infinite linear;
}

.cv-skeleton-title {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    height: 20px;
    width: 75%;
    margin-bottom: 10px;
    border-radius: 4px;
    animation: cv-shimmer 1.5s infinite linear;
}

.cv-skeleton-text {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
    animation: cv-shimmer 1.5s infinite linear;
}

.cv-skeleton-text-short {
    width: 55%;
}

@keyframes cv-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */

.cv-empty-state {
    text-align: center;
    padding: 60px 20px;
    width: 100%;
}

.cv-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.cv-empty-title {
    font-size: 16px;
    font-weight: 500;
    color: #888;
    margin: 0;
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */

.cv-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
    width: 100%;
    list-style: none;
    padding: 0;
}

/* paginate_links dengan type=list menghasilkan <ul><li><a> */
.cv-pagination ul {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.cv-pagination li {
    list-style: none;
}

.cv-pagination a,
.cv-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.25s ease;
    color: inherit;
    font-size: 14px;
}

.cv-pagination a:hover {
    border-color: #999;
    background-color: #f5f5f5;
    transform: translateY(-2px);
}

.cv-pagination .current {
    font-weight: 600;
    border-color: #333;
    background-color: #333;
    color: #fff;
}

/* ==========================================================================
   LOAD MORE BUTTON
   ========================================================================== */

.cv-load-more-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 32px;
    width: 100%;
}

.cv-load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 32px;
    border: 2px solid #333;
    border-radius: 6px;
    background: transparent;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    line-height: 1;
    font-family: inherit;
}

.cv-load-more-btn:hover:not(:disabled) {
    background-color: #333;
    color: #fff;
    transform: translateY(-2px);
}

.cv-load-more-btn:disabled,
.cv-load-more-btn.is-loading {
    opacity: 0.65;
    pointer-events: none;
    cursor: not-allowed;
}

/* ==========================================================================
   INFINITE SCROLL
   ========================================================================== */

.cv-infinite-sentinel {
    height: 1px;
    width: 100%;
    visibility: hidden;
    margin-top: 24px;
    display: block;
}

.cv-infinite-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 20px;
    width: 100%;
    color: #888;
    font-size: 14px;
    margin-top: 8px;
}

/* ==========================================================================
   SPINNER (used in load more & infinite scroll)
   ========================================================================== */

.cv-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: cv-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes cv-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   APPENDED CARD ANIMATION
   ========================================================================== */

.cv-card-appended {
    animation: cv-card-in 0.35s ease forwards;
}

@keyframes cv-card-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@media (max-width: 1024px) {
    .cv-layout-grid > .cv-card,
    .cv-layout-grid > .cv-skeleton-card {
        flex: 0 0 calc((100% - (var(--cv-columns, 2) - 1) * 20px) / var(--cv-columns, 2));
        max-width: calc((100% - (var(--cv-columns, 2) - 1) * 20px) / var(--cv-columns, 2));
    }

    .cv-layout-masonry {
        columns: var(--cv-columns, 2);
    }

    .cv-layout-magazine {
        grid-template-columns: repeat(var(--cv-columns, 2), 1fr);
    }
}

@media (max-width: 767px) {
    .cv-layout {
        gap: 12px;
    }

    .cv-layout-grid > .cv-card,
    .cv-layout-grid > .cv-skeleton-card {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .cv-layout-masonry {
        columns: var(--cv-columns, 1);
    }

    .cv-layout-magazine {
        grid-template-columns: 1fr;
    }

    .cv-layout-magazine > .cv-card:first-child {
        flex-direction: column;
        gap: 0;
    }

    .cv-layout-magazine > .cv-card:first-child .cv-card-media {
        flex: 0 0 auto;
        width: 100%;
    }

    .cv-layout-list .cv-card,
    .cv-layout-list .cv-skeleton-card {
        gap: 12px;
        align-items: flex-start;
    }

    .cv-layout-list .cv-card-media,
    .cv-layout-list .cv-skeleton-img {
        width: 90px;
        height: 90px;
        flex-shrink: 0;
        margin-bottom: 0;
    }

    .cv-layout-list .cv-placeholder-img {
        height: 90px;
    }

    .cv-card,
    .cv-skeleton-card {
        border-radius: 10px;
    }

    .cv-skeleton-img {
        height: 130px;
        margin-bottom: 10px;
    }

    .cv-skeleton-title {
        height: 16px;
        margin-bottom: 8px;
    }

    .cv-skeleton-text {
        height: 12px;
        margin-bottom: 6px;
    }
}

/* ==========================================================================
   HERO CAROUSEL LAYOUT
   ========================================================================== */
.cv-layout-hero-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.cv-layout-hero-carousel .swiper-wrapper {
    align-items: flex-start;
}

.cv-layout-hero-carousel .cv-card {
    position: relative;
    width: 100%;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
}

.cv-layout-hero-carousel .cv-card-media {
    position: relative;
    width: 100%;
    padding-top: 0 !important;
    height: auto !important;
    border-radius: 0 !important;
}

.cv-layout-hero-carousel .cv-card-media img,
.cv-layout-hero-carousel .cv-video-wrapper video.cv-hero-video {
    position: relative;
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    top: auto;
    left: auto;
    transform: none;
}

.cv-layout-hero-carousel .cv-video-wrapper {
    position: relative;
    width: 100%;
    height: auto;
    display: block;
}

.cv-layout-hero-carousel .cv-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 30px;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);
    color: #fff;
    z-index: 10;
}

.cv-layout-hero-carousel .cv-card-title a {
    color: #fff !important;
}

.cv-layout-hero-carousel .cv-card-meta {
    color: rgba(255,255,255,0.8);
}

.cv-layout-hero-carousel .cv-swiper-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    transition: background 0.3s ease;
}

.cv-layout-hero-carousel .cv-swiper-button:hover {
    background: rgba(0,0,0,0.8);
}

.cv-layout-hero-carousel .cv-swiper-button-prev {
    left: 20px;
}

.cv-layout-hero-carousel .cv-swiper-button-next {
    right: 20px;
}

.cv-layout-hero-carousel .swiper-button-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
