/*
 * ECD MIS public landing pages.
 * First-party only: no external fonts, scripts or stylesheets, so the pages
 * can run under a strict Content Security Policy (style-src 'self').
 */

@font-face {
    font-family: "Nunito";
    src: url("../backoffice/fonts/Nunito-Regular.woff2") format("woff2"),
        url("../backoffice/fonts/Nunito-Regular.woff") format("woff");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Nunito";
    src: url("../backoffice/fonts/Nunito-Bold.woff2") format("woff2"),
        url("../backoffice/fonts/Nunito-Bold.woff") format("woff");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    /* County palette, shared with sports.makueni.go.ke */
    --ink: #1c2b23;
    --ink-soft: #3d5047;
    --muted: #5f7066;
    --paper: #fbf8f2;
    --sand: #f3ecdf;
    --white: #ffffff;
    --green-950: #072716;
    --green-900: #0b3d24;
    --green-700: #14603a;
    --green-600: #1a7a4a;
    --green-100: #e8f5ee;
    --blue-600: #0d56a8;
    --blue-100: #e4eefa;
    --sun-400: #fdd102;
    --sun-100: #fff5c2;
    --sun-ink: #7a6200;
    --clay-500: #b9482f;
    --clay-100: #f8e2da;
    --tricolour: linear-gradient(90deg, var(--green-600) 0 40%, var(--sun-400) 40% 70%, var(--blue-600) 70% 100%);
    --line: rgba(19, 38, 29, 0.12);
    --radius-sm: 10px;
    --radius: 18px;
    --radius-lg: 28px;
    --shadow-sm: 0 1px 2px rgba(10, 58, 43, 0.06), 0 2px 8px rgba(10, 58, 43, 0.06);
    --shadow: 0 18px 40px -18px rgba(10, 58, 43, 0.35);
    --container: 1200px;
    --gutter: clamp(1rem, 4vw, 2rem);
    --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--ink);
    background: var(--paper);
    text-rendering: optimizeLegibility;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: var(--green-700);
    text-underline-offset: 3px;
}

a:hover {
    color: var(--green-900);
}

:focus-visible {
    outline: 3px solid var(--sun-400);
    outline-offset: 3px;
}

h1,
h2,
h3 {
    margin: 0 0 0.6em;
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.02em;
    color: var(--green-900);
}

p {
    margin: 0 0 1em;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    z-index: 100;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--green-900);
    color: var(--white);
    font-weight: 700;
}

.skip-link:focus {
    top: 1rem;
    color: var(--white);
}

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px;
    padding: 0.7rem 1.35rem;
    border: 2px solid transparent;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
}

.btn svg {
    width: 1.1em;
    height: 1.1em;
}

.btn-primary {
    background: var(--green-600);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--green-700);
    color: var(--white);
    transform: translateY(-1px);
}

.btn-ghost {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.7);
    color: var(--green-900);
}

.btn-ghost:hover {
    border-color: var(--green-700);
    color: var(--green-900);
}

.btn-sun {
    background: var(--sun-400);
    color: var(--green-950);
}

.btn-sun:hover {
    background: #ffdd3d;
    color: var(--green-950);
    transform: translateY(-1px);
}

.btn-outline-light {
    border-color: rgba(255, 255, 255, 0.4);
    color: var(--white);
}

.btn-outline-light:hover {
    border-color: var(--white);
    color: var(--white);
}

.btn-sm {
    min-height: 40px;
    padding: 0.45rem 1.05rem;
    font-size: 0.95rem;
}

/* ---------- Header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(251, 248, 242, 0.94);
    backdrop-filter: saturate(1.4) blur(10px);
    transition: box-shadow 0.2s;
}

.site-header.is-scrolled {
    box-shadow: 0 10px 30px -22px rgba(10, 58, 43, 0.6);
}

.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    min-height: 76px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: var(--ink);
    text-decoration: none;
}

.brand img {
    width: auto;
    height: 44px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    padding-left: 0.85rem;
    border-left: 1px solid var(--line);
    line-height: 1.2;
}

.brand-text strong {
    font-size: 1.05rem;
    color: var(--green-900);
}

.brand-text span {
    font-size: 0.8rem;
    color: var(--muted);
}

.site-nav ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav a:not(.btn) {
    display: block;
    padding: 0.5rem 0.95rem;
    border-radius: 999px;
    color: var(--ink-soft);
    font-weight: 700;
    text-decoration: none;
}

.site-nav a:not(.btn):hover,
.site-nav a[aria-current="page"]:not(.btn) {
    background: var(--green-100);
    color: var(--green-900);
}

.nav-toggle {
    display: none;
}

/* County tricolour strip across the top of the header, as on sports.makueni.go.ke */
.site-header::before {
    content: "";
    display: block;
    height: 4px;
    background: var(--tricolour);
}

