:root {
    --cner-navy: #0f2c59;
    --cner-navy-hover: #1e447b;
    --cner-green: #4ade80;
    --cner-gold: #bfa15f;
    --cner-white: #ffffff;
    --cner-slate-100: #f1f5f9;
    --cner-slate-300: #cbd5e1;
    --cner-slate-400: #94a3b8;
    --cner-slate-700: #334155;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont,
                 "Segoe UI", Arial, sans-serif;
}

button,
input,
textarea,
select {
    font: inherit;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(15, 44, 89, 0.18);
}

.institutional-header {
    min-height: 130px;
    padding: 16px max(24px, calc((100% - 1280px) / 2));
    display: grid;
    grid-template-columns: minmax(230px, 1fr) minmax(480px, 2.25fr) minmax(260px, 1fr);
    align-items: center;
    gap: 28px;
    color: var(--cner-white);
    background: var(--cner-navy);
    border-bottom: 1px solid rgba(191, 161, 95, 0.3);
}

.institutional-side {
    display: flex;
    align-items: center;
    gap: 16px;
}

.institutional-side--ministry {
    justify-content: flex-end;
    text-align: right;
}

.institutional-logo {
    width: auto;
    max-width: 86px;
    height: 56px;
    object-fit: contain;
    flex: 0 0 auto;
}

.institutional-side p,
.cner-identity p {
    margin: 0;
}

.institutional-primary {
    font-size: 0.75rem;
    font-weight: 700;
}

.institutional-amazigh {
    margin-top: 2px !important;
    color: var(--cner-green);
    font-size: 0.7rem;
    font-weight: 600;
}

.institutional-secondary {
    margin-top: 2px !important;
    color: var(--cner-slate-300);
    font-size: 0.7rem;
    white-space: nowrap;
}

.cner-identity {
    padding: 4px 32px;
    text-align: center;
    border-inline: 1px solid rgba(255, 255, 255, 0.1);
}

.cner-supervision {
    color: var(--cner-slate-300);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.cner-direction {
    margin-top: 3px !important;
    color: var(--cner-slate-400);
    font-size: 0.58rem;
}

.cner-divider {
    display: block;
    width: 64px;
    height: 1px;
    margin: 9px auto;
    background: linear-gradient(to right, transparent, rgba(191, 161, 95, 0.7), transparent);
}

.cner-title {
    font-size: clamp(0.5rem, 1.2vw, 0.9rem);
    font-weight: 700;
    line-height: 1.55;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.cner-title-ar {
    margin-top: 5px !important;
    color: var(--cner-slate-300);
    font-size: 1rem;
    font-weight: 600;
}

.main-navigation {
    min-height: 56px;
    background: var(--cner-white);
    border-bottom: 1px solid #dfe5ed;
}

.navigation-links {
    width: min(100%, 1280px);
    min-height: 56px;
    margin: 0 auto;
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.navigation-links a {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 30px;
    color: var(--cner-navy);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-decoration: none;
    text-transform: uppercase;
    transition: color 160ms ease, background-color 160ms ease;
}

.navigation-links a:hover,
.navigation-links a:focus-visible {
    color: var(--cner-navy-hover);
    background: var(--cner-slate-100);
}

.navigation-links a.active {
    color: var(--cner-navy);
    background: #f8fafc;
}

.navigation-links a.active::after {
    position: absolute;
    right: 24px;
    bottom: 0;
    left: 24px;
    height: 4px;
    content: "";
    background: var(--cner-gold);
}

.menu-toggle {
    display: none;
}

.site-footer {
    padding: 28px 24px;
    color: var(--cner-slate-300);
    text-align: center;
    background: var(--cner-navy);
}

.site-footer p {
    margin: 0 0 12px;
    font-weight: 700;
}

.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 24px;
}

.site-footer a {
    color: var(--cner-white);
    font-size: 0.8rem;
    text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
    text-decoration: underline;
}

.page-shell {
    width: min(1120px, calc(100% - 40px));
    min-height: calc(100vh - 300px);
    margin: 0 auto;
    padding: 64px 0;
}

.page-intro {
    padding: clamp(28px, 5vw, 56px);
    background: var(--cner-white);
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(15, 44, 89, 0.08);
}

.page-kicker {
    margin: 0 0 8px;
    color: var(--cner-gold);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.page-intro h1 {
    margin: 0;
    color: var(--cner-navy);
    font-size: clamp(2rem, 5vw, 3.5rem);
}

.page-placeholder {
    max-width: 720px;
    margin: 18px 0 0;
    color: var(--cner-slate-700);
    line-height: 1.75;
}

@media (max-width: 1050px) {
    .institutional-header {
        grid-template-columns: 1fr 1fr;
    }

    .cner-identity {
        grid-column: 1 / -1;
        grid-row: 1;
        padding-bottom: 16px;
        border-inline: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

@media (max-width: 700px) {
    .site-header {
        position: relative;
    }

    .institutional-header {
        display: flex;
        flex-direction: column;
        min-height: auto;
        padding: 22px;
    }

    .cner-identity {
        order: -1;
        width: 100%;
        padding: 0 0 18px;
    }

    .institutional-side,
    .institutional-side--ministry {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .cner-title {
        font-size: 0.9rem;
        letter-spacing: 0.1em;
    }

    .main-navigation {
        min-height: auto;
    }

    .menu-toggle {
        width: 100%;
        min-height: 54px;
        padding: 0 22px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        color: var(--cner-navy);
        font-weight: 700;
        background: var(--cner-white);
        border: 0;
        cursor: pointer;
    }

    .navigation-links {
        display: none;
        min-height: 0;
        flex-direction: column;
    }

    .navigation-links.is-open {
        display: flex;
    }

    .navigation-links a {
        min-height: 50px;
        padding: 0 22px;
        border-top: 1px solid #e5eaf0;
    }

    .navigation-links a.active::after {
        inset: 0 auto 0 0;
        width: 4px;
        height: auto;
    }
}
