/**
 * South Sudan Wholesale — UX polish layer (loaded last)
 * Cleaner type, spacing, and page chrome.
 */

:root {
    --tolo-ink: #121816;
    --tolo-muted: #5c6b64;
    --tolo-forest: #0f2f27;
    --tolo-green: #1f6f5b;
    --tolo-lime: #b8e04a;
    --tolo-paper: #fbfcfb;
    --tolo-surface: #ffffff;
    --tolo-line: #e4ebe7;
    --tolo-soft: #f1f5f2;

    --ag-font-display: 'Sora', 'Segoe UI', sans-serif;
    --ag-font-body: 'Source Sans 3', 'Segoe UI', sans-serif;
    --ag-container-max: 1140px;
    --ag-section-pad: clamp(64px, 7vw, 104px);
}

html { font-size: 16px; }

body,
body.ag-corporate-body {
    font-family: var(--ag-font-body);
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--tolo-ink);
    background: var(--tolo-paper);
    font-weight: 400;
    letter-spacing: 0.01em;
}

h1, h2, h3, h4, h5, h6,
.ag-brand-name,
.ag-hero-title,
.ag-pmk-label h3,
.ag-stat-number {
    font-family: var(--ag-font-display);
    font-weight: 650;
    letter-spacing: -0.035em;
    color: var(--tolo-ink);
    line-height: 1.12;
}

h1 { font-size: clamp(2rem, 4.2vw, 3.25rem); font-weight: 700; }
h2 { font-size: clamp(1.65rem, 3.2vw, 2.45rem); font-weight: 650; }
h3 { font-size: clamp(1.15rem, 1.8vw, 1.35rem); font-weight: 600; letter-spacing: -0.02em; }
p { color: var(--tolo-muted); max-width: 62ch; }

.ag-container {
    max-width: var(--ag-container-max);
    margin-inline: auto;
    padding-inline: clamp(18px, 4vw, 28px);
}

.ag-eyebrow {
    display: inline-flex;
    align-items: center;
    font-family: var(--ag-font-body);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--tolo-green);
    background: transparent;
    border: 0;
    padding: 0;
    margin-bottom: 12px;
}

.ag-section-header {
    margin-bottom: clamp(28px, 4vw, 44px);
}
.ag-section-header.ag-text-center { text-align: center; }
.ag-section-header.ag-text-center p { margin-inline: auto; }
.ag-section-header p {
    margin-top: 10px;
    font-size: 1.05rem;
    color: var(--tolo-muted);
}

/* Buttons — cleaner */
.ag-btn {
    font-family: var(--ag-font-body);
    font-weight: 700; /* BUG 2 FIX: raised from 600 to 700 for all button variants */
    font-size: 0.92rem;
    letter-spacing: 0.01em;
    border-radius: var(--ag-radius-pill); /* BUG 2 FIX: restore pill shape from design system */
    padding: 12px 24px; /* BUG 2 FIX: standardized padding (was 12px 20px) */
    border-width: 1.5px;
    transition: background .2s, color .2s, border-color .2s, transform .2s; /* BUG 2 FIX: consistent transition */
}
.ag-btn:hover { transform: translateY(-1px); }
/* BUG 2 FIX: standardize small button padding */
.ag-btn-sm {
    padding: 9px 18px;
    font-size: 0.82rem;
}
.ag-btn-accent {
    background: var(--tolo-lime);
    border-color: var(--tolo-lime);
    color: var(--tolo-forest);
}
.ag-btn-primary,
.ag-btn-teal {
    background: var(--tolo-green);
    border-color: var(--tolo-green);
    color: #fff;
}
.ag-btn-outline {
    background: transparent;
    border-color: var(--tolo-forest);
    color: var(--tolo-forest);
}
.ag-btn-outline-white {
    background: transparent;
    border-color: rgba(255,255,255,.55);
    color: #fff;
}
.ag-btn::after { display: none; }

/* Header */
.ag-topbar {
    background: var(--tolo-forest);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}
