/*
 * home.css — Homepage specific styles
 * Layout for Hero Grid & E-Koran Carousel.
 *
 * @package times-clone
 */

/* ============================================================
 * 1. HERO TOP SECTION (Carousel & Berita Terbaru)
 * ============================================================ */
.home-top-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
}

@media (min-width: 1024px) {
    .home-top-section {
        grid-template-columns: 66% 34%; /* 2/3 dan 1/3 */
    }
}

/* ── KIRI: Carousel Headline ── */
.hero-carousel-wrap {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: var(--color-navy);
}

.hero-carousel {
    position: relative;
    width: 100%;
    height: 100%;
}

.hero-carousel__track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.4s ease-in-out;
}

.hero-carousel__slide {
    width: 100%;
    flex-shrink: 0;
    height: 100%;
}

/* Controls */
.hc-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.7);
    color: #333;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
}
.hc-nav:hover { background: #fff; }
.hc-prev { left: var(--space-4); }
.hc-next { right: var(--space-4); }

.hc-dots {
    position: absolute;
    bottom: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}
.hc-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s;
}
.hc-dot.is-active, .hc-dot:hover {
    background: #fff;
}

/* Base style for headline (menyesuaikan content-headline yg sudah ada) */
.headline-card {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 380px;
}
@media (min-width: 1024px) {
    .headline-card { min-height: 480px; }
}

.headline-card__inner {
    display: block;
    width: 100%;
    height: 100%;
    color: #fff;
    text-decoration: none;
}
.headline-card__thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.headline-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.headline-card__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0.1) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--space-5);
    padding-bottom: var(--space-10); /* space for dots */
}
@media (min-width: 768px) {
    .headline-card__overlay { padding: var(--space-8); padding-bottom: var(--space-10); }
}

.headline-card__title {
    color: #fff;
    font-size: var(--text-2xl);
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: var(--space-3);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
@media (min-width: 1024px) {
    .headline-card__title { font-size: var(--text-4xl); }
}

.headline-card__meta {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    font-size: var(--text-sm);
    color: rgba(255,255,255,0.8);
}
.headline-card__meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.headline-card__meta-item svg { width: 14px; height: 14px; }


/* ── KANAN: Berita Terbaru ── */
.hero-latest-wrap {
    display: flex;
    flex-direction: column;
}

.hero-latest__header h3 {
    font-size: var(--text-lg);
    font-weight: 800;
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-navy);
}

.hl-red-bar {
    display: inline-block;
    width: 4px;
    height: 18px;
    background: var(--color-primary);
    border-radius: 2px;
}

.hl-icon {
    width: 18px;
    height: 18px;
    color: var(--color-primary);
}

.hero-latest__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

/* Card Featured (1st post) */
.latest-featured-card {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 16/9;
}
.latest-featured__inner {
    display: block;
    width: 100%;
    height: 100%;
    color: #fff;
    text-decoration: none;
}
.latest-featured__thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.latest-featured__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}
.latest-featured-card:hover .latest-featured__thumb img {
    transform: scale(1.05);
}
.latest-featured__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.2) 60%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--space-3) var(--space-4);
}
.latest-featured__title {
    font-size: var(--text-sm);
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: var(--space-2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.latest-featured__meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 2px;
}
.latest-featured__meta .view-count {
    display: flex;
    align-items: center;
    gap: 4px;
}
.latest-featured__meta .view-count svg {
    width: 12px;
    height: 12px;
}
.latest-featured__time {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
}

/* Card List (Small) */
.latest-list-item {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-3);
}
.latest-list-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.latest-list__inner {
    display: flex;
    gap: var(--space-3);
    text-decoration: none;
    color: var(--color-text);
}
.latest-list__thumb {
    width: 90px;
    height: 64px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.latest-list__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.latest-list__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}
.latest-list__title {
    font-size: var(--text-sm);
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: var(--space-1);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color var(--transition-fast);
}
.latest-list__inner:hover .latest-list__title {
    color: var(--color-primary);
}
.latest-list__time {
    font-size: 11px;
    color: var(--color-muted);
}

/* ============================================================
 * 2. E-KORAN CAROUSEL
 * ============================================================ */
.home-ekoran {
    background-color: var(--color-surface);
    padding-block: var(--space-10);
}

@media (min-width: 768px) {
    .home-ekoran {
        padding-block: var(--space-16);
    }
}

.section-heading-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
    border-bottom: 2px solid var(--color-border);
}

.section-heading-wrap .section-heading {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: var(--space-3);
    /* pseudo ::before accent still applies via main.css */
}

.btn-lihat-semua {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-primary);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.btn-lihat-semua:hover {
    background: rgba(196,18,48,0.08);
}

/* ── Carousel Wrapper ── */
.ekoran-carousel {
    position: relative;
    /* Negative margin to allow items to bleed out on mobile if needed, 
       but we keep it contained for simple scroll */
}

.ek-track-container {
    overflow: hidden; /* Hide scrollbars, JS will translate track OR we use native scroll */
    /* Mobile-first approach: native horizontally scrollable container, enhanced by JS on desktop */
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    padding-bottom: var(--space-4); /* Space for shadow */
}

.ek-track-container::-webkit-scrollbar {
    display: none;
}

.ek-track {
    display: flex;
    gap: var(--space-4);
    width: max-content;
}

.ek-slide {
    width: 200px; /* Fixed width for portrait card */
    scroll-snap-align: start;
    flex-shrink: 0;
}

@media (min-width: 600px) {
    .ek-slide { width: 220px; }
}
@media (min-width: 1024px) {
    .ek-slide { width: 240px; }
}

/* ── Navigation Arrows (Desktop) ── */
.ek-nav {
    position: absolute;
    top: 40%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: #fff;
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    display: none; /* hidden on mobile, user can swipe */
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    z-index: 10;
    transition: background var(--transition-fast), color var(--transition-fast), opacity var(--transition-fast);
}

.ek-nav:hover {
    background: var(--color-primary);
    color: #fff;
}

.ek-nav:disabled {
    opacity: 0;
    pointer-events: none;
}

.ek-prev { left: -22px; }
.ek-next { right: -22px; }

@media (min-width: 768px) {
    .ek-nav {
        display: flex;
    }
}

/* ── E-Koran Specific Card ── */
.ekoran-card {
    display: block;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-surface);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    box-shadow: var(--shadow-sm);
    height: 100%;
}

.ekoran-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.ekoran-card__inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ekoran-card__thumb {
    position: relative;
    aspect-ratio: 3 / 4; /* Portrait cover */
    background-color: var(--color-border);
    border-bottom: 4px solid var(--color-primary);
}

.ekoran-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ekoran-card__body {
    padding: var(--space-3) var(--space-3);
    text-align: center;
}

.ekoran-card__title {
    font-size: var(--text-sm);
    line-height: 1.4;
    font-weight: 700;
    margin-bottom: var(--space-1);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ekoran-card:hover .ekoran-card__title {
    color: var(--color-primary);
}

.ekoran-card__meta {
    font-size: var(--text-xs);
    color: var(--color-muted);
}
