/* =========================================
   SNPD - DIVISI DAN PANGKAT KEPOLISIAN
   Main Stylesheet
========================================= */

/* =========================================
   1. THEME & GLOBAL
========================================= */
:root {
    color-scheme: dark;
    --bg: #090e17;
    --panel: #111b2a;
    --panel-deep: #0a111e;
    --border: #293447;
    --text: #f5f7fb;
    --muted: #a2adbf;
    --red: #ed4756;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background:
        linear-gradient(110deg, rgba(8, 13, 22, .94), rgba(8, 13, 22, .86)),
        url("../bg.png") center / cover fixed;
    background-color: var(--bg);
}

a {
    color: inherit;
}

/* =========================================
   2. CONTENT & BREADCRUMB
========================================= */
.wrap {
    flex: 1;
    width: 100%;
    max-width: 1260px;
    margin: 0 auto;
    padding: 56px 24px 90px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 1px;
}

.breadcrumb a {
    text-decoration: none;
}

.breadcrumb a:hover,
.breadcrumb span[aria-current] {
    color: var(--red);
}

/* =========================================
   3. HERO
========================================= */
.hero {
    max-width: 900px;
    margin: 38px 0 65px;
}

.eyebrow {
    color: var(--red);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 2px;
}

.hero h1 {
    margin: 15px 0;
    font-size: clamp(32px, 5vw, 58px);
    line-height: 1.1;
    letter-spacing: -1px;
}

.hero em {
    color: var(--red);
    font-style: normal;
}

.hero p {
    max-width: 750px;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.75;
}

.summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.summary span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: rgba(17, 27, 42, .88);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .4px;
}

.summary strong {
    color: var(--red);
    font-size: 18px;
}

/* =========================================
   4. SECTION HEADERS
========================================= */
.content-section + .content-section {
    margin-top: 68px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 22px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.section-head h2 {
    margin: 0;
    font-size: 20px;
    letter-spacing: .7px;
}

.section-head span {
    color: var(--muted);
    font-size: 12px;
}

/* =========================================
   5. DIVISION CARDS
========================================= */
.division-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.division-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;

    min-width: 0;
    min-height: 180px;

    padding: 20px 15px;

    border: 1px solid var(--border);
    border-radius: 13px;

    background: linear-gradient(
        155deg,
        #172132f5,
        #101723ed
    );

    text-align: center;
}

.division-icon {
    display: grid;
    place-items: center;

    width: 56px;
    height: 56px;

    border: 1px solid rgba(237, 71, 86, 0.3);
    border-radius: 14px;

    background: rgba(237, 71, 86, 0.1);

    color: var(--red);
    font-size: 26px;

    flex-shrink: 0;
}

.division-logo {
    display: block;

    width: 80px;
    height: 80px;

    max-width: 100%;

    object-fit: contain;
    object-position: center;

    flex-shrink: 0;
}

.division-card h3 {
    margin: 0;

    font-size: 17px;
    line-height: 1.4;
    letter-spacing: 0.6px;

    overflow-wrap: anywhere;
}

@media (max-width: 650px) {

    .division-card {
        min-height: 155px;
        padding: 16px 10px;
        gap: 12px;
    }

    .division-logo {
        width: 64px;
        height: 64px;
    }

    .division-card h3 {
        font-size: 14px;
    }

}

/* =========================================
   6. SEARCH AND FILTER
========================================= */
.toolbar {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(16, 26, 41, .94);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.field-search {
    flex: 1 1 230px;
    min-width: 0;
}

.field-filter {
    flex: 0 1 245px;
    min-width: 180px;
}

.field label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .9px;
}

.field input,
.field select {
    width: 100%;
    min-height: 45px;
    padding: 12px;
    border: 1px solid #435066;
    border-radius: 7px;
    background: var(--panel-deep);
    color: var(--text);
    font: inherit;
    font-size: 14px;
}

.field input::placeholder {
    color: #8b95a7;
    font-style: italic;
    opacity: 1;
}

.reset-btn {
    min-height: 45px;
    padding: 12px 23px;
    border: 0;
    border-radius: 7px;
    background: var(--red);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.field :is(input, select):focus-visible,
.reset-btn:focus-visible,

.result-count {
    margin: 20px 0;
    color: var(--muted);
    font-size: 13px;
}

/* =========================================
   7. RANK CARDS AND IMAGES
========================================= */
.rank-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}

.rank-card {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: linear-gradient(155deg, #172132f5, #101723ed);
    transition: border-color .2s ease, transform .2s ease;
}

.rank-card:hover {
    border-color: rgba(237, 71, 86, .7);
    transform: translateY(-3px);
}

.rank-visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 145px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 9px;
    background: #090f19;
    overflow: hidden;
}

.rank-visual img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
}

.rank-fallback {
    display: none;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.rank-visual.image-error img {
    display: none;
}

.rank-visual.image-error .rank-fallback {
    display: block;
}

.rank-meta {
    padding: 11px 2px 2px;
}

.rank-group {
    color: var(--red);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.rank-meta h3 {
    margin: 7px 0 5px;
    font-size: 17px;
}

.rank-meta p {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.empty,
.loading {
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--muted);
    text-align: center;
}

.empty {
    grid-column: 1 / -1;
}

/* =========================================
   8. NOTES & FOOTER
========================================= */
.notice {
    margin-top: 28px;
    padding: 16px 18px;
    border-left: 3px solid var(--red);
    background: #172030;
    color: #b7c0cd;
    font-size: 13px;
    line-height: 1.8;
}

.notice strong {
    color: var(--text);
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 24px max(5%, calc((100vw - 1260px) / 2));
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
}

/* =========================================
   9. RESPONSIVE GRID
========================================= */

/* Laptop dan tablet landscape: 4 kolom pangkat. */
@media (max-width: 1200px) {
    .rank-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Tablet: 3 kolom agar kartu tidak terlalu besar. */
@media (max-width: 950px) {
    .division-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rank-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .rank-visual {
        height: 135px;
    }
}

/* =========================================
   10. RESPONSIVE MOBILE
========================================= */
@media (max-width: 650px) {
    body {
        background-attachment: scroll;
    }

    .wrap {
        padding: 40px 18px 65px;
    }

    .hero {
        margin: 28px 0 45px;
    }

    .hero p {
        font-size: 14px;
    }

    .section-head h2 {
        font-size: 16px;
    }

    .division-grid,
    .rank-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .division-card {
        min-height: 140px;
        padding: 18px 10px;
    }

    .division-card h3 {
        font-size: 13px;
    }

    .rank-card {
        padding: 9px;
    }

    .rank-visual {
        height: 120px;
        padding: 8px;
    }

    .rank-meta {
        padding-top: 10px;
    }

    .rank-meta h3 {
        font-size: 15px;
    }

    .rank-meta p {
        font-size: 11px;
    }

    .field-search,
    .field-filter {
        flex: 1 1 100%;
        min-width: 0;
    }

    .reset-btn {
        width: 100%;
    }

    .site-footer {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px 18px;
    }
}

/* Layar HP sempit: satu kartu agar gambar tetap terbaca. */
@media (max-width: 420px) {
    .rank-grid {
        grid-template-columns: 1fr;
    }

    .rank-visual {
        height: 165px;
    }
}

/* =========================================
   11. ACCESSIBILITY
========================================= */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .rank-card {
        transition: none;
    }

    .rank-card:hover {
        transform: none;
    }
}
