/**
 * Shared skeleton styles for public home layouts
 * Matches exact geometry of Home Hero, Search Panel, Shortcuts, Statistics, Book Cards, News.
 * Optimized for Core Web Vitals (CLS = 0, FCP fast, zero-delay dismiss on DOMContentLoaded).
 */

@keyframes home-sk-shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes home-sk-autodismiss {

    0%,
    85% {
        opacity: 1;
        visibility: visible;
    }

    100% {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
}

.home-sk-box {
    background: linear-gradient(90deg, #e8edf3 25%, #f1f5f9 37%, #e8edf3 63%);
    background-size: 400% 100%;
    animation: home-sk-shimmer 1.4s ease infinite;
}

[data-theme="dark"] .home-sk-box {
    background: linear-gradient(90deg, #1e293b 25%, #334155 37%, #1e293b 63%);
    background-size: 400% 100%;
    animation: home-sk-shimmer 1.4s ease infinite;
}

@media (prefers-reduced-motion: reduce) {
    .home-sk-box {
        animation: none;
    }
}

/* Container: State switch */
.home-page-skeleton {
    display: none;
    width: 100%;
}

.home-page.is-loading .home-page-skeleton {
    display: block;
}

.home-page.is-loading > .home-shell {
    display: none;
}

.home-sk-shell {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* 1. Hero Banner */
.home-sk-hero {
    margin-bottom: 16px;
    height: 310px;
    border-radius: 20px;
    border: 1px solid var(--home-border, #d8e3ef);
}

/* 2. Search Panel */
.home-sk-search {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 18px;
    margin-bottom: 16px;
    padding: 17px 18px;
    background: #fff;
    border: 1px solid var(--home-border, #d8e3ef);
    border-radius: 18px;
    box-shadow: 0 3px 12px rgba(22, 71, 127, .04);
}

.home-sk-search-heading {
    display: flex;
    align-items: center;
    gap: 11px;
}

.home-sk-icon-sm {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 11px;
}

.home-sk-heading-lines {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.home-sk-title-sm {
    width: 120px;
    height: 16px;
    border-radius: 4px;
}

.home-sk-sub-sm {
    width: 180px;
    height: 12px;
    border-radius: 4px;
}

.home-sk-search-bar {
    width: 100%;
    min-height: 46px;
    border-radius: 11px;
}

/* 3. Section Containers */
.home-sk-section {
    margin-bottom: 16px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--home-border, #d8e3ef);
    border-radius: 18px;
    box-shadow: 0 3px 12px rgba(22, 71, 127, .04);
}

.home-sk-section-header {
    display: flex;
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #e6edf5;
}

.home-sk-section-title {
    width: 160px;
    height: 18px;
    border-radius: 5px;
}

.home-sk-section-sub {
    width: 80px;
    height: 14px;
    border-radius: 4px;
}

/* Layanan Mandiri (Shortcuts) */
.home-sk-shortcuts {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 10px;
    padding: 16px;
}

.home-sk-shortcut-card {
    display: flex;
    min-height: 126px;
    padding: 13px 8px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #dce6ef;
    border-radius: 14px;
}

.home-sk-shortcut-icon {
    width: 48px;
    height: 48px;
    border-radius: 13px;
}

.home-sk-shortcut-text {
    width: 70%;
    height: 12px;
    border-radius: 4px;
}

.home-sk-shortcut-desc {
    width: 50%;
    height: 10px;
    border-radius: 3px;
}

/* Statistics */
.home-sk-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 16px;
}

.home-sk-stat-card {
    display: flex;
    min-height: 98px;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid #dce6ef;
    border-radius: 14px;
}

.home-sk-stat-icon {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border-radius: 12px;
}

.home-sk-stat-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.home-sk-stat-label {
    width: 85px;
    height: 11px;
    border-radius: 3px;
}

.home-sk-stat-val {
    width: 60px;
    height: 22px;
    border-radius: 4px;
}

.home-sk-stat-note {
    width: 110px;
    height: 10px;
    border-radius: 3px;
}

/* Books */
.home-sk-books {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 16px;
}

.home-sk-book-card {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #dce6ef;
    border-radius: 14px;
}

.home-sk-book-cover {
    width: 88px;
    height: 132px;
    border-radius: 8px;
}

.home-sk-book-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.home-sk-book-title {
    width: 90%;
    height: 14px;
    border-radius: 4px;
}

.home-sk-book-author {
    width: 65%;
    height: 11px;
    border-radius: 3px;
}

.home-sk-book-badge {
    width: 75px;
    height: 18px;
    margin-top: auto;
    border-radius: 999px;
}

/* News */
.home-sk-news {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 16px;
}

.home-sk-news-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #dce6ef;
    border-radius: 14px;
}

.home-sk-news-thumb {
    flex: 0 0 70px;
    width: 70px;
    height: 52px;
    border-radius: 8px;
}

.home-sk-news-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.home-sk-news-title {
    width: 90%;
    height: 14px;
    border-radius: 4px;
}

.home-sk-news-date {
    width: 60px;
    height: 10px;
    border-radius: 3px;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .home-page-skeleton {
        top: 72px;
    }

    .home-sk-hero {
        margin: 0 12px 12px;
        height: 178px;
        border-radius: 16px;
    }

    .home-sk-search,
    .home-sk-section {
        margin: 0 12px 12px;
        border-radius: 16px;
        box-shadow: none;
    }

    .home-sk-search {
        display: block;
        padding: 13px;
    }

    .home-sk-search-heading {
        margin-bottom: 11px;
    }

    .home-sk-shortcuts,
    .home-sk-stats,
    .home-sk-books,
    .home-sk-news {
        display: flex;
        gap: 9px;
        padding: 12px 12px 14px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .home-sk-shortcuts::-webkit-scrollbar,
    .home-sk-stats::-webkit-scrollbar,
    .home-sk-books::-webkit-scrollbar,
    .home-sk-news::-webkit-scrollbar {
        display: none;
    }

    .home-sk-shortcut-card {
        flex: 0 0 112px;
        min-height: 116px;
    }

    .home-sk-stat-card {
        flex: 0 0 174px;
        min-height: 104px;
    }

    .home-sk-book-card {
        flex: 0 0 250px;
        grid-template-columns: 84px minmax(0, 1fr);
    }

    .home-sk-news-card {
        flex: 0 0 250px;
    }
}