.ag-topbar-badge {
    background: var(--tolo-lime);
    color: var(--tolo-forest);
    font-weight: 700;
    border-radius: 4px;
    padding: 3px 8px;
}
.ag-site-header {
    background: rgba(251, 252, 251, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--tolo-line);
}
.ag-brand-name {
    font-size: 1.2rem;
    color: var(--tolo-forest);
    letter-spacing: -0.04em;
}
.ag-brand-tagline {
    font-family: var(--ag-font-body);
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    color: var(--tolo-muted);
}
.ag-nav-list > li > a,
.ag-nav-item > a {
    font-family: var(--ag-font-body);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 10px 12px;
    color: var(--tolo-ink);
}
.ag-nav-list > li > a:hover,
.ag-nav-item > a:hover {
    color: var(--tolo-green);
}

/* Hero cleanup */
.ag-hero-corporate.tolo-hero {
    min-height: min(88vh, 780px);
}
.tolo-hero-brand-name {
    font-family: var(--ag-font-display);
    font-size: clamp(2.8rem, 8vw, 5rem);
    font-weight: 750;
    letter-spacing: -0.055em;
    color: #ffffff !important;
}
.tolo-hero-brand-llc {
    font-family: var(--ag-font-body);
    font-size: 0.85rem;
    letter-spacing: 0.32em;
}
.tolo-hero .ag-hero-title {
    font-size: clamp(1.35rem, 2.6vw, 1.85rem);
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.35;
    color: rgba(255,255,255,.92);
    max-width: 34ch;
}
.tolo-hero .ag-hero-lead {
    font-size: 1.05rem;
    line-height: 1.6;
    color: rgba(255,255,255,.68);
    max-width: 46ch;
}
.tolo-hero-pill {
    font-size: 0.78rem;
    border-radius: 999px;
    padding: 7px 14px;
}
.ag-trust-strip {
    background: #0a241e;
    padding: 14px 0;
    overflow: hidden;
}
.ag-trust-badge {
    font-size: 0.8rem;
    color: rgba(255,255,255,.7);
    white-space: nowrap;
    flex: 0 0 auto;
}
.ag-trust-loop {
    overflow: hidden;
    width: 100%;
    mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.ag-trust-loop-track {
    display: flex;
    align-items: center;
    gap: 36px;
    width: max-content;
    animation: toloTrustLoop 32s linear infinite;
}
.ag-trust-loop:hover .ag-trust-loop-track {
    animation-play-state: paused;
}
@keyframes toloTrustLoop {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* Lead shell glow motion */
.ag-lead-section {
    padding: clamp(56px, 7vw, 90px) 0;
}
.ag-lead-shell {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    display: grid;
    grid-template-columns: 1.05fr 0.85fr;
    gap: clamp(28px, 5vw, 64px);
    padding: clamp(28px, 4vw, 52px);
    background: #0f2f27;
    border-radius: 16px;
    border: 1px solid rgba(184, 224, 74, 0.18);
}
.ag-lead-shell::before {
    content: '';
    position: absolute;
    inset: 0 !important;
    overflow: hidden !important;
    z-index: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(184, 224, 74, 0.22), transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(56, 189, 248, 0.14), transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(31, 111, 91, 0.25), transparent 60%);
    animation: toloLeadGlow 8s ease-in-out infinite alternate;
    pointer-events: none;
}
.ag-lead-shell::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.08) 50%, transparent 70%);
    transform: translateX(-120%);
    animation: toloLeadSheen 5.5s ease-in-out infinite;
    pointer-events: none;
}
.ag-lead-shell > * {
    position: relative;
    z-index: 1;
}
.ag-lead-shell h2,
.ag-lead-copy .ag-eyebrow {
    color: #fff;
}
.ag-lead-shell p,
.ag-lead-shell small {
    color: rgba(255,255,255,0.72);
}
@keyframes toloLeadGlow {
    0% { transform: translate3d(-4%, -2%, 0) scale(1); opacity: 0.75; }
    100% { transform: translate3d(6%, 4%, 0) scale(1.08); opacity: 1; }
}
@keyframes toloLeadSheen {
    0%, 20% { transform: translateX(-120%); }
    55%, 100% { transform: translateX(120%); }
}

@media (prefers-reduced-motion: reduce) {
    .ag-trust-loop-track,
    .ag-lead-shell::before,
    .ag-lead-shell::after {
        animation: none !important;
    }
}
@media (max-width: 860px) {
    .ag-lead-shell { grid-template-columns: 1fr; }
}

