/* 
 * Josjis Theme - Home Layout
 * Hero Section — Headline Grid
 * @package Josjis
 */


/* ==========================================================================
   HERO SECTION
   ========================================================================== */

.hero-section {
    margin-top: 75px;
    margin-bottom: 20px;
}

.hero-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--container-padding) 40px;
    border-bottom: 1px solid var(--color-border);
}

/* Grid: large headline left + list right */
.hero-grid {
    display: grid;
    grid-template-columns: 2.4fr 1.15fr;
    gap: 25px;
}


/* ==========================================================================
   HERO MAIN — Thumbnail on top, title+excerpt below
   ========================================================================== */

.hero-main-link {
    display: block;
    text-decoration: none;
    color: var(--color-link, var(--color-text));
    border-radius: 10px;
    overflow: hidden;
}

/* Thumbnail container */
.hero-main-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--color-bg-alt);
}

/* Badge: inside thumbnail, top-left corner */
.hero-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    font-family: var(--typo-label-font, inherit);
    font-size: var(--typo-label-size-desktop, 11px);
    font-weight: var(--typo-label-weight, 700);
    line-height: var(--typo-label-lh, 1.2);
    padding: 4px 12px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.hero-main-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.hero-main-link:hover .hero-main-img {
    transform: scale(1.03);
}

/* Placeholder */
.hero-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-alt);
    color: var(--color-text-muted);
}

.hero-placeholder--sm {
    aspect-ratio: 1/1;
}

/* Body: title + excerpt */
.hero-main-body {
    padding: 16px 0px 0px;
}

