:root {
    color-scheme: dark;
    --green: #05423a;
    --green-deep: #03362f;
    --gold: #b9a779;
    --gold-light: #d7c99d;
    --text: #ffffff;
    --muted: #d4dfdb;
    font-family: "Noto Naskh Arabic", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
    color: var(--text);
    background: var(--green-deep);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: var(--green-deep);
}

.verification-shell {
    position: relative;
    width: 100%;
    min-height: 100vh;
    padding: 2.5rem 2.25rem 3rem;
    overflow: hidden;
    color: var(--text);
    background:
        radial-gradient(circle at 50% 42%, transparent 0 22%, rgb(0 20 18 / 22%) 86%),
        linear-gradient(90deg, rgb(0 0 0 / 8%), transparent 18%, transparent 82%, rgb(0 0 0 / 8%)),
        url("/assets/header_img.png") center top / auto 13.5rem repeat-y,
        var(--green);
    isolation: isolate;
}

.certificate-border {
    position: absolute;
    inset: 0;
    z-index: 3;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
    user-select: none;
}

.verification-shell > *:not(.certificate-border) {
    position: relative;
    z-index: 1;
}

.verification-header {
    margin-bottom: 1.75rem;
    text-align: center;
}

.header-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    direction: ltr;
}

.authority-lockup {
    display: flex;
    align-items: flex-start;
}

.ministry-lockup {
    display: block;
    width: 7.5rem;
    height: 3.25rem;
    object-fit: contain;
    object-position: left center;
}

.language-toggle {
    display: grid;
    inline-size: 5rem;
    block-size: 2.25rem;
    flex: 0 0 auto;
    padding: 0;
    place-items: center;
    border: 1px solid var(--gold);
    border-radius: 0.15rem;
    color: var(--gold-light);
    background: rgb(3 54 47 / 68%);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.language-toggle:hover {
    color: var(--green-deep);
    background: var(--gold-light);
    transform: translateY(-1px);
}

.language-toggle:focus-visible {
    outline: 3px solid rgb(215 201 157 / 42%);
    outline-offset: 3px;
}

.identity-lockup {
    margin: 1.25rem auto 1.1rem;
    font-family: "Noto Naskh Arabic", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
    text-align: center;
}

.republic-logo {
    display: block;
    width: 5rem;
    height: 3.75rem;
    margin: 0 auto 0.15rem;
    object-fit: contain;
}

.republic-ar {
    color: var(--gold);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.05;
    direction: rtl;
    unicode-bidi: isolate;
}

.republic-en {
    margin-top: 0.25rem;
    color: var(--gold-light);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    line-height: 1;
    text-transform: uppercase;
    direction: ltr;
    unicode-bidi: isolate;
}

.title-heading-row {
    display: grid;
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
    grid-template-columns: 1.2rem max-content 1.2rem;
    grid-template-areas: "left title right";
    align-items: center;
    gap: 0.3rem;
    direction: ltr;
}

.title-flourish {
    display: block;
    width: 100%;
    height: 1.6rem;
    object-fit: contain;
}

.title-flourish-left { grid-area: left; }
.title-flourish-right { grid-area: right; }
#page-title-text { grid-area: title; white-space: nowrap; }

.verification-header h1 {
    margin: 0;
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.15;
    text-shadow: 0 0.15rem 0.35rem rgb(0 0 0 / 24%);
}

.title-kicker {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--gold);
    font-size: 0.72rem;
    font-weight: 700;
}

html[lang="en"] {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[lang="en"] .title-kicker {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.62rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    white-space: nowrap;
}

@media (min-width: 23rem) {
    .title-heading-row {
        grid-template-columns: 1.45rem max-content 1.45rem;
        gap: 0.5rem;
    }

    .title-flourish { height: 1.9rem; }
    .verification-header h1 { font-size: clamp(1.3rem, 6vw, 1.8rem); }
}

.title-divider {
    display: grid;
    width: min(100%, 15rem);
    height: 1rem;
    margin: 0.65rem auto 0.75rem;
    grid-template-columns: 1fr 0.6rem 1fr;
    align-items: center;
    gap: 0.65rem;
}

.title-divider span {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold));
}