@media (max-width: 860px) {
    .js .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: var(--white);
        color: var(--green-900);
        cursor: pointer;
    }

    .nav-toggle svg {
        width: 24px;
        height: 24px;
    }

    .nav-toggle .icon-close,
    .nav-toggle[aria-expanded="true"] .icon-menu {
        display: none;
    }

    .nav-toggle[aria-expanded="true"] .icon-close {
        display: block;
    }

    .js .site-nav {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        display: none;
        padding: 0.75rem var(--gutter) 1.25rem;
        border-bottom: 1px solid var(--line);
        background: var(--paper);
        box-shadow: var(--shadow);
    }

    .js .site-nav.is-open {
        display: block;
    }

    .js .site-nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
    }

    .js .site-nav a:not(.btn) {
        padding: 0.8rem 1rem;
    }

    .js .site-nav .btn {
        width: 100%;
        margin-top: 0.5rem;
    }
}

@media (max-width: 520px) {
    .brand-text {
        display: none;
    }
}

/* ---------- Eyebrow ---------- */

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1rem;
    color: var(--green-700);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.eyebrow::before {
    content: "";
    width: 30px;
    height: 3px;
    border-radius: 2px;
    background: var(--tricolour);
}

/* ---------- Home hero ---------- */

.hero {
    position: relative;
    overflow: hidden;
    padding-block: clamp(2.5rem, 6vw, 5rem) clamp(3.5rem, 8vw, 6.5rem);
    background:
        radial-gradient(55% 60% at 92% 8%, var(--sun-100), transparent 70%),
        radial-gradient(45% 55% at 0% 100%, var(--green-100), transparent 70%);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    align-items: center;
    gap: clamp(2rem, 5vw, 4.5rem);
}

.hero h1 {
    margin-bottom: 1.25rem;
    font-size: clamp(2.3rem, 5.2vw, 4.1rem);
}

.hero h1 em {
    font-style: normal;
    color: var(--green-700);
    background: linear-gradient(transparent 64%, var(--sun-100) 64%);
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

.lead {
    max-width: 36em;
    color: var(--ink-soft);
    font-size: clamp(1.05rem, 1.5vw, 1.2rem);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.75rem;
}

.hero-levels {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0 0;
    padding: 0;
    list-style: none;
}

.hero-levels li {
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--white);
    color: var(--ink-soft);
    font-size: 0.85rem;
    font-weight: 700;
}

.hero-media {
    position: relative;
}

.hero-photo-main {
    overflow: hidden;
    aspect-ratio: 1 / 1.02;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.hero-photo-inset {
    position: absolute;
    bottom: -2rem;
    left: -2.5rem;
    width: 46%;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    border: 6px solid var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero-photo-main img,
.hero-photo-inset img,
.story-media img,
.about-media img,
.page-hero-media img,
.tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 960px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }

    .hero-media {
        width: 100%;
        max-width: 560px;
        margin: 1rem auto 0;
    }

    .hero-photo-inset {
        left: 0.75rem;
    }
}

@media (max-width: 520px) {
    .hero-photo-inset {
        bottom: -1.5rem;
        width: 52%;
        border-width: 4px;
    }
}

/* ---------- Figures (About page) ---------- */

.stat-value {
    display: block;
    color: var(--green-900);
    font-size: clamp(2rem, 4vw, 2.9rem);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    letter-spacing: -0.02em;
}

.stat-label {
    display: block;
    margin-top: 0.5rem;
    color: var(--ink-soft);
    font-size: 0.95rem;
    font-weight: 700;
}

/* ---------- Sections ---------- */

