﻿/* =========================================================
   Malawi Verified Services
   Phase 3.2 — Production UI Polish
   ========================================================= */

:root {
    --portal-green-950: #06291f;
    --portal-green-900: #093d2f;
    --portal-green-800: #0f5640;
    --portal-green-700: #147453;
    --portal-green-600: #188763;
    --portal-green-100: #dff3e9;
    --portal-green-50: #f1faf6;

    --portal-gold: #dba928;
    --portal-red: #ce1126;

    --portal-navy: #0f172a;
    --portal-slate-800: #1e293b;
    --portal-slate-700: #334155;
    --portal-slate-600: #475569;
    --portal-slate-500: #64748b;
    --portal-slate-400: #94a3b8;
    --portal-slate-300: #cbd5e1;
    --portal-slate-200: #e2e8f0;
    --portal-slate-100: #f1f5f9;
    --portal-slate-50: #f8fafc;

    --portal-shadow-xs:
        0 1px 2px rgba(15, 23, 42, 0.04);

    --portal-shadow-sm:
        0 4px 12px rgba(15, 23, 42, 0.06);

    --portal-shadow-md:
        0 14px 32px rgba(15, 23, 42, 0.09);

    --portal-shadow-lg:
        0 25px 70px rgba(2, 20, 14, 0.22);
}

/* General page refinement */

body {
    background:
        linear-gradient(
            180deg,
            #ffffff 0,
            #ffffff 480px,
            var(--portal-slate-50) 480px
        );
    color: var(--portal-slate-800);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.site-header {
    border-bottom: 1px solid rgba(203, 213, 225, 0.72);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.header-container {
    min-height: 78px;
}

.brand-mark {
    border: 2px solid rgba(255, 255, 255, 0.32);
    background:
        linear-gradient(
            145deg,
            var(--portal-green-800),
            var(--portal-green-950)
        );
    box-shadow:
        0 0 0 3px rgba(20, 116, 83, 0.12),
        0 5px 12px rgba(6, 41, 31, 0.16);
}

.brand-name {
    color: var(--portal-green-950);
    letter-spacing: -0.015em;
}

.desktop-nav a {
    padding: 8px 2px;
    color: var(--portal-slate-700);
}

/* Hero refinement */

.hero {
    min-height: auto;
    background:
        radial-gradient(
            circle at 82% 14%,
            rgba(219, 169, 40, 0.16),
            transparent 27%
        ),
        radial-gradient(
            circle at 93% 88%,
            rgba(255, 255, 255, 0.07),
            transparent 29%
        ),
        linear-gradient(
            125deg,
            #052d22 0%,
            #084632 56%,
            #18583f 100%
        );
}

.hero-container {
    grid-template-columns:
        minmax(0, 1.35fr)
        minmax(300px, 0.65fr);
    gap: 65px;
    padding-top: 62px;
    padding-bottom: 62px;
}

.hero h1 {
    max-width: 760px;
    margin-top: 13px;
    margin-bottom: 16px;
    font-size: clamp(2.65rem, 5vw, 4.25rem);
    line-height: 1.02;
}

.hero-description {
    max-width: 660px;
    font-size: 1.05rem;
    line-height: 1.72;
}

.hero-search {
    margin-top: 29px;
}

.search-control {
    max-width: 720px;
    min-height: 64px;
    border-radius: 15px;
    box-shadow:
        0 18px 45px rgba(3, 25, 18, 0.24),
        0 2px 5px rgba(3, 25, 18, 0.08);
}

.search-control button {
    min-width: 110px;
    border-radius: 10px;
    background:
        linear-gradient(
            135deg,
            var(--portal-green-600),
            var(--portal-green-700)
        );
}

.search-control button:hover {
    background:
        linear-gradient(
            135deg,
            var(--portal-green-700),
            var(--portal-green-900)
        );
    box-shadow: 0 6px 16px rgba(7, 74, 50, 0.24);
}

.hero-trust {
    margin-top: 15px;
}

.hero-panel {
    padding: 28px;
    border-color: rgba(255, 255, 255, 0.19);
    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.13),
            rgba(255, 255, 255, 0.07)
        );
    box-shadow:
        0 30px 70px rgba(1, 23, 15, 0.25);
}

.hero-panel h2 {
    margin-top: 20px;
}

.hero-stat-grid div {
    background: rgba(3, 43, 31, 0.33);
    border-color: rgba(255, 255, 255, 0.11);
}

.hero-stat-grid strong {
    font-size: 27px;
}