.title-divider span:last-child { transform: scaleX(-1); }

.title-divider i {
    width: 0.42rem;
    height: 0.42rem;
    background: var(--gold);
    transform: rotate(45deg);
}

.verification-header p:last-child {
    max-width: 28rem;
    margin: 0 auto;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.state,
.verification-result {
    padding: 1.15rem;
    border: 1px solid rgb(185 167 121 / 72%);
    border-radius: 0.45rem;
    background: rgb(0 47 41 / 68%);
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / 3%), 0 0.7rem 2rem rgb(0 20 18 / 16%);
    backdrop-filter: blur(2px);
}

#loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    margin: 0;
}

#loading::before {
    width: 0.75rem;
    height: 0.75rem;
    border: 2px solid rgb(215 201 157 / 35%);
    border-top-color: var(--gold-light);
    border-radius: 50%;
    content: "";
    animation: spin 800ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.verification-result h2,
.error-state h2 {
    margin: 0 0 0.4rem;
    color: var(--text);
    font-size: 1.45rem;
    font-weight: 600;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem;
    padding: 0.35rem 0.7rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.status-badge::before {
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.status-badge.valid { color: #bfe8cf; background: rgb(23 105 76 / 35%); }
.status-badge.revoked { color: #ffd0c9; background: rgb(139 53 43 / 35%); }

.certificate-fields {
    display: block;
    margin: 0;
}

.certificate-fields dt,
.certificate-fields dd {
    min-width: 0;
    margin: 0;
    border-top: 1px solid rgb(185 167 121 / 35%);
}

.certificate-fields dt {
    padding: 0.8rem 0 0.15rem;
    color: var(--gold-light);
    font-size: 0.78rem;
    font-weight: 700;
}

.certificate-fields dd {
    padding: 0.1rem 0 0.8rem;
    overflow-wrap: anywhere;
    color: var(--text);
    font-weight: 600;
}

.error-state {
    border-color: rgb(226 151 139 / 72%);
    background: rgb(91 30 26 / 62%);
}

.error-state p {
    margin: 0;
    color: #f3d8d3;
    line-height: 1.6;
}

@media (min-width: 40rem) {
    body { padding: clamp(2rem, 7vh, 5rem) 1.5rem; }

    .verification-shell {
        width: min(100%, 52rem);
        min-height: 0;
        margin: 0 auto;
        padding: clamp(2.75rem, 5vw, 4rem);
        box-shadow: 0 1.5rem 4rem rgb(0 20 17 / 35%);
    }

    .ministry-lockup { width: 10.5rem; height: 4.2rem; }
    .language-toggle { font-size: 0.8rem; }
    .identity-lockup { margin: 1.4rem auto 1.25rem; }
    .republic-logo { width: 6.5rem; height: 4.8rem; }
    .republic-ar { font-size: 1.35rem; }
    .republic-en { font-size: 0.7rem; }
    .title-heading-row {
        grid-template-columns: 3rem max-content 3rem;
        gap: 1rem;
    }
    .title-flourish { height: 3.5rem; }
    .verification-header h1 { font-size: clamp(2.25rem, 4.5vw, 3rem); }
    .title-kicker { font-size: 0.85rem; }
    html[lang="en"] .title-kicker { font-size: 0.95rem; letter-spacing: 0.14em; }

    .state,
    .verification-result { padding: 1.5rem 1.75rem; }
    .verification-result h2,
    .error-state h2 { font-size: 1.8rem; }

    .certificate-fields {
        display: grid;
        grid-template-columns: minmax(12rem, 0.9fr) minmax(13rem, 2fr);
    }

    .certificate-fields dt,
    .certificate-fields dd { padding: 0.85rem 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}
