/* ==========================================================================
   SYSNAV Payments — Developer Portal
   Design system. Restrained palette, system typography, generous whitespace.
   ========================================================================== */

/* ---- Design tokens ------------------------------------------------------ */
:root {
    /* Ink & surface */
    --ink:            #0b0c0e;
    --ink-2:          #33373d;
    --muted:          #61666e;
    --muted-2:        #878d96;
    --line:           #e6e8eb;
    --line-2:         #eef0f2;
    --surface:        #ffffff;
    --surface-2:      #f7f8f9;
    --surface-3:      #f0f2f4;

    /* Single brand accent (Safaricom-heritage green, muted) */
    --brand:          #1a7f4b;
    --brand-strong:   #14663c;
    --brand-tint:     #eaf5ef;

    /* Functional (used sparingly) */
    --info:           #2f6feb;
    --warn:           #b7791f;
    --danger:         #c0392b;

    /* Dark section */
    --night:          #0c1418;
    --night-2:        #12202a;
    --night-line:     #223540;
    --night-ink:      #e8eef0;
    --night-muted:    #9fb2ba;

    /* Type */
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: "SF Mono", "JetBrains Mono", "Fira Code", ui-monospace, "Cascadia Code", Consolas, monospace;

    /* Radius & shadow */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 18px;
    --shadow-1: 0 1px 2px rgba(11,12,14,.06), 0 1px 3px rgba(11,12,14,.05);
    --shadow-2: 0 4px 12px rgba(11,12,14,.08);
    --shadow-3: 0 18px 48px rgba(11,12,14,.12);

    --maxw: 1160px;
    --nav-h: 64px;
}

/* ---- Reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.02em; font-weight: 650; color: var(--ink); }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 700; letter-spacing: -0.035em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h3 { font-size: 1.15rem; }
p  { color: var(--ink-2); }

code, pre { font-family: var(--mono); }

/* ---- Layout helpers ----------------------------------------------------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: 88px 0; }
.section--tight { padding: 56px 0; }
.center { text-align: center; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 640px; }
.eyebrow {
    display: inline-block;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--brand);
    margin-bottom: 14px;
}
.section-head { max-width: 720px; margin: 0 auto 52px; text-align: center; }
.section-head p { margin-top: 14px; color: var(--muted); font-size: 1.08rem; }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .95rem;
    font-weight: 600;
    padding: 11px 20px;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { background: #23262b; }
.btn--brand { background: var(--brand); color: #fff; }
.btn--brand:hover { background: var(--brand-strong); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--muted-2); }
.btn--onnight { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.16); }
.btn--onnight:hover { background: rgba(255,255,255,.16); }
.btn svg { width: 16px; height: 16px; }

/* ---- Navbar ------------------------------------------------------------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--nav-h);
    background: rgba(255,255,255,.82);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
}
.nav__inner {
    max-width: var(--maxw);
    margin: 0 auto;
    height: 100%;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 28px;
}
.nav__brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.02em; }
.nav__brand img { width: 26px; height: 26px; border-radius: 6px; }
.nav__brand span b { color: var(--brand); font-weight: 700; }
.nav__links { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.nav__links a {
    font-size: .92rem;
    font-weight: 500;
    color: var(--ink-2);
    padding: 8px 12px;
    border-radius: 8px;
    transition: background .15s ease, color .15s ease;
}
.nav__links a:hover { background: var(--surface-2); color: var(--ink); }
.nav__links a.is-active { color: var(--brand); }
.nav__spacer { flex: 1; }
.nav__cta { display: flex; align-items: center; gap: 10px; }
.nav__burger {
    display: none;
    width: 40px; height: 40px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.nav__burger span { position: relative; width: 18px; height: 2px; background: var(--ink); display: block; }
.nav__burger span::before, .nav__burger span::after {
    content: ""; position: absolute; left: 0; width: 18px; height: 2px; background: var(--ink);
}
.nav__burger span::before { top: -6px; }
.nav__burger span::after { top: 6px; }

@media (max-width: 900px) {
    .nav__links, .nav__cta .btn--ghost { display: none; }
    .nav__burger { display: flex; }
    .nav.is-open .nav__links {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        position: absolute;
        top: var(--nav-h);
        left: 0; right: 0;
        background: #fff;
        border-bottom: 1px solid var(--line);
        padding: 12px 16px 18px;
        box-shadow: var(--shadow-2);
    }
    .nav.is-open .nav__links a { padding: 12px; }
}

/* ---- Hero --------------------------------------------------------------- */
.hero { padding: 84px 0 64px; }
.hero__grid {
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 56px;
    align-items: center;
}
.hero__pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--ink-2);
    background: var(--surface-2);
    border: 1px solid var(--line);
    padding: 6px 12px 6px 8px;
    border-radius: 999px;
    margin-bottom: 22px;
}
.hero__pill b { color: var(--brand); }
.hero__pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.hero h1 { margin-bottom: 20px; }
.hero p.lead { margin-bottom: 30px; }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero__meta {
    margin-top: 30px;
    display: flex;
    gap: 26px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: .9rem;
}
.hero__meta b { color: var(--ink); font-weight: 650; }