.hero-main-title {
    font-family: var(--typo-title-font, inherit);
    font-size: 30px;
    font-weight: var(--typo-title-weight, 800);
    line-height: var(--typo-title-lh, 1.35);
    margin: 0 0 8px 0;
    color: inherit;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-main-link:hover .hero-main-title {
    color: var(--color-link-hover);
}

.hero-main-excerpt {
    font-family: var(--typo-excerpt-font, inherit);
    font-size: var(--typo-excerpt-size-desktop, 14px);
    font-weight: var(--typo-excerpt-weight, 400);
    color: var(--color-text-secondary);
    line-height: var(--typo-excerpt-lh, 1.6);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* ==========================================================================
   HERO SIDE — Desktop: title+excerpt list only (no thumbnails)
   ========================================================================== */

.hero-side {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.hero-card {
    display: flex;
    gap: 0;
    text-decoration: none;
    color: var(--color-link, var(--color-text));
    padding: 16px 0;
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition-fast);
}

.hero-card:first-child {
    padding-top: 0;
}

.hero-card:last-child {
    border-bottom: none;
}

/* Thumbnail: HIDDEN on desktop, visible on mobile */
.hero-card-thumb {
    display: none;
}

.hero-card-body {
    flex: 1;
    min-width: 0;
}

.hero-card-title {
    font-family: var(--typo-title-font, inherit);
    font-size: max(15px, calc(var(--typo-title-size-desktop, 22px) * 0.7));
    font-weight: var(--typo-title-weight, 700);
    line-height: var(--typo-title-lh, 1.45);
    margin: 0 0 6px 0;
    color: inherit;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color var(--transition-fast);
}

.hero-card:hover .hero-card-title {
    color: var(--color-link-hover);
}

.hero-card-excerpt {
    font-family: var(--typo-excerpt-font, inherit);
    font-size: var(--typo-excerpt-size-desktop, 13px);
    font-weight: var(--typo-excerpt-weight, 400);
    color: var(--color-text-secondary);
    line-height: var(--typo-excerpt-lh, 1.5);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* ==========================================================================
   RESPONSIVE — MOBILE (<769px)
   ========================================================================== */

@media (max-width: 768px) {
    .hero-section {
        margin-top: 55px;
        margin-bottom: 24px;
        padding-bottom: 0;
        border-bottom: none;
    }

    .hero-container {
        padding-bottom: 24px;
    }

    .hero-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .hero-main-title {
        font-size: var(--typo-title-size-mobile, 18px);
    }

    .hero-main-excerpt {
        font-size: var(--typo-excerpt-size-mobile, 13px);
    }

    /* Side cards: horizontal scroll with 1:1 thumb + title */
    .hero-side {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 12px;
        padding-bottom: 4px;

        /* Hide scrollbar */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .hero-side::-webkit-scrollbar {
        display: none;
    }

    .hero-card {
        flex: 0 0 70vw;
        max-width: 320px;
        scroll-snap-align: start;
        padding: 0;
        border-bottom: none;
        border-radius: 8px;
        border: 1px solid var(--color-border);
        background: var(--color-bg);
        overflow: hidden;
        gap: 0;
    }

    .hero-card:first-child {
        padding-top: 0;
    }

    /* Show thumbnail on mobile: 1:1 square on left */
    .hero-card-thumb {
        display: block;
        flex-shrink: 0;
        width: 5.625rem;
        height: 5.625rem;
        overflow: hidden;
        background: var(--color-bg-alt);
    }

    .hero-card-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .hero-card-body {
        padding: 10px 12px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .hero-card-title {
        font-size: max(15px, calc(var(--typo-title-size-mobile, 18px) * 0.85));
        -webkit-line-clamp: 3;
        margin-bottom: 0;
    }

    .hero-card-excerpt {
        display: none;
    }
}


/* ==========================================================================
   RESPONSIVE — TABLET (769px–1024px)
   ========================================================================== */

@media (min-width: 769px) and (max-width: 1024px) {
    .hero-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .hero-main-title {
        font-size: max(19px, calc(var(--typo-title-size-desktop, 22px) * 0.85));
    }

    .hero-card-title {
        font-size: max(13px, calc(var(--typo-title-size-desktop, 22px) * 0.6));
    }
}


/* ==========================================================================
   LATEST POSTS SECTION — Artikel Terkini
   ========================================================================== */

.latest-section {
    margin-bottom: 48px;
}

.latest-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

/* Section Header */
.latest-header {
    margin-bottom: 20px;
}

.latest-section-title {
    font-family: var(--typo-title-font, inherit);
    font-size: 20px;
    font-weight: var(--typo-title-weight, 800);
    color: var(--color-text);
    margin: 0;
    letter-spacing: -0.3px;
}

/* Wrapper: content left + sidebar right */
.latest-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 32px;
    align-items: start;
}

.latest-content {
    min-width: 0;
}

/* ==========================================================================
   SECTION HEADING STYLES — 5 Decorative Variants
   Applied via .heading-style-{variant} on parent container.
   Targets .section-heading and .widget-title inside that parent.
   ========================================================================== */

/* Shared base */
.section-heading,
.heading-style-underline .widget-title,
.heading-style-dot .widget-title,
.heading-style-border-left .widget-title,
.heading-style-highlight .widget-title,
.heading-style-double-line .widget-title {
    position: relative;
    display: inline-block;
}


/* --- 1. Garis Bawah Aksen (underline) --- */
.heading-style-underline .section-heading,
.heading-style-underline .widget-title {
    padding-bottom: 10px;
}

.heading-style-underline .section-heading::after,
.heading-style-underline .widget-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 5px;
    width: 45px;
    height: 3px;
    background: var(--color-primary);
    border-radius: 2px;
}


/* --- 2. Dot Sebelum Teks (dot) --- */
.heading-style-dot .section-heading,
.heading-style-dot .widget-title {
    padding-left: 16px;
}

.heading-style-dot .section-heading::before,
.heading-style-dot .widget-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--color-primary);
    border-radius: 50%;
}


/* --- 3. Border Kiri Tebal (border-left) --- */
.heading-style-border-left .section-heading,
.heading-style-border-left .widget-title {
    padding-left: 14px;
    border-left: 4px solid var(--color-primary);
}


/* --- 4. Highlight Background (highlight) --- */
.heading-style-highlight .section-heading,
.heading-style-highlight .widget-title {
    padding: 6px 14px;
    background: var(--color-primary);
    color: #ffffff;
    border-radius: 4px;
    letter-spacing: 0;
}


/* --- 5. Garis Atas & Bawah (double-line) --- */
.heading-style-double-line .section-heading,
.heading-style-double-line .widget-title {
    padding: 8px 0;
    border-top: 2px solid var(--color-primary);
    border-bottom: 2px solid var(--color-primary);
    display: block;
}


/* ==========================================================================
   LIST LAYOUT — Thumbnail kiri, body kanan
   ========================================================================== */

.latest-posts.layout-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.layout-list .latest-item {
    border-bottom: 1px solid var(--color-border);
}

.layout-list .latest-item:last-child {
    border-bottom: none;
}

.layout-list .latest-item-link {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    text-decoration: none;
    color: var(--color-link, var(--color-text));
    transition: background var(--transition-fast);
}

.layout-list .latest-item:first-child .latest-item-link {
    padding-top: 0;
}

.layout-list .latest-item-thumb {
    flex-shrink: 0;
    width: 180px;
    aspect-ratio: 16/9;
    border-radius: 8px;
    overflow: hidden;
    margin: 0;
    background: var(--color-bg-alt);
}

.layout-list .latest-item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.layout-list .latest-item-link:hover .latest-item-img {
    transform: scale(1.05);
}

.layout-list .latest-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}