/* Page header — calm, readable */
.ag-page-header {
    background: linear-gradient(160deg, #0f2f27 0%, #164036 100%);
    padding: clamp(72px, 10vw, 110px) 0 clamp(48px, 6vw, 72px);
    text-align: left;
}
.ag-page-header::after { display: none; }
.ag-page-header .ag-eyebrow {
    color: var(--tolo-lime);
}
.ag-page-header h1,
.ag-page-header h2 {
    color: #fff;
    max-width: 18ch;
    margin: 0 0 14px;
}
.ag-page-header p {
    color: rgba(255,255,255,.72);
    max-width: 52ch;
    font-size: 1.08rem;
    margin: 0;
}

.ag-breadcrumbs,
.ag-breadcrumb {
    background: var(--tolo-soft);
    border-bottom: 1px solid var(--tolo-line);
    padding: 12px 0;
    font-size: 0.85rem;
}

/* Content blocks */
.ag-stats-section {
    background: var(--tolo-soft);
    padding: clamp(40px, 5vw, 64px) 0;
}
.ag-stat-number {
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    color: var(--tolo-forest);
}
.ag-stat-label {
    font-size: 0.95rem;
    color: var(--tolo-muted);
    line-height: 1.45;
}

.ag-audience-navigator,
.ag-featured-catalog-section,
.ag-divisions-overview-section,
.ag-brand-portfolio-strip,
.ag-proof-section,
.ag-about-overview-section,
.ag-compliance-standards-section,
.ag-milestones-section,
.ag-pipeline-section,
.ag-certs-section {
    padding: var(--ag-section-pad) 0;
}

.ag-audience-card,
.ag-division-card,
.ag-standard-card,
.ag-resource-card,
.ag-cert-card,
.ag-form-card,
.ag-contact-card,
.ag-sidebar-card,
.ag-sector-row,
.ag-pipeline-card,
.ag-spec-card {
    background: var(--tolo-surface);
    border: 1px solid var(--tolo-line);
    border-radius: 12px;
    box-shadow: none;
}

.ag-audience-card:hover,
.ag-division-card:hover,
.ag-resource-card:hover,
.ag-cert-card:hover,
.ag-pipeline-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(15, 47, 39, 0.08);
    border-color: rgba(31, 111, 91, 0.28);
}

/* BUG 5 FIX: Add missing hover states for hub cards and depot cards */
.ag-hub-card:not(.tolo-glass-card) {
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s, border-color 0.3s;
}
.ag-hub-card:not(.tolo-glass-card):hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(15, 47, 39, 0.1);
}
.ag-depot-card:not(.tolo-glass-card) {
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s, border-color 0.3s;
}
.ag-depot-card:not(.tolo-glass-card):hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(15, 47, 39, 0.1);
    border-color: rgba(31, 111, 91, 0.28);
}

.ag-pmk-card {
    border-radius: 12px;
    overflow: hidden;
}
.ag-pmk-label h3 {
    color: #fff;
    font-size: clamp(1.15rem, 2vw, 1.45rem);
}

/* Matcher */
.tolo-matcher {
    background: var(--tolo-forest);
}
.tolo-matcher-panel {
    border-radius: 14px;
}
.tolo-match-opt {
    border-radius: 10px;
}
.tolo-cat-tab {
    border-radius: 999px;
    font-family: var(--ag-font-body);
}

/* Division / sector detail */
.ag-division-detail-block {
    padding: clamp(36px, 5vw, 56px) 0;
    border-bottom: 1px solid var(--tolo-line);
}
.ag-division-detail-block:last-child { border-bottom: 0; }
.ag-lead-p {
    font-size: 1.15rem;
    color: var(--tolo-ink);
    font-weight: 500;
    max-width: 48ch;
}
.ag-check-list {
    margin: 18px 0 24px;
    padding: 0;
    list-style: none;
}
.ag-check-list li {
    position: relative;
    padding: 8px 0 8px 28px;
    color: var(--tolo-muted);
}
.ag-check-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 14px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(184, 224, 74, 0.45);
    box-shadow: inset 0 0 0 4px var(--tolo-green);
}

.ag-sector-row {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.2fr);
    gap: 28px;
    padding: 22px;
    margin-bottom: 16px;
    align-items: center;
}
.ag-sector-photo {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 10px;
}