/* Sections */

.section {
    padding-top: 66px;
    padding-bottom: 66px;
}

.category-section {
    position: relative;
}

.category-section::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 1px;
    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(203, 213, 225, 0.8),
            transparent
        );
}

.section-heading-row {
    margin-bottom: 29px;
}

.section-heading-row h2 {
    color: var(--portal-navy);
    font-size: clamp(1.85rem, 3vw, 2.35rem);
    letter-spacing: -0.035em;
}

.section-heading-row p {
    color: var(--portal-slate-600);
}

.text-button {
    color: var(--portal-green-800);
    border-bottom-color: rgba(15, 86, 64, 0.5);
}

/* Category cards */

.category-grid {
    gap: 17px;
}

.category-card {
    position: relative;
    min-height: 142px;
    padding: 22px;
    overflow: hidden;
    border-color: var(--portal-slate-200);
    border-radius: 16px;
    box-shadow: var(--portal-shadow-xs);
}

.category-card::after {
    content: "";
    position: absolute;
    right: -40px;
    bottom: -52px;
    width: 115px;
    height: 115px;
    border: 20px solid rgba(20, 116, 83, 0.035);
    border-radius: 50%;
    pointer-events: none;
}

.category-card:hover {
    border-color: rgba(20, 116, 83, 0.42);
    box-shadow: var(--portal-shadow-md);
    transform: translateY(-4px);
}

.category-card-active {
    border-color: var(--portal-green-700);
    background:
        linear-gradient(
            145deg,
            #f5fcf8,
            #eaf8f1
        );
    box-shadow:
        0 0 0 1px var(--portal-green-700),
        0 12px 28px rgba(20, 116, 83, 0.10);
}

.category-icon {
    min-width: 40px;
    width: fit-content;
    height: 40px;
    padding: 0 10px;
    border-radius: 11px;
    background:
        linear-gradient(
            145deg,
            #e4f5ed,
            #d9eee4
        );
    color: var(--portal-green-900);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.055em;
}

.category-name {
    margin-top: 1px;
    color: var(--portal-navy);
    font-size: 16px;
    letter-spacing: -0.012em;
}

.category-description {
    color: var(--portal-slate-500);
}

/* Services directory */

.services-section {
    background:
        linear-gradient(
            180deg,
            #f8fafc,
            #f4f7fa
        );
}

.compact-search {
    min-height: 50px;
    border-color: var(--portal-slate-300);
    border-radius: 12px;
    box-shadow: var(--portal-shadow-xs);
}

.compact-search:focus-within {
    border-color: var(--portal-green-700);
    box-shadow:
        0 0 0 4px rgba(20, 116, 83, 0.11);
}

.services-grid {
    gap: 20px;
}

.service-card {
    min-height: 328px;
    padding: 25px;
    border-color: var(--portal-slate-200);
    border-radius: 17px;
    box-shadow: var(--portal-shadow-sm);
}

.service-card::before {
    height: 5px;
    background:
        linear-gradient(
            90deg,
            var(--portal-green-700),
            #36a172
        );
}

.service-card:hover {
    border-color: rgba(20, 116, 83, 0.37);
    box-shadow:
        0 20px 44px rgba(15, 23, 42, 0.11);
    transform: translateY(-5px);
}

.service-card h3 {
    margin-top: 20px;
    color: var(--portal-navy);
    font-size: 20px;
}

.service-category {
    padding: 6px 10px;
    color: var(--portal-green-900);
    background:
        linear-gradient(
            135deg,
            #e7f6ee,
            #d9efe4
        );
}

.online-badge {
    color: var(--portal-green-700);
}

.service-agency {
    min-height: 21px;
    color: var(--portal-slate-700);
}

.service-description {
    color: var(--portal-slate-600);
    line-height: 1.65;
}

.service-card-footer {
    border-top-color: var(--portal-slate-200);
}

.service-meta {
    color: var(--portal-slate-500);
}

.view-service-button {
    min-height: 36px;
    padding: 0 3px;
    color: var(--portal-green-800);
}

.view-service-button:hover {
    color: var(--portal-green-950);
}

/* Loading and empty states */

.status-card {
    border-radius: 17px;
    background:
        linear-gradient(
            145deg,
            #ffffff,
            #fbfdff
        );
    box-shadow: var(--portal-shadow-xs);
}

/* Information notice */

.notice-section {
    background: #f4f7fa;
}