.section {
    padding-block: clamp(3.5rem, 8vw, 6.5rem);
}

.section-sand {
    background: var(--sand);
}

.section-flush-top {
    padding-top: 0;
}

.section-head {
    max-width: 46rem;
    margin-bottom: clamp(2rem, 4vw, 3rem);
}

.section-head h2 {
    font-size: clamp(1.9rem, 3.6vw, 2.75rem);
}

.section-head p:last-child {
    margin-bottom: 0;
    color: var(--ink-soft);
    font-size: 1.1rem;
}

/* ---------- Feature cards ---------- */

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.features-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.feature {
    padding: 1.6rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
    transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}

.feature:hover {
    border-color: transparent;
    box-shadow: var(--shadow);
    transform: translateY(-3px);
}

.feature-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin-bottom: 1.1rem;
    border-radius: 14px;
}

.feature-icon svg {
    width: 26px;
    height: 26px;
}

.feature h3 {
    margin-bottom: 0.45rem;
    font-size: 1.2rem;
}

.feature p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 1rem;
}

.tone-green {
    background: var(--green-100);
    color: var(--green-700);
}

.tone-blue {
    background: var(--blue-100);
    color: var(--blue-600);
}

.tone-sun {
    background: var(--sun-100);
    color: var(--sun-ink);
}

.tone-clay {
    background: var(--clay-100);
    color: var(--clay-500);
}

@media (max-width: 1060px) {
    .features-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 960px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .features-grid,
    .features-grid-4 {
        grid-template-columns: 1fr;
    }
}

/* ---------- Story rows ---------- */

.story {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: clamp(2rem, 6vw, 5rem);
}

.story + .story {
    margin-top: clamp(3.5rem, 8vw, 6rem);
}

.story-reverse .story-media {
    order: 2;
}

.story-media {
    position: relative;
    overflow: hidden;
    aspect-ratio: 5 / 4;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.story-tag {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    background: rgba(10, 58, 43, 0.9);
    color: var(--white);
    font-size: 0.85rem;
    font-weight: 700;
}

.story-body h2 {
    font-size: clamp(1.8rem, 3.2vw, 2.5rem);
}

.story-body p {
    color: var(--ink-soft);
}

.checklist {
    display: grid;
    gap: 0.75rem;
    margin: 1.5rem 0 0;
    padding: 0;
    list-style: none;
}

.checklist li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.checklist svg {
    flex: none;
    width: 22px;
    height: 22px;
    margin-top: 0.2rem;
    color: var(--green-600);
}

@media (max-width: 860px) {
    .story {
        grid-template-columns: 1fr;
    }

    .story-reverse .story-media {
        order: 0;
    }
}

/* ---------- Gallery ---------- */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-auto-flow: dense;
    grid-auto-rows: clamp(120px, 14vw, 180px);
    gap: 1rem;
}

.tile {
    position: relative;
    margin: 0;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--sand);
}

.tile a {
    display: block;
    height: 100%;
    cursor: zoom-in;
}

.tile img {
    transition: transform 0.6s ease;
}

.tile:hover img {
    transform: scale(1.04);
}

.tile-wide {
    grid-column: span 4;
    grid-row: span 2;
}

.tile-tall {
    grid-column: span 2;
    grid-row: span 2;
}

.tile-half {
    grid-column: span 3;
    grid-row: span 2;
}

.tile-third {
    grid-column: span 2;
    grid-row: span 2;
}

.pos-top img {
    object-position: 50% 22%;
}

.pos-bottom img {
    object-position: 50% 72%;
}

@media (max-width: 860px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 190px;
    }

    .tile-wide {
        grid-column: span 2;
    }

    .tile-tall,
    .tile-half,
    .tile-third {
        grid-column: span 1;
        grid-row: span 1;
    }

    .tile-tall {
        grid-row: span 2;
    }

    .tile:last-child {
        grid-column: span 2;
    }
}

@media (max-width: 520px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 230px;
    }

    .tile-wide,
    .tile-tall,
    .tile:last-child {
        grid-column: span 1;
        grid-row: span 1;
    }
}

/* ---------- Lightbox ---------- */

.lightbox {
    max-width: min(1100px, 94vw);
    max-height: 94vh;
    padding: 3.5rem 0 0;
    overflow: visible;
    border: 0;
    background: transparent;
}

