/* ========================================================
   ROBOTIKA UPGRIS - PRESTASI PAGE STYLES
   Page Scoping: .page-prestasi
   ======================================================== */

/* ── Page Hero ── */
    .page-hero { padding-top: 3rem; }
    .page-hero-title {
        font-size: 2.5rem; font-weight: 800; font-family: var(--pixel-font);
        color: var(--text-main); line-height: 1.5;
    }
    .page-hero-desc {
        font-size: 1rem; color: var(--text-muted);
        max-width: 520px; line-height: 1.7;
    }
    .text-gradient {
        color: var(--primary); -webkit-text-fill-color: var(--primary);
    }
    .section-badge {
        background: var(--surface); color: var(--text-main); border: 4px solid var(--border);
        font-size: 0.6rem; font-family: var(--pixel-font); padding: 0.5em 1em;
    }
    .counter-pill {
        display: inline-flex; align-items: center; gap: 0.5rem;
        font-family: var(--pixel-font); font-size: 0.65rem; padding: 0.8em 1.2em;
        border: 4px solid var(--border); background: var(--surface); color: var(--text-main);
    }

    /* ── Grid Galeri (Uniform Sizing) ── */
    .prestasi-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1.75rem;
    }
    .prestasi-item {
        display: flex;
        animation: slideUp 0.4s ease both;
    }

    /* Stagger Animation */
    .prestasi-item:nth-child(1)  { animation-delay: 0.04s; }
    .prestasi-item:nth-child(2)  { animation-delay: 0.09s; }
    .prestasi-item:nth-child(3)  { animation-delay: 0.14s; }
    .prestasi-item:nth-child(4)  { animation-delay: 0.19s; }
    .prestasi-item:nth-child(5)  { animation-delay: 0.24s; }
    .prestasi-item:nth-child(6)  { animation-delay: 0.29s; }
    .prestasi-item:nth-child(7)  { animation-delay: 0.34s; }
    .prestasi-item:nth-child(8)  { animation-delay: 0.39s; }
    .prestasi-item:nth-child(9)  { animation-delay: 0.44s; }
    .prestasi-item:nth-child(10) { animation-delay: 0.49s; }

    /* ── Prestasi Card ── */
    .prestasi-card {
        width: 100%;
        display: flex;
        flex-direction: column;
        background: var(--surface);
        border: 4px solid var(--border);
        overflow: hidden;
        transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s, box-shadow 0.2s;
        position: relative;
        cursor: pointer;
        user-select: none;
    }
    .prestasi-card:hover,
    .prestasi-card:focus-visible {
        transform: translateY(-6px);
        border-color: var(--primary);
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
        outline: none;
    }

    /* Foto dengan tinggi dan aspek rasio pasti seragam */
    .prestasi-img-wrapper,
    .prestasi-img-placeholder {
        width: 100%;
        height: 220px;
        min-height: 220px;
        max-height: 220px;
        position: relative;
        overflow: hidden;
        border-bottom: 4px solid var(--border);
        background: var(--bg);
        flex-shrink: 0;
    }
    .prestasi-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        display: block;
        transition: transform 0.4s ease, filter 0.3s;
        filter: grayscale(100%) contrast(1.2);
    }
    .prestasi-card:hover .prestasi-img,
    .prestasi-card:focus-visible .prestasi-img {
        transform: scale(1.05);
        filter: grayscale(0%) contrast(1.1);
    }
    .prestasi-img-overlay {
        position: absolute;
        inset: 0;
        background: linear-gradient(to top, rgba(0,0,0,0.65), transparent 70%);
        pointer-events: none;
    }
    .prestasi-img-placeholder {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 3.5rem;
        color: var(--text-muted);
    }

    /* Card Body */
    .prestasi-body {
        padding: 1.25rem;
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        justify-content: space-between;
    }
    .prestasi-judul {
        font-size: 0.85rem;
        font-family: var(--pixel-font);
        color: var(--text-main);
        margin: 0 0 1rem 0;
        line-height: 1.5;
        text-transform: uppercase;
        text-shadow: 2px 2px 0px var(--border);
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        height: 2.55rem; /* Menjamin slot 2 baris sama persis di seluruh kartu */
    }
    .prestasi-meta {
        margin-top: auto;
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
        padding-top: 0.75rem;
        border-top: 2px dashed var(--border);
    }
    .prestasi-meta-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }
    .prestasi-pemenang {
        font-size: 0.6rem;
        font-family: var(--pixel-font);
        color: #000;
        background: var(--primary);
        padding: 0.4em 0.8em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 160px;
        display: inline-block;
        border: 2px solid var(--border);
    }
    .prestasi-tanggal {
        font-size: 0.6rem;
        color: var(--text-muted);
        font-family: var(--pixel-font);
        white-space: nowrap;
    }
    .prestasi-hint {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        font-family: var(--pixel-font);
        font-size: 0.52rem;
        color: var(--text-muted);
        transition: color 0.2s;
    }
    .prestasi-card:hover .prestasi-hint,
    .prestasi-card:focus-visible .prestasi-hint {
        color: var(--primary);
    }

    /* ── Retro Modal Styling (Fixed Viewport & Scrollable) ── */
    #modalDetailPrestasi {
        z-index: 99999 !important;
    }
    .modal-backdrop.show {
        z-index: 99990 !important;
    }
    .modal-prestasi-dialog {
        max-width: 580px;
        margin: 1.25rem auto;
        max-height: calc(100vh - 2.5rem);
    }
    .retro-modal-content {
        background: var(--surface);
        border: 4px solid var(--border);
        border-radius: 0;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), 0 0 25px rgba(250, 204, 21, 0.2);
        color: var(--text-main);
        max-height: calc(100vh - 2.5rem);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .retro-modal-header {
        background: var(--bg);
        border-bottom: 4px solid var(--border);
        padding: 0.85rem 1.25rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
    }
    .modal-badge-pixel {
        font-family: var(--pixel-font);
        font-size: 0.65rem;
        color: var(--primary);
        letter-spacing: 1px;
    }
    .retro-btn-close {
        background: transparent;
        border: 2px solid var(--border);
        color: var(--text-muted);
        font-family: var(--pixel-font);
        font-size: 0.7rem;
        padding: 0.3em 0.6em;
        cursor: pointer;
        transition: all 0.15s;
    }
    .retro-btn-close:hover {
        background: var(--danger);
        color: #fff;
        border-color: var(--danger);
    }
    .retro-modal-body {
        padding: 1.25rem;
        flex: 1 1 auto;
        overflow-y: auto;
    }
    .modal-foto-wrapper {
        max-width: 360px;
        height: 175px;
        margin: 0 auto 1.15rem auto;
        overflow: hidden;
        border: 3px solid var(--border);
        background: var(--bg);
        text-align: center;
        box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.4);
    }
    .modal-foto-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        display: block;
    }
    .modal-foto-placeholder {
        max-width: 360px;
        height: 130px;
        margin: 0 auto 1.15rem auto;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 3rem;
        background: var(--bg);
        border: 3px solid var(--border);
        color: var(--text-muted);
    }
    .modal-prestasi-judul {
        font-family: var(--pixel-font);
        font-size: 1.05rem;
        color: var(--primary);
        line-height: 1.5;
        text-transform: uppercase;
        text-align: center;
    }
    .modal-meta-pill {
        font-family: var(--pixel-font);
        font-size: 0.6rem;
        padding: 0.45em 0.8em;
        border: 2px solid var(--border);
        background: var(--bg);
        color: var(--text-main);
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
    }
    .pill-pemenang {
        background: var(--primary);
        color: #000;
        border-color: var(--border);
    }
    .modal-desc-box {
        background: var(--bg);
        border: 3px solid var(--border);
        padding: 1rem 1.15rem;
        margin-top: 0.75rem;
    }
    .modal-desc-header {
        font-family: var(--pixel-font);
        font-size: 0.62rem;
        color: var(--primary);
        margin-bottom: 0.6rem;
    }
    .modal-desc-content {
        font-size: 0.95rem;
        line-height: 1.65;
        color: var(--text-main);
        white-space: pre-line;
        word-break: break-word;
    }
    .retro-modal-footer {
        background: var(--bg);
        border-top: 4px solid var(--border);
        padding: 0.75rem 1.25rem;
        display: flex;
        justify-content: flex-end;
        flex-shrink: 0;
    }
    .retro-btn-action {
        background: var(--surface);
        color: var(--text-main);
        border: 3px solid var(--border);
        font-family: var(--pixel-font);
        font-size: 0.65rem;
        padding: 0.5em 1.2em;
        cursor: pointer;
        transition: all 0.15s;
    }
    .retro-btn-action:hover {
        background: var(--primary);
        color: #000;
        border-color: var(--primary);
    }

    /* ── Compact Screen Adjustment (Layar Pendek / Laptop / Mobile) ── */
    @media (max-height: 700px) {
        .modal-prestasi-dialog {
            margin: 0.5rem auto;
            max-height: calc(100vh - 1rem);
        }
        .retro-modal-content {
            max-height: calc(100vh - 1rem);
        }
        .retro-modal-header {
            padding: 0.6rem 1rem;
        }
        .retro-modal-footer {
            padding: 0.5rem 1rem;
        }
        .modal-foto-wrapper {
            height: 130px;
            max-width: 280px;
            margin-bottom: 0.75rem;
        }
        .modal-foto-placeholder {
            height: 90px;
            max-width: 220px;
            font-size: 2.2rem;
            margin-bottom: 0.75rem;
        }
        .modal-prestasi-judul {
            font-size: 0.9rem;
            margin-bottom: 0.5rem !important;
        }
        .retro-modal-body {
            padding: 0.85rem;
        }
        .modal-desc-box {
            padding: 0.75rem 0.9rem;
        }
    }

    /* ── Responsive Grid Breakpoints ── */
    @media (max-width: 991.98px) {
        .prestasi-grid { grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
    }
    @media (max-width: 640.98px) {
        .prestasi-grid { grid-template-columns: 1fr; gap: 1rem; }
        .page-hero-title { font-size: 1.85rem; }
        .prestasi-pemenang { max-width: 140px; }
    }