.ag-resources-grid,
.ag-certs-grid,
.ag-standards-grid,
.ag-pipeline-steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}
.ag-resource-card,
.ag-cert-card,
.ag-pipeline-card,
.ag-standard-card {
    padding: 22px;
}
.ag-res-icon {
    font-size: 1.6rem;
    margin-bottom: 10px;
}
.ag-res-meta {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--tolo-green);
    margin-bottom: 8px;
}

.ag-demo-note {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--tolo-muted);
    background: var(--tolo-soft);
    padding: 4px 10px;
    border-radius: 999px;
}

.ag-content-band {
    background: var(--tolo-soft);
    border-block: 1px solid var(--tolo-line);
    padding: var(--ag-section-pad) 0;
}

.ag-two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(24px, 4vw, 48px);
    align-items: start;
}

.ag-timeline {
    display: grid;
    gap: 0;
}
.ag-timeline-item {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 20px;
    padding: 22px 0;
    border-bottom: 1px solid var(--tolo-line);
}
.ag-timeline-year {
    font-family: var(--ag-font-display);
    font-weight: 700;
    color: var(--tolo-green);
}

.ag-site-footer {
    background: var(--tolo-forest);
}
.ag-footer-about,
.ag-footer-links a,
.ag-footer-bottom {
    font-size: 0.95rem;
}

@media (max-width: 860px) {
    .ag-sector-row,
    .ag-two-col,
    .ag-timeline-item {
        grid-template-columns: 1fr;
    }
    .ag-page-header h1 { max-width: none; }
    .ag-hero-corporate.tolo-hero { min-height: auto; }
}

/* Supply Network map — matches reference UI */
.ag-origin-map-section.ag-supply-network {
    background: #ffffff;
    padding: var(--ag-section-pad) 0;
    color: #1f2a26;
}
.ag-supply-network-header {
    text-align: center;
    margin-bottom: clamp(24px, 4vw, 40px);
}
.ag-supply-network-rule {
    display: block;
    width: 56px;
    height: 2px;
    margin: 0 auto 14px;
    background: #1f4d3d;
}
.ag-supply-network-title {
    margin: 0 0 10px;
    color: #1f4d3d !important;
    font-family: var(--ag-font-display);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 750;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.ag-supply-network-header p {
    margin: 0 auto;
    max-width: 52ch;
    color: #66756e;
    font-size: 1rem;
}

.ag-supply-network .ag-map-canvas {
    position: relative;
    background: #ffffff;
    border: 1px solid #e6ebe8;
    border-radius: 8px;
    padding: 8px 8px 48px;
    overflow: hidden;
    min-height: 420px;
}
.ag-map-viewport {
    width: 100%;
    overflow: hidden;
    cursor: grab;
}
.ag-map-stage {
    transform-origin: center center;
    transition: transform 0.25s ease;
    will-change: transform;
}
.ag-map-svg-host,
.ag-world-svg {
    width: 100%;
    height: auto;
    display: block;
}
.ag-world-svg {
    background: transparent;
}

/* Country fills */
.ag-map-country {
    stroke: #ffffff;
    stroke-width: 0.6;
    transition: fill 0.18s ease, stroke-width 0.18s ease, filter 0.18s ease;
    cursor: pointer;
    outline: none;
}
.ag-map-country-idle {
    fill: #d7ddd9 !important;
}
.ag-map-country-active {
    fill: #1f4d3d !important;
}
.ag-map-country-active.is-hover,
.ag-map-country-active:focus {
    fill: #16382d !important;
    stroke-width: 1.1;
    filter: brightness(1.08);
}
.ag-map-country-idle.is-hover {
    fill: #c5cdc8 !important;
}

/* Tooltip popup */
.ag-map-tooltip {
    position: absolute;
    z-index: 5;
    transform: translate(-50%, calc(-100% - 14px));
    background: #ffffff;
    color: #2c3531;
    border: 1px solid #d7ddd9;
    border-radius: 4px;
    padding: 7px 12px;
    font-size: 0.86rem;
    font-family: var(--ag-font-body);
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(20, 40, 32, 0.12);
}
.ag-map-tooltip[hidden] { display: none; }

/* Zoom controls */
.ag-map-zoom {
    position: absolute;
    right: 14px;
    bottom: 14px;
    display: grid;
    gap: 6px;
    z-index: 4;
}
.ag-map-zoom-btn {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 4px;
    background: #2a2f2d;
    color: #fff;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}
.ag-map-zoom-btn:hover { background: #1f4d3d; }

.ag-map-loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,0.88);
    color: #66756e;
    font-size: 0.95rem;
    z-index: 3;
}
.ag-map-loading[hidden] { display: none; }

.ag-supply-network .ag-hub-cards-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}
.ag-supply-network .ag-hub-card {
    background: #fff;
    border: 1px solid #e6ebe8;
    border-radius: 12px;
    padding: 14px;
    transition: border-color .25s, transform .25s, box-shadow .25s;
}
.ag-supply-network .ag-hub-card.is-active,
.ag-supply-network .ag-hub-card:hover {
    border-color: rgba(31, 77, 61, 0.45);
    box-shadow: 0 12px 28px rgba(31, 77, 61, 0.1);
    transform: translateY(-3px);
}