.lightbox::backdrop {
    background: rgba(6, 20, 14, 0.88);
}

.lightbox img {
    width: auto;
    max-width: 100%;
    max-height: 78vh;
    margin-inline: auto;
    border-radius: var(--radius);
}

.lightbox-close {
    position: absolute;
    top: 0;
    right: 0;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: var(--white);
    cursor: pointer;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.lightbox-close svg {
    width: 22px;
    height: 22px;
}

/* ---------- Call to action ---------- */

.cta {
    position: relative;
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    align-items: center;
    gap: 2rem;
    overflow: hidden;
    padding: clamp(2rem, 5vw, 3.5rem);
    border-radius: var(--radius-lg);
    background: var(--green-900);
    color: var(--white);
}

.cta::after {
    content: "";
    position: absolute;
    top: -90px;
    right: -90px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(246, 185, 40, 0.35), transparent 70%);
    pointer-events: none;
}

.cta h2 {
    color: var(--white);
    font-size: clamp(1.7rem, 3vw, 2.3rem);
}

.cta p {
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
}

.cta-actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
}

@media (max-width: 760px) {
    .cta {
        grid-template-columns: 1fr;
    }

    .cta-actions {
        justify-content: flex-start;
    }
}

/* ---------- About page ---------- */

.page-hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: clamp(340px, 42vw, 500px);
    overflow: hidden;
    color: var(--white);
}

.page-hero-media {
    position: absolute;
    inset: 0;
}

.page-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(6, 28, 20, 0.1) 0%, rgba(6, 28, 20, 0.85) 100%);
}

.page-hero .container {
    position: relative;
    z-index: 1;
    padding-block: clamp(2rem, 5vw, 3.5rem);
}

.page-hero h1 {
    max-width: 16em;
    color: var(--white);
    font-size: clamp(2.2rem, 5vw, 3.6rem);
}

.page-hero p {
    max-width: 40rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.15rem;
}

.page-hero .eyebrow {
    color: var(--sun-400);
}

.about-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
    gap: clamp(2rem, 6vw, 5rem);
}

.prose h2 {
    font-size: clamp(1.8rem, 3.2vw, 2.5rem);
}

.prose p {
    color: var(--ink-soft);
    font-size: 1.1rem;
}

.about-media {
    overflow: hidden;
    aspect-ratio: 4 / 3.3;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.figures {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

.figure-card {
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
}

.figure-card small {
    display: block;
    margin-top: 0.4rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.figure-card progress {
    display: block;
    width: 100%;
    height: 8px;
    margin-top: 1rem;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: var(--green-100);
    -webkit-appearance: none;
    appearance: none;
}

.figure-card progress::-webkit-progress-bar {
    border-radius: 999px;
    background: var(--green-100);
}

.figure-card progress::-webkit-progress-value {
    border-radius: 999px;
    background: var(--green-600);
}

.figure-card progress::-moz-progress-bar {
    border-radius: 999px;
    background: var(--green-600);
}

@media (max-width: 960px) {
    .figures {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 860px) {
    .about-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .figures {
        grid-template-columns: 1fr;
    }
}

/* ---------- Footer ---------- */

.site-footer {
    background: var(--green-950);
    color: rgba(255, 255, 255, 0.78);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    padding-block: 3.5rem 2.5rem;
}

.footer-brand {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.footer-brand img {
    flex: none;
    width: 64px;
    height: 64px;
    padding: 4px;
    border-radius: 50%;
    background: var(--white);
    object-fit: contain;
}

.footer-brand p {
    margin: 0;
}

.footer-brand strong {
    color: var(--white);
    font-size: 1.1rem;
}

.site-footer h2 {
    margin-bottom: 1rem;
    color: var(--sun-400);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.site-footer ul {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-footer a {
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--white);
    text-decoration: underline;
}

.footer-base {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 2rem;
    padding-block: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
}

.footer-base p {
    margin: 0;
}

.motto {
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

@media (max-width: 760px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    .footer-brand {
        grid-column: 1 / -1;
    }
}

/* ---------- Motion ---------- */

.reveal {
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.is-hidden {
    opacity: 0;
    transform: translateY(18px);
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
