/* ========================================
   PUSTAKA DIGITAL – MODERN PROFESSIONAL
   Optimized for Performance & Accessibility
   ======================================== */

:root {
    --pk-primary: #f6c43a;
    --pk-secondary: #9a4b10;
    --pk-brown: #8B5E3C;
    --pk-light: #fef9f0;
    --pk-dark: #f5f5f5;
    --pk-shadow-sm: 0 2px 12px rgba(0, 0, 0, .04);
    --pk-shadow-md: 0 8px 24px rgba(0, 0, 0, .06);
    --pk-shadow-lg: 0 16px 48px rgba(0, 0, 0, .1);
    --pk-radius: 20px;
    --pk-transition: all .4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== GLOBAL RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.pk-page {
    background: linear-gradient(180deg, #1a1a1a 0%, #2a2a2a 100%);
}

.pk-filter {
    background: rgba(42, 42, 42, 0.95);
}

.filter-search {
    background: #1a1a1a;
    border-color: #444;
    color: #f5f5f5;
}

.filter-btn {
    background: #1a1a1a;
    border-color: #444;
    color: #ccc;
}

.card {
    border-color: rgba(255, 255, 255, .08);
}

.card-title {
    color: #f5f5f5;
}

.card-desc {
    color: #aaa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== ANIMATION STYLES ===== */
[data-aos] {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity .6s ease, transform .6s ease;
}

[data-aos].aos-animate {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
HERO SECTION
======================================== */
.pk-hero {
    padding: 100px 20px 80px;
    background: linear-gradient(135deg, #FFE5B4 0%, #FFF8DC 50%, #FFEFD5 100%);
    position: relative;
    overflow: hidden;
    will-change: transform, opacity;
}

.hero-bg-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(139, 94, 60, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(246, 196, 58, 0.05) 0%, transparent 50%);
    animation: pattern-float 20s ease-in-out infinite;
}

@keyframes pattern-float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(20px, -20px) scale(1.05);
    }
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(139, 94, 60, 0.2);
    border-radius: 50px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--pk-brown);
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
    animation: badge-float 3s ease-in-out infinite;
}

@keyframes badge-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.hero-badge svg {
    width: 18px;
    height: 18px;
}

.pk-hero h1 {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--pk-brown);
    margin-bottom: 20px;
    line-height: 1.15;
    letter-spacing: -0.5px;
}

.pk-hero .accent {
    color: var(--pk-brown);
    display: inline-block;
    position: relative;
    background: linear-gradient(120deg, var(--pk-brown) 0%, var(--pk-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.pk-hero .lead {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #555;
    max-width: 700px;
    margin: 0 auto 40px;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 48px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--pk-brown);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: .9rem;
    color: #666;
    font-weight: 500;
}

.hero-scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: .6;
    animation: scroll-bounce 2s ease-in-out infinite;
}

@keyframes scroll-bounce {

    0%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    50% {
        transform: translateX(-50%) translateY(10px);
    }
}

.scroll-mouse {
    width: 24px;
    height: 36px;
    border: 2px solid var(--pk-brown);
    border-radius: 12px;
    position: relative;
}

.scroll-mouse::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 8px;
    background: var(--pk-brown);
    border-radius: 2px;
    animation: scroll-wheel 2s ease-in-out infinite;
}

@keyframes scroll-wheel {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(12px);
    }
}

.hero-scroll-indicator span {
    font-size: .75rem;
    color: var(--pk-brown);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ========================================
   FILTER SECTION
   ======================================== */
.pk-filter {
    padding: 24px 0;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(0, 0, 0, .05);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .03);
}

.filter-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 1. MENENGAHKAN FILTER */
.pk-filter .filter-wrapper {
    display: flex;
    justify-content: center;
    /* Kunci untuk menengahkan secara horizontal */
    width: 100%;
}

.pk-filter .filter-tags {
    display: flex;
    justify-content: center;
    /* Pastikan items di dalam tags juga di tengah */
    flex-wrap: wrap;
    /* Agar turun ke bawah jika layar kecil */
    gap: 0.75rem;
    /* Jarak antar tombol */
}

/* 2. MENENGAHKAN HEADER GRID (Judul "Koleksi Kami") */
.pk-grid .grid-header {
    text-align: center;
    /* Menengahkan teks judul dan deskripsi */
    margin-bottom: 3rem;
    max-width: 800px;
    margin-left: auto;
    /* Auto margin kiri-kanan untuk container header */
    margin-right: auto;
}