.notice-card {
    padding: 25px 27px;
    background:
        linear-gradient(
            135deg,
            #fffdf5,
            #fffaf0
        );
    border-color: #eed58e;
    box-shadow: 0 6px 18px rgba(100, 72, 14, 0.04);
}

/* Footer */

.site-footer {
    background:
        linear-gradient(
            135deg,
            #052c22,
            #07392b
        );
}

/* Service detail modal */

.modal-backdrop {
    background: rgba(2, 18, 13, 0.77);
}

.modal-panel {
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: var(--portal-shadow-lg);
}

.modal-header {
    padding-top: 27px;
    background:
        linear-gradient(
            180deg,
            #ffffff,
            #fcfdfd
        );
}

.modal-header h2 {
    color: var(--portal-navy);
}

.modal-close {
    transition:
        transform 150ms ease,
        background 150ms ease;
}

.modal-close:hover {
    background: #e8eef2;
    transform: rotate(3deg);
}

.modal-content {
    background: #ffffff;
}

.detail-introduction {
    padding: 19px 20px;
    background:
        linear-gradient(
            135deg,
            #f2faf6,
            #f8fcfa
        );
    border-left: 4px solid var(--portal-green-700);
    border-radius: 0 11px 11px 0;
}

.detail-highlight-grid {
    gap: 14px;
}

.detail-highlight {
    padding: 18px;
    border-color: var(--portal-slate-200);
    background:
        linear-gradient(
            145deg,
            #fbfcfd,
            #f5f8fa
        );
    border-radius: 12px;
}

.detail-highlight strong {
    line-height: 1.45;
}

.detail-section h3 {
    color: var(--portal-navy);
    font-size: 19px;
}

.detail-list li {
    border: 1px solid var(--portal-slate-200);
    background:
        linear-gradient(
            145deg,
            #fbfcfd,
            #f7f9fb
        );
}

.faq-item {
    border: 1px solid var(--portal-slate-200);
    background: var(--portal-slate-50);
}

.contact-card {
    border-color: #c8e6d6;
    background:
        linear-gradient(
            145deg,
            #f1faf6,
            #eaf7f1
        );
}

.official-link {
    min-height: 44px;
    padding: 11px 18px;
    background:
        linear-gradient(
            135deg,
            var(--portal-green-700),
            var(--portal-green-800)
        );
    box-shadow: 0 8px 18px rgba(20, 116, 83, 0.17);
    transition:
        transform 150ms ease,
        box-shadow 150ms ease,
        background 150ms ease;
}

.official-link:hover {
    background:
        linear-gradient(
            135deg,
            var(--portal-green-800),
            var(--portal-green-950)
        );
    box-shadow: 0 12px 25px rgba(20, 116, 83, 0.24);
    transform: translateY(-1px);
}

/* Gentle page-load animation */

.hero-content,
.hero-panel,
.category-card,
.service-card {
    animation: portal-fade-up 420ms ease both;
}

.category-card:nth-child(2),
.service-card:nth-child(2) {
    animation-delay: 45ms;
}

.category-card:nth-child(3),
.service-card:nth-child(3) {
    animation-delay: 90ms;
}

.category-card:nth-child(4),
.service-card:nth-child(4) {
    animation-delay: 135ms;
}

@keyframes portal-fade-up {
    from {
        opacity: 0;
        transform: translateY(9px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tablet */

@media (max-width: 980px) {
    .hero-container {
        gap: 32px;
        padding-top: 52px;
        padding-bottom: 52px;
    }

    .hero-panel {
        max-width: none;
    }
}

/* Mobile */

@media (max-width: 720px) {
    .header-container {
        min-height: 68px;
    }

    .hero-container {
        padding-top: 43px;
        padding-bottom: 46px;
    }

    .hero h1 {
        font-size: clamp(2.25rem, 12vw, 3.25rem);
    }

    .hero-description {
        font-size: 0.98rem;
    }

    .hero-panel {
        padding: 23px;
    }

    .section {
        padding-top: 50px;
        padding-bottom: 50px;
    }

    .section-heading-row {
        gap: 20px;
    }

    .category-card {
        min-height: 126px;
    }

    .service-card {
        min-height: 0;
    }

    .modal-header {
        padding-top: 22px;
    }
}

/* Reduced motion accessibility */

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

#services,
#categories,
#about {
    scroll-margin-top: 105px;
}


@media (min-width: 1100px) {
    .category-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}


#services,
#categories,
#about {
    scroll-margin-top: 105px;
}


@media (min-width: 1100px) {
    .category-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}


/* Public Agencies and Embassies Directory */

#agencies {
    scroll-margin-top: 105px;
}