/* ==========================================================================
   GRID LAYOUT — 2 columns, thumbnail atas, body bawah
   ========================================================================== */

.latest-posts.layout-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.layout-grid .latest-item-link {
    display: flex;
    flex-direction: column;
    gap: 0;
    text-decoration: none;
    color: var(--color-link, var(--color-text));
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    transition: border-color var(--transition-fast);
}

.layout-grid .latest-item-link:hover {
    border-color: var(--color-link-hover);
}

.layout-grid .latest-item-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    margin: 0;
    background: var(--color-bg-alt);
}

.layout-grid .latest-item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.layout-grid .latest-item-link:hover .latest-item-img {
    transform: scale(1.05);
}

.layout-grid .latest-item-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}


/* ==========================================================================
   LATEST ITEM — Shared styles (cat, title, date)
   ========================================================================== */

.latest-item-cat {
    font-family: var(--typo-label-font, inherit);
    font-size: var(--typo-label-size-desktop, 11px);
    font-weight: var(--typo-label-weight, 700);
    line-height: var(--typo-label-lh, 1.2);
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.latest-item-title {
    font-family: var(--typo-title-font, inherit);
    font-size: var(--typo-title-size-desktop, 24px);
    font-weight: var(--typo-title-weight, 700);
    line-height: var(--typo-title-lh, 1.4);
    margin: 0;
    color: inherit;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color var(--transition-fast);
}

.latest-item-link:hover .latest-item-title {
    color: var(--color-link-hover);
}

.latest-item-date {
    font-family: var(--typo-meta-font, inherit);
    font-size: var(--typo-meta-size-desktop, 12px);
    font-weight: var(--typo-meta-weight, 400);
    line-height: var(--typo-meta-lh, 1.5);
    color: var(--color-text-muted);
}

/* Placeholder (no thumbnail) */
.latest-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-alt);
    color: var(--color-text-muted);
}


/* ==========================================================================
   INLINE SLIDER WIDGET
   ========================================================================== */

.inline-slider-wrapper {
    margin: 16px 0 24px;
    padding: 20px;
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-bg);
    box-sizing: border-box;
}

/* Video Play Overlay */
.video-slider-thumb {
    position: relative;
    display: block;
}

.video-play-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.inline-slider-link:hover .video-play-overlay {
    opacity: 1;
}

.video-play-overlay svg {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.inline-slider-link:hover .video-play-overlay svg {
    transform: scale(1.15);
}

.inline-slider-title {
    font-family: var(--typo-title-font, inherit);
    font-size: 18px;
    font-weight: var(--typo-title-weight, 800);
    color: var(--color-text);
    margin: 0 0 12px 0;
    letter-spacing: -0.3px;
    display: inline-block;
}

.inline-slider-inner {
    position: relative;
    margin: 0 -8px; /* Offset the track padding to bring arrows inside */
}

.inline-slider-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0 8px 8px; /* Room for shadow and offset */
    -webkit-overflow-scrolling: touch;
}

.inline-slider-track::-webkit-scrollbar {
    display: none;
}

.inline-slider-card {
    scroll-snap-align: start;
    flex: 0 0 calc((100% - 32px) / 2.5); /* Show 2.5 cards on desktop (2 gaps of 16px) */
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.inline-slider-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.inline-slider-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: var(--color-link, var(--color-text));
}

.inline-slider-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--color-bg-alt);
    margin: 0;
    position: relative;
    overflow: hidden;
}

.inline-slider-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.inline-slider-link:hover .inline-slider-img {
    transform: scale(1.05);
}

.inline-slider-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.inline-slider-card-title {
    font-family: var(--typo-title-font, inherit);
    font-size: max(14px, calc(var(--typo-title-size-desktop, 20px) * 0.70));
    font-weight: var(--typo-title-weight, 700);
    line-height: var(--typo-title-lh, 1.4);
    margin: 6px 0 10px;
    color: inherit;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color var(--transition-fast);
}

.inline-slider-link:hover .inline-slider-card-title {
    color: var(--color-link-hover);
}

/* Nav Arrows Overlay */
.inline-slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
}