@media (max-width: 900px) {
    .ag-supply-network .ag-hub-cards-strip { grid-template-columns: 1fr; }
    .ag-supply-network .ag-map-canvas { min-height: 300px; }
}

/* =============================================
   BUG 6 FIX: Mobile layout overflow & footer spacing
   ============================================= */
/* Prevent horizontal scroll globally */
html, body {
    overflow-x: hidden;
}

@media (max-width: 480px) {
    /* BUG 6 FIX: Footer single column with proper gap */
    .ag-footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .ag-footer-col-main {
        grid-column: auto;
    }

    /* BUG 6 FIX: Prevent card overflow — guard min-width */
    .ag-audience-card,
    .ag-division-card,
    .ag-cert-card,
    .ag-resource-card,
    .ag-pipeline-card,
    .ag-hub-card,
    .ag-depot-card,
    .ag-product-card {
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
    }

    /* BUG 6 FIX: Image containers — ensure overflow hidden on mobile */
    .ag-card-img-wrap,
    .ag-cat-img-wrap,
    .ag-pcard-img-box,
    .ag-depot-img-wrap,
    .ag-hub-thumb {
        overflow: hidden;
        max-width: 100%;
    }

    /* BUG 6 FIX: audience cards grid single column on mobile */
    .ag-audience-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* =============================================
   BUG 7 FIX: will-change for IntersectionObserver animated elements
   ============================================= */
.tolo-reveal {
    will-change: transform, opacity;
}
.tolo-reveal.is-in {
    will-change: auto; /* release once animation is done */
}

/* =============================================
   BUG 8 FIX: Border-radius consistency
   Align hardcoded outlier values to design system tokens
   ============================================= */
/* Proof cards used border-radius: 8px — align to --ag-radius-md (12px) or variable */
.ag-proof-card {
    border-radius: var(--ag-radius-sm); /* keeps the 8px intent via --ag-radius-sm = 8px in main.css */
}
/* Supply map canvas used border-radius: 8px */
.ag-supply-network .ag-map-canvas {
    border-radius: var(--ag-radius-sm);
}
/* Pipeline section cards already use --ag-radius-lg, normalise the step counter */
.ag-step-num {
    font-variant-numeric: tabular-nums;
}
/* Mega menu tiles had hardcoded 10px — align to --ag-radius-md */
.ag-pmega-tile {
    border-radius: var(--ag-radius-md);
}

/* =============================================
   High-Contrast Icon Styling for Dark Cards
   Ensures all SVG icons on dark green cards are clearly visible
   ============================================= */
.ag-aseg-icon,
.ag-aseg-card .ag-aseg-icon {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    border-radius: 12px !important;
    background: rgba(200, 239, 80, 0.16) !important;
    border: 1px solid rgba(200, 239, 80, 0.35) !important;
    color: #C8EF50 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.ag-aseg-icon svg,
.ag-aseg-card .ag-aseg-icon svg,
.ag-seg-svg {
    width: 24px !important;
    height: 24px !important;
    stroke: #C8EF50 !important;
    color: #C8EF50 !important;
    fill: none !important;
    display: block !important;
}

.ag-aseg-card:hover .ag-aseg-icon {
    background: #C8EF50 !important;
    border-color: #C8EF50 !important;
}

.ag-aseg-card:hover .ag-aseg-icon svg,
.ag-aseg-card:hover .ag-seg-svg {
    stroke: #0A1C16 !important;
}