.public-agencies-section {
    padding: 82px 0;
    background:
        linear-gradient(
            180deg,
            #f7faf8 0%,
            #eef5f1 100%
        );
}

.public-agencies-section .section-container {
    width: min(1200px, calc(100% - 40px));
    margin: 0 auto;
}

.agencies-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 32px;
    margin-bottom: 34px;
}

.agencies-heading h2 {
    margin: 8px 0 12px;
    color: #123226;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.1;
}

.agencies-heading > div:first-child > p:last-child {
    max-width: 700px;
    margin: 0;
    color: #62736a;
    line-height: 1.7;
}

.section-eyebrow {
    margin: 0;
    color: #087447;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.agency-directory-tools {
    width: min(360px, 100%);
}

.agency-search-label {
    display: block;
    margin-bottom: 8px;
    color: #22342b;
    font-size: 0.88rem;
    font-weight: 750;
}

.agency-search-input {
    width: 100%;
    min-height: 48px;
    padding: 11px 14px;
    border: 1px solid #cfddd5;
    border-radius: 12px;
    outline: none;
    background: #ffffff;
    color: #17251e;
    font: inherit;
    box-shadow: 0 8px 25px rgba(18, 50, 38, 0.05);
}

.agency-search-input:focus {
    border-color: #087447;
    box-shadow: 0 0 0 4px rgba(8, 116, 71, 0.11);
}

.public-agency-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.public-agency-card {
    display: flex;
    min-width: 0;
    min-height: 100%;
    padding: 24px;
    border: 1px solid #d7e2dc;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 18px 45px rgba(18, 50, 38, 0.07);
    flex-direction: column;
    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        border-color 180ms ease;
}

.public-agency-card:hover {
    border-color: #b7d4c5;
    box-shadow: 0 24px 58px rgba(18, 50, 38, 0.12);
    transform: translateY(-4px);
}

.agency-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.agency-card-icon {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    place-items: center;
    border-radius: 14px;
    background: #e5f3eb;
    color: #075e37;
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.05em;
}

.agency-card-badges {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
    flex-wrap: wrap;
}

.agency-category-badge,
.agency-country-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
}

.agency-category-badge {
    background: #e6f3ec;
    color: #075e37;
}

.agency-country-badge {
    background: #f0f3f1;
    color: #52635a;
}

.public-agency-card h3 {
    margin: 0 0 12px;
    color: #122b20;
    font-size: 1.18rem;
    line-height: 1.35;
}

.agency-description {
    margin: 0 0 20px;
    color: #607067;
    font-size: 0.92rem;
    line-height: 1.65;
}

.agency-description-muted {
    font-style: italic;
}

.agency-information {
    display: grid;
    gap: 13px;
    margin-bottom: 22px;
}

.agency-detail {
    display: grid;
    gap: 4px;
    margin: 0;
    color: #607067;
    font-size: 0.86rem;
    line-height: 1.5;
}

.agency-detail strong {
    color: #263a30;
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.agency-contact-list {
    display: grid;
    gap: 13px;
}

.agency-contact-link {
    overflow-wrap: anywhere;
    color: #087447;
    font-weight: 700;
    text-decoration: none;
}

.agency-contact-link:hover {
    text-decoration: underline;
}

.agency-card-footer {
    display: flex;
    align-items: flex-end;
    min-height: 42px;
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid #e1e9e4;
}

.agency-website-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #075e37;
    font-size: 0.88rem;
    font-weight: 800;
    text-decoration: none;
}

.agency-website-button:hover {
    text-decoration: underline;
}

.agency-website-unavailable {
    color: #7a8880;
    font-size: 0.84rem;
}

.agency-state-message {
    padding: 34px 18px;
    border: 1px dashed #cbd9d1;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.68);
    color: #62736a;
    text-align: center;
}

@media (max-width: 1000px) {
    .public-agency-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .agencies-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .agency-directory-tools {
        width: 100%;
        max-width: 520px;
    }
}

@media (max-width: 650px) {
    .public-agencies-section {
        padding: 58px 0;
    }

    .public-agencies-section .section-container {
        width: min(100% - 24px, 1200px);
    }

    .public-agency-grid {
        grid-template-columns: 1fr;
    }

    .public-agency-card {
        padding: 20px;
    }
}

/* Force JavaScript-controlled elements to hide */
.hidden {
    display: none !important;
}