/* 3. MENENGAHKAN GRID KARTU */
.pk-grid .container {
    /* Pastikan container pembungkus memiliki lebar maksimum */
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.pk-grid .grid {
    display: grid;
    /* Setup Grid Responsif: Minimal 300px, kalau muat bagi rata */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;

    /* PENTING: Jika kartu sedikit (misal cuma 1 atau 2), 
       ini akan membuat mereka tetap rapi tapi start dari kiri.
       Jika ingin BENAR-BENAR di tengah walaupun cuma 1 kartu: */
    /* justify-content: center; */
}

/* Opsi Tambahan: Agar kartu di baris terakhir tidak melar aneh */
@media (min-width: 1024px) {
    .pk-grid .grid {
        /* Opsional: Membatasi lebar grid agar tidak terlalu lebar di layar jumbo */
        max-width: 1100px;
        margin: 0 auto;
    }
}

.search-box {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
    transition: var(--pk-transition);
}

.search-box.searching .search-icon {
    color: var(--pk-brown);
}

.filter-search {
    width: 100%;
    padding: 16px 50px 16px 52px;
    border: 2px solid #e8e8e8;
    border-radius: 16px;
    font-size: 1rem;
    transition: var(--pk-transition);
    background: #fafafa;
    font-family: inherit;
}

.filter-search:focus {
    outline: none;
    border-color: var(--pk-brown);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(139, 94, 60, .08);
}

.search-loader {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--pk-brown);
    border-radius: 50%;
    opacity: 0;
    transition: opacity .3s;
}

.search-box.searching .search-loader {
    opacity: 1;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: translateY(-50%) rotate(0deg);
    }

    100% {
        transform: translateY(-50%) rotate(360deg);
    }
}

.filter-tags {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

.filter-tags::-webkit-scrollbar {
    height: 6px;
}

.filter-tags::-webkit-scrollbar-track {
    background: transparent;
}

.filter-tags::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.filter-btn {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 50px;
    border: 2px solid #e8e8e8;
    background: #ffffff;
    font-size: .9rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: var(--pk-transition);
    white-space: nowrap;
    font-family: inherit;
}

.filter-btn:hover {
    border-color: var(--pk-brown);
    color: var(--pk-brown);
    transform: translateY(-2px);
    box-shadow: var(--pk-shadow-sm);
}

.filter-btn.active {
    background: var(--pk-brown);
    color: #ffffff;
    border-color: var(--pk-brown);
    box-shadow: 0 4px 16px rgba(139, 94, 60, .3);
    transform: translateY(-2px);
}

.filter-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: rgba(0, 0, 0, .08);
    border-radius: 12px;
    font-size: .75rem;
    font-weight: 700;
}

.filter-btn.active .filter-count {
    background: rgba(255, 255, 255, .25);
    color: #ffffff;
}

/* ========================================
GRID SECTION
======================================== */
.pk-grid {
    padding: 60px 0 100px;
    position: relative;
    /* Agar z-index child (background) berfungsi */
    z-index: 1;
}

/* LAYER 1: Gambar Background (Paling Belakang) */
.pk-grid::before {
    content: "";
    position: absolute;
    inset: 0;
    /* Full cover parent */
    z-index: -2;

    /* GANTI path ini sesuai lokasi gambar Anda */
    background-image: url('/images/Background.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    /* Efek Parallax */
}

/* LAYER 2: Overlay Gelap + Blur (Di atas gambar, di bawah konten) */
.pk-grid::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;

    /* Overlay Hitam 60% */
    background: rgba(0, 0, 0, 0.6);

    /* Efek Blur */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    /* Support Safari */
}

/* Container & Layout */
.pk-grid .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.grid-header {
    text-align: center;
    margin-bottom: 48px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.grid-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: #ffffff;
    /* Putih agar terbaca di background gelap */
    margin-bottom: 12px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.grid-header p {
    font-size: 1.1rem;
    color: #e5e5e5;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 32px;
}

/* ========================================
CARD STYLES
======================================== */
.card {
    border-radius: var(--pk-radius);
    overflow: hidden;
    box-shadow: var(--pk-shadow-sm);
    transition: var(--pk-transition);
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
    border: 1px solid rgba(0, 0, 0, .04);
    will-change: transform;
}

.card.visible {
    animation: card-enter .5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.card:hover {
    transform: translateY(-12px);
    box-shadow: var(--pk-shadow-lg);
    border-color: var(--card-color, var(--pk-brown));
}

.card-ribbon {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    background: var(--card-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
    animation: ribbon-float 3s ease-in-out infinite;
}

@keyframes ribbon-float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-5px) rotate(3deg);
    }
}

.card-image {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    background: #f5f5f5;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .7s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover .card-image img {
    transform: scale(1.1);
}