.inline-slider-nav:hover {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.inline-slider-nav.nav-left {
    left: -12px;
}

.inline-slider-nav.nav-right {
    right: -12px;
}


/* ==========================================================================
   SIDEBAR
   ========================================================================== */

.latest-sidebar {
    position: sticky;
    top: 70px;
}

.latest-sidebar .widget {
    margin-bottom: 24px;
}

.latest-sidebar .widget:last-child {
    margin-bottom: 0;
}

.latest-sidebar .widget-title {
    font-family: var(--typo-title-font, inherit);
    font-size: 20px;
    font-weight: var(--typo-title-weight, 800);
    color: var(--color-text);
    margin: 0 0 16px;
}


/* ==========================================================================
   RESPONSIVE — LATEST SECTION MOBILE (<769px)
   ========================================================================== */

@media (max-width: 768px) {
    .latest-section {
        margin-bottom: 32px;
    }

    .latest-section-title {
        font-size: 18px;
    }

    .latest-item-cat {
        font-size: var(--typo-label-size-mobile, 11px);
    }
    
    .latest-item-title {
        font-size: var(--typo-title-size-mobile, 20px);
    }

    .latest-item-date {
        font-size: var(--typo-meta-size-mobile, 12px);
    }
    
    /* Stack: content on top, sidebar below */
    .latest-wrapper {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    /* Grid mode falls back to list on mobile */
    .latest-posts.layout-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .layout-grid .latest-item-link {
        flex-direction: row;
        border: none;
        border-radius: 0;
        gap: 12px;
    }

    .layout-grid .latest-item-link:hover {
        border-color: transparent;
    }

    .layout-grid .latest-item {
        border-bottom: 1px solid var(--color-border);
    }

    .layout-grid .latest-item:last-child {
        border-bottom: none;
    }

    .layout-grid .latest-item-thumb {
        width: 100px;
        flex-shrink: 0;
        border-radius: 6px;
        overflow: hidden;
    }

    .layout-grid .latest-item-body {
        padding: 12px 0;
    }

    /* List mode thumb smaller on mobile */
    .layout-list .latest-item-thumb {
        width: 100px;
    }

    .layout-list .latest-item-link {
        gap: 12px;
    }

    /* Slider Mobile Adjustments */
    .inline-slider-wrapper {
        margin: 16px 0 24px;
        padding: 12px;
        border-radius: 8px;
    }

    .inline-slider-card {
        flex: 0 0 calc((100% - 16px) / 1.5); /* Show 1.5 cards on mobile */
        max-width: none;
    }

    .inline-slider-nav {
        display: none; /* Hide arrows on mobile, rely on swipe instead */
    }

    /* Sidebar un-sticky on mobile */
    .latest-sidebar {
        position: static;
        border-top: 1px solid var(--color-border);
        padding-top: 24px;
    }
}


/* ==========================================================================
   RESPONSIVE — LATEST SECTION TABLET (769px–1024px)
   ========================================================================== */

@media (min-width: 769px) and (max-width: 1024px) {
    .latest-wrapper {
        grid-template-columns: 1fr 240px;
        gap: 24px;
    }

    .layout-list .latest-item-thumb {
        width: 120px;
    }

    .inline-slider-card {
        flex: 0 0 calc((100% - 32px) / 2.5); /* Show 2.5 cards on tablet */
    }
}

/* ------------------------------------------------------------- 
 * AJAX PAGINATION WIDGET STYLES
 * ------------------------------------------------------------- */
.josjis-pagination-wrapper {
    margin-top: 32px;
    display: flex;
    justify-content: center;
    width: 100%;
    clear: both;
}

.josjis-pagination-wrapper.pagination-numbered .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    margin: 0 4px;
    border-radius: 6px;
    background: #f8f9fa;
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border: 1px solid #e9ecef;
}

.josjis-pagination-wrapper.pagination-numbered .page-numbers:hover {
    background: #e9ecef;
}

.josjis-pagination-wrapper.pagination-numbered .page-numbers.current {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.josjis-load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    background: #fff;
    color: var(--color-text);
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 180px;
    min-height: 48px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.josjis-load-more-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: 0 4px 8px rgba(0,0,0,0.04);
}

.josjis-load-more-btn.loading {
    opacity: 0.8;
    pointer-events: none;
}

/* infinite sentry layout */
.josjis-infinite-sentry {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 0;
    width: 100%;
}

/* Spinner Animation */
.josjis-spinner {
    animation: rotate 2s linear infinite;
    color: var(--color-primary);
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}