/* Code window (hero + docs) */
.window {
    background: var(--night);
    border: 1px solid var(--night-line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-3);
    overflow: hidden;
}
.window__bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 16px;
    background: var(--night-2);
    border-bottom: 1px solid var(--night-line);
}
.window__bar .dot { width: 11px; height: 11px; border-radius: 50%; background: #37474f; }
.window__bar .name { margin-left: 10px; font-family: var(--mono); font-size: .78rem; color: var(--night-muted); }
.window pre {
    margin: 0;
    padding: 20px;
    overflow-x: auto;
    font-size: .84rem;
    line-height: 1.7;
    color: #d7e2e6;
}
.window pre .k { color: #7fd1a3; }   /* keyword/method */
.window pre .s { color: #e6c07b; }   /* string */
.window pre .c { color: #6a7f89; }   /* comment */
.window pre .p { color: #86b8ff; }   /* property */

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

/* ---- Logos / trust strip ------------------------------------------------ */
.trust { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.trust__inner { padding: 26px 0; display: flex; align-items: center; gap: 40px; flex-wrap: wrap; justify-content: center; }
.trust__label { font-size: .82rem; color: var(--muted); font-weight: 500; }
.trust__item { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; color: var(--ink-2); letter-spacing: -.01em; }
.trust__item svg { width: 20px; height: 20px; color: var(--brand); }

/* ---- Feature grid ------------------------------------------------------- */
.grid { display: grid; gap: 22px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid--3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .grid--3, .grid--2 { grid-template-columns: 1fr; } }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 26px;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.card:hover { border-color: var(--muted-2); box-shadow: var(--shadow-2); }
.card__icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    background: var(--brand-tint);
    color: var(--brand);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 16px;
}
.card__icon svg { width: 22px; height: 22px; }
.card h3 { margin-bottom: 8px; }
.card p { font-size: .95rem; color: var(--muted); }

/* Platform / SDK card */
.sdk {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 24px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.sdk:hover { border-color: var(--muted-2); box-shadow: var(--shadow-2); }
.sdk__top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sdk__logo { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.sdk__logo svg { width: 34px; height: 34px; }
.sdk h3 { font-size: 1.05rem; }
.sdk p { font-size: .92rem; color: var(--muted); flex: 1; margin-bottom: 18px; }
.sdk__link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .92rem; color: var(--brand); }
.sdk__link svg { width: 15px; height: 15px; transition: transform .15s ease; }
.sdk:hover .sdk__link svg { transform: translateX(3px); }

/* ---- Steps -------------------------------------------------------------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; counter-reset: step; }
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; } }
.step { position: relative; padding: 26px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.step__n {
    width: 30px; height: 30px; border-radius: 8px;
    background: var(--ink); color: #fff;
    font-size: .9rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}
.step h3 { margin-bottom: 6px; font-size: 1.05rem; }
.step p { font-size: .93rem; color: var(--muted); margin-bottom: 12px; }
.step code {
    display: inline-block;
    font-size: .78rem;
    background: var(--surface-3);
    border: 1px solid var(--line);
    color: var(--ink-2);
    padding: 4px 9px;
    border-radius: 6px;
}

/* ---- Endpoints preview -------------------------------------------------- */
.ep-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 820px) { .ep-groups { grid-template-columns: 1fr; } }
.ep-group h3 { font-size: 1rem; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.ep-group h3 .tag { font-size: .68rem; font-weight: 600; padding: 3px 8px; border-radius: 999px; letter-spacing: .03em; text-transform: uppercase; }
.tag--public { background: var(--brand-tint); color: var(--brand-strong); }
.tag--auth { background: #fef0e7; color: var(--warn); }
.ep-list { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.ep-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); background: var(--surface); }
.ep-row:last-child { border-bottom: none; }
.ep-row:hover { background: var(--surface-2); }
.method {
    font-family: var(--mono);
    font-size: .68rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    letter-spacing: .04em;
    min-width: 56px;
    text-align: center;
}
.method.get    { background: #e8f1ec; color: #1a7f4b; }
.method.post   { background: #e7effd; color: #2f6feb; }
.method.put    { background: #fdf3e6; color: #b7791f; }
.method.delete { background: #fcebe9; color: #c0392b; }
.ep-path { font-family: var(--mono); font-size: .84rem; color: var(--ink-2); overflow-x: auto; }

/* ---- CTA band ----------------------------------------------------------- */
.cta {
    background: var(--night);
    color: var(--night-ink);
    border-radius: var(--r-lg);
    padding: 64px 48px;
    text-align: center;
    background-image: radial-gradient(600px 200px at 50% 0%, rgba(26,127,75,.22), transparent 70%);
}
.cta h2 { color: #fff; margin-bottom: 14px; }
.cta p { color: var(--night-muted); max-width: 540px; margin: 0 auto 28px; }
.cta .btn--ghost { color: #fff; border-color: rgba(255,255,255,.22); }
.cta .btn--ghost:hover { background: rgba(255,255,255,.1); }
.cta__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---- Footer ------------------------------------------------------------- */
.footer { background: var(--night); color: var(--night-muted); padding: 64px 0 32px; }
.footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 40px; }
@media (max-width: 820px) { .footer__grid { grid-template-columns: 1fr 1fr; gap: 32px; } }
.footer__brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 650; margin-bottom: 14px; }
.footer__brand img { width: 26px; height: 26px; border-radius: 6px; }
.footer__brand b { color: #fff; }
.footer__about { font-size: .92rem; max-width: 300px; }
.footer__col h4 { color: #fff; font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 16px; font-weight: 600; }
.footer__col a { display: block; font-size: .92rem; color: var(--night-muted); padding: 5px 0; transition: color .15s ease; }
.footer__col a:hover { color: #fff; }
.footer__bottom {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--night-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    font-size: .86rem;
}
.footer__bottom a { color: var(--night-muted); }
.footer__bottom a:hover { color: #fff; }

/* ---- Code block (guides) ------------------------------------------------ */
.codeblock { position: relative; margin: 22px 0; }
.codeblock__bar {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--night-2);
    border: 1px solid var(--night-line);
    border-bottom: none;
    border-radius: var(--r-sm) var(--r-sm) 0 0;
    padding: 9px 14px;
}
.codeblock__name { font-family: var(--mono); font-size: .76rem; color: var(--night-muted); }
.codeblock__copy {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .74rem; font-weight: 600;
    color: var(--night-muted);
    background: transparent;
    border: 1px solid var(--night-line);
    border-radius: 6px;
    padding: 4px 9px;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease;
}
.codeblock__copy:hover { color: #fff; border-color: var(--muted); }
.codeblock__copy.is-done { color: #7fd1a3; border-color: #2f6b4a; }
.codeblock pre {
    margin: 0;
    background: var(--night);
    border: 1px solid var(--night-line);
    border-radius: 0 0 var(--r-sm) var(--r-sm);
    padding: 18px;
    overflow-x: auto;
    font-size: .84rem;
    line-height: 1.7;
    color: #d7e2e6;
}
.codeblock--plain pre { border-radius: var(--r-sm); }

/* ---- Guide layout ------------------------------------------------------- */
.guide { display: grid; grid-template-columns: 240px 1fr; gap: 48px; align-items: start; }
@media (max-width: 900px) { .guide { grid-template-columns: 1fr; } .guide__toc { display: none; } }
.guide__toc { position: sticky; top: calc(var(--nav-h) + 24px); }
.guide__toc h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 14px; }
.guide__toc a { display: block; font-size: .9rem; color: var(--ink-2); padding: 6px 0; border-left: 2px solid var(--line); padding-left: 14px; transition: color .15s, border-color .15s; }
.guide__toc a:hover, .guide__toc a.is-active { color: var(--brand); border-color: var(--brand); }
.guide__body h2 { margin: 44px 0 14px; scroll-margin-top: calc(var(--nav-h) + 20px); }
.guide__body h2:first-child { margin-top: 0; }
.guide__body h3 { margin: 26px 0 10px; }
.guide__body p { margin-bottom: 14px; }
.guide__body ul { margin: 0 0 16px 4px; }
.guide__body ul li { position: relative; padding-left: 22px; margin-bottom: 8px; color: var(--ink-2); }
.guide__body ul li::before { content: ""; position: absolute; left: 4px; top: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.guide__body :not(pre) > code { font-size: .86em; background: var(--surface-3); border: 1px solid var(--line); padding: 2px 6px; border-radius: 5px; color: var(--ink); }

.page-head { padding: 56px 0 8px; }
.page-head .crumb { font-size: .86rem; color: var(--muted); margin-bottom: 12px; display: inline-flex; align-items: center; gap: 6px; }
.page-head .crumb a { color: var(--brand); font-weight: 600; }
.page-head h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: 12px; }

/* ---- Callout ------------------------------------------------------------ */
.callout {
    display: flex; gap: 14px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--brand);
    background: var(--brand-tint);
    border-radius: var(--r-sm);
    padding: 16px 18px;
    margin: 20px 0;
    font-size: .93rem;
    color: var(--ink-2);
}
.callout svg { width: 20px; height: 20px; color: var(--brand); flex-shrink: 0; margin-top: 2px; }
.callout.callout--warn { border-left-color: var(--warn); background: #fdf6ec; }
.callout.callout--warn svg { color: var(--warn); }

/* ---- Table -------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); margin: 20px 0; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th, table.data td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
table.data th { background: var(--surface-2); font-weight: 600; color: var(--ink); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
table.data tr:last-child td { border-bottom: none; }
table.data td code { font-family: var(--mono); font-size: .85em; }

/* ---- Tabs (guides) ------------------------------------------------------ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 24px 0 0; }
.tabs button {
    background: none; border: none; cursor: pointer;
    font-size: .9rem; font-weight: 600; color: var(--muted);
    padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.is-active { color: var(--brand); border-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ---- Utility ------------------------------------------------------------ */
.mt-0 { margin-top: 0; }
.hidden { display: none !important; }