.card-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, .4) 100%);
    pointer-events: none;
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 26, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: var(--pk-transition);
}

.card:hover .card-overlay {
    opacity: 1;
}

.view-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: #ffffff;
    color: var(--pk-dark);
    font-weight: 700;
    font-size: 1rem;
    border-radius: 50px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
    transform: translateY(20px);
    transition: var(--pk-transition);
}

.card:hover .view-btn {
    transform: translateY(0);
    background: var(--card-color, var(--pk-brown));
    color: #ffffff;
}

.view-btn svg {
    transition: transform .3s;
}

.card:hover .view-btn svg {
    transform: translateX(4px);
}

.card-body {
    padding: 28px;
}

.card-header-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    border-radius: 14px;
    background: var(--card-color, var(--pk-brown));
    color: #ffffff;
    flex-shrink: 0;
}

.card-badge {
    padding: 6px 14px;
    background: rgba(0, 0, 0, .05);
    border-radius: 50px;
    font-size: .8rem;
    font-weight: 600;
    color: #666;
}

.card-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--pk-dark);
    margin-bottom: 12px;
    line-height: 1.3;
}

.card-desc {
    font-size: .95rem;
    line-height: 1.7;
    color: #666;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .9rem;
    font-weight: 700;
    color: var(--pk-brown);
    transition: gap .3s;
}

.card:hover .card-link {
    gap: 10px;
}

.card-link svg {
    transition: transform .3s;
}

.card:hover .card-link svg {
    transform: translateX(4px);
}

/* ========================================
   EMPTY & NO RESULTS STATES
   ======================================== */
.empty-state,
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
}

.empty-illustration {
    margin: 0 auto 32px;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

.no-results-icon,
.empty-icon {
    font-size: 4rem;
    margin-bottom: 24px;
    opacity: .5;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.empty-state h3,
.no-results h3 {
    font-size: 1.75rem;
    color: var(--pk-brown);
    margin-bottom: 12px;
    font-weight: 800;
}

.empty-state p,
.no-results p {
    color: #888;
    font-size: 1.05rem;
    margin-bottom: 24px;
}

.reset-btn {
    padding: 14px 32px;
    background: var(--pk-brown);
    color: #ffffff;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--pk-transition);
    font-family: inherit;
}

.reset-btn:hover {
    background: var(--pk-secondary);
    transform: translateY(-2px);
    box-shadow: var(--pk-shadow-md);
}

/* ========================================
   RESPONSIVE - TABLET (≥ 640px)
   ======================================== */
@media (min-width: 640px) {
    .pk-hero h1 {
        font-size: 3rem;
    }

    .grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .card-image {
        height: 240px;
    }
}

/* ========================================
   RESPONSIVE - TABLET LARGE (≥ 768px)
   ======================================== */
@media (min-width: 768px) {
    .pk-hero {
        padding: 120px 20px 100px;
    }

    .pk-hero h1 {
        font-size: 3.5rem;
    }

    .filter-wrapper {
        flex-direction: row;
        align-items: center;
        gap: 24px;
    }

    .search-box {
        max-width: 400px;
    }

    .filter-tags {
        flex: 1;
        justify-content: flex-end;
    }
}

/* ========================================
   RESPONSIVE - DESKTOP (≥ 1024px)
   ======================================== */
@media (min-width: 1024px) {
    .pk-hero h1 {
        font-size: 4rem;
    }

    .grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 36px;
    }

    .card-image {
        height: 260px;
    }

    .card-body {
        padding: 32px;
    }
}

/* ========================================
   RESPONSIVE - LARGE DESKTOP (≥ 1440px)
   ======================================== */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }

    .grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================
   ACCESSIBILITY & PERFORMANCE
   ======================================== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.card:focus-visible,
.filter-btn:focus-visible,
.reset-btn:focus-visible {
    outline: 3px solid var(--pk-brown);
    outline-offset: 4px;
}


/* ========================================
FORCE OVERRIDE GLOBAL style.css
KHUSUS HALAMAN PUSTAKA
======================================== */

.pk-page .card {
    padding: 0 !important;
    gap: 0 !important;
    display: block !important;
    background: #fff;
}

.pk-page .card-body {
    padding: 26px !important;
}

.pk-page .card-title {
    color: #1a1a1a !important;
}

.pk-page .card-desc {
    color: #222 !important;
    font-size: 0.95rem;
    line-height: 1.65;
}

/* lawan .card p global */
.pk-page .card p {
    color: #222 !important;
}

/* badge */
.pk-page .card-badge {
    color: #333 !important;
    background: #f1f1f1 !important;
}