:root {
    --bg: #07111f;
    --bg-2: #0b1728;
    --panel: rgba(13, 27, 46, 0.86);
    --panel-2: rgba(9, 19, 34, 0.92);
    --text: #f6f8fb;
    --muted: #b8c4d9;
    --line: rgba(115, 177, 255, 0.24);
    --blue: #39a7ff;
    --cyan: #22d3ee;
    --green: #7CFF6B;
    --orange: #ff8b32;
    --red: #ff5f4d;
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
    --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 80% 20%, rgba(35, 128, 255, 0.18), transparent 34%),
        radial-gradient(circle at 20% 75%, rgba(124, 255, 107, 0.12), transparent 30%),
        linear-gradient(135deg, #050a12 0%, var(--bg) 46%, #02050a 100%);
    line-height: 1.65;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.22;
    background-image:
        linear-gradient(rgba(57, 167, 255, .16) 1px, transparent 1px),
        linear-gradient(90deg, rgba(57, 167, 255, .16) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(to bottom, black, transparent 90%);
}

a { color: inherit; }
.container { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(5, 10, 18, 0.78);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}
.nav-wrap { display: flex; align-items: center; justify-content: space-between; min-height: 76px; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 850; letter-spacing: -0.04em; }
.brand-mark {
    width: 42px;
    height: 42px;
    border: 3px solid var(--cyan);
    border-radius: 12px;
    transform: rotate(45deg);
    box-shadow: 0 0 24px rgba(34, 211, 238, .38), inset 0 0 16px rgba(124,255,107,.16);
    position: relative;
}
.brand-mark::after {
    content: "";
    position: absolute;
    inset: 8px;
    border: 3px solid var(--green);
    border-radius: 8px;
}
.brand-text { font-size: 1.55rem; }
.brand-text span, .footer-brand span, h1 span { color: var(--green); }
.main-nav { display: flex; align-items: center; gap: 6px; }
.main-nav a {
    text-decoration: none;
    color: var(--muted);
    padding: 10px 12px;
    border-radius: 999px;
    font-weight: 650;
    font-size: .95rem;
}
.main-nav a:hover, .main-nav a.active { color: var(--text); background: rgba(57,167,255,.11); }
.main-nav .nav-cta { color: #031018; background: linear-gradient(135deg, var(--cyan), var(--green)); }
.nav-toggle { display: none; background: transparent; border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 8px 12px; font-size: 1.2rem; }

.hero { padding: 86px 0 76px; }
.hero-grid { display: grid; grid-template-columns: 1fr .92fr; align-items: center; gap: 48px; }
.eyebrow { color: var(--green); text-transform: uppercase; letter-spacing: .15em; font-size: .82rem; font-weight: 800; margin: 0 0 14px; }
h1, h2, h3 { line-height: 1.08; margin: 0; letter-spacing: -0.045em; }
.hero h1 { font-size: clamp(3.8rem, 9vw, 7.8rem); }
.hero h2 { font-size: clamp(2rem, 4vw, 3.45rem); margin-top: 10px; }
.lead { font-size: 1.22rem; color: var(--muted); max-width: 760px; margin: 24px 0 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin: 34px 0 0; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border-radius: 999px;
    padding: 0 20px;
    text-decoration: none;
    font-weight: 800;
    border: 1px solid var(--line);
}
.btn.primary { color: #031018; background: linear-gradient(135deg, var(--cyan), var(--green)); box-shadow: 0 0 34px rgba(34,211,238,.20); }
.btn.secondary { color: var(--text); background: rgba(255,255,255,.04); }
.local-note { color: var(--muted); margin-top: 22px; }
.hero-card, .feature-card, .content-panel, .include-panel, .exclude-panel, .contact-card, .scope-box, .toc, .doc-grid a {
    background: linear-gradient(180deg, rgba(13, 27, 46, .88), rgba(8, 18, 32, .78));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.diagram-card { padding: 34px; min-height: 450px; position: relative; overflow: hidden; }
.diagram-card::before, .content-panel::before {
    content: "";
    position: absolute;
    inset: auto -15% -20% -15%;
    height: 180px;
    background: radial-gradient(circle, rgba(57,167,255,.28), transparent 62%);
    pointer-events: none;
}
.client-row { text-align: center; color: var(--muted); text-transform: uppercase; letter-spacing: .16em; font-weight: 800; margin-bottom: 28px; }
.gateway-box {
    border: 1px solid rgba(57,167,255,.72);
    border-radius: 18px;
    padding: 22px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 850;
    box-shadow: 0 0 38px rgba(57,167,255,.2), inset 0 0 38px rgba(57,167,255,.08);
}
.gateway-box span { display: block; color: var(--cyan); font-size: .82rem; letter-spacing: .22em; text-transform: uppercase; margin-top: 6px; }
.node-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 54px; }
.node { text-align: center; padding: 20px 10px; border-radius: 18px; border: 1px solid rgba(124,255,107,.35); }
.node span { display: block; width: 62px; height: 44px; margin: 0 auto 14px; border: 3px solid #d6f2ff; border-radius: 50%; box-shadow: 0 0 25px rgba(57,167,255,.45); }
.node strong { display: block; color: var(--green); text-transform: uppercase; }
.node em { display: block; color: var(--muted); font-style: normal; text-transform: uppercase; font-size: .82rem; }

.section { padding: 76px 0; }
.section-head { max-width: 850px; margin-bottom: 32px; }
.section-head h2, .page-hero h1, .split-grid h2, .doc-links h2 { font-size: clamp(2.2rem, 5vw, 4.5rem); }
.section-head p, .page-hero p, .split-grid p { color: var(--muted); font-size: 1.1rem; }
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.feature-card { padding: 26px; }
.feature-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: #031018;
    background: linear-gradient(135deg, var(--cyan), var(--green));
    font-weight: 900;
    margin-bottom: 20px;
}
.feature-card h3 { font-size: 1.22rem; margin-bottom: 10px; }
.feature-card p, .content-panel p, .content-panel li, .contact-card p, .footer-grid p, .footer-grid li { color: var(--muted); }

.split-section { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.02); }
.split-grid { display: grid; grid-template-columns: 1fr .7fr; gap: 32px; align-items: start; }
.scope-box { padding: 28px; }
.scope-box h3 { font-size: 1.5rem; margin-bottom: 16px; }

.page-hero { padding: 82px 0 40px; }
.page-hero .container { max-width: 980px; }
.page-hero p { max-width: 850px; }
.content-grid { display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: start; }
.toc { position: sticky; top: 100px; padding: 18px; display: grid; gap: 8px; }
.toc a { color: var(--muted); text-decoration: none; padding: 10px 12px; border-radius: 12px; }
.toc a:hover { color: var(--text); background: rgba(57,167,255,.1); }
.content-panel { padding: 34px; position: relative; overflow: hidden; }
.content-panel h2 { font-size: 2rem; margin: 34px 0 14px; }
.content-panel h2:first-child { margin-top: 0; }
pre { overflow-x: auto; padding: 20px; border-radius: 18px; background: #030910; border: 1px solid rgba(57,167,255,.25); color: #dff9ff; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; color: #dff9ff; }
.info-list { display: grid; gap: 12px; margin: 22px 0; }
.info-list div { display: grid; gap: 4px; padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255,255,255,.03); }
.info-list strong { color: var(--text); }
.info-list span { color: var(--muted); }

.two-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.include-panel, .exclude-panel { padding: 34px; }
.include-panel { border-color: rgba(124,255,107,.45); }
.exclude-panel { border-color: rgba(255,139,50,.45); }
.include-panel h2 { color: var(--green); font-size: 2.5rem; }
.exclude-panel h2 { color: var(--orange); font-size: 2.5rem; }
ul { padding-left: 20px; }
.check-list, .x-list { list-style: none; padding-left: 0; }
.check-list li, .x-list li { position: relative; padding-left: 32px; margin: 12px 0; color: var(--muted); }
.check-list li::before, .x-list li::before { position: absolute; left: 0; top: 0; font-weight: 900; }
.check-list li::before { content: "✓"; color: var(--green); }
.x-list li::before { content: "×"; color: var(--red); }
.large li { font-size: 1.08rem; margin: 16px 0; }
.doc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 22px; }
.doc-grid a { display: grid; gap: 8px; padding: 22px; text-decoration: none; }
.doc-grid strong { color: var(--text); }
.doc-grid span { color: var(--muted); }
.contact-grid { display: grid; grid-template-columns: .85fr 1fr; gap: 24px; }
.contact-card { padding: 32px; }
.contact-card h2 { font-size: 2rem; margin: 24px 0 12px; }
.contact-card h2:first-child { margin-top: 0; }

.site-footer { border-top: 1px solid var(--line); padding: 54px 0 26px; background: rgba(2,5,10,.58); }
.footer-grid { display: grid; grid-template-columns: 1.25fr 1fr 1fr 1fr; gap: 28px; }
.footer-brand { font-size: 1.8rem; font-weight: 900; letter-spacing: -0.04em; margin-bottom: 12px; }
.site-footer h3 { margin-bottom: 12px; font-size: 1rem; color: var(--green); text-transform: uppercase; letter-spacing: .1em; }
.site-footer ul { list-style: none; padding-left: 0; margin: 0; }
.site-footer li { margin: 8px 0; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.footer-bottom { display: flex; justify-content: space-between; gap: 20px; padding-top: 28px; margin-top: 34px; border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem; }

@media (max-width: 980px) {
    .hero-grid, .split-grid, .content-grid, .two-panels, .contact-grid { grid-template-columns: 1fr; }
    .feature-grid, .doc-grid, .footer-grid { grid-template-columns: repeat(2, 1fr); }
    .toc { position: static; }
}

@media (max-width: 720px) {
    .container { width: min(100% - 28px, 1180px); }
    .nav-toggle { display: inline-flex; }
    .main-nav { display: none; position: absolute; left: 14px; right: 14px; top: 76px; padding: 14px; background: rgba(5, 10, 18, .96); border: 1px solid var(--line); border-radius: 18px; flex-direction: column; align-items: stretch; }
    .main-nav.open { display: flex; }
    .main-nav a { border-radius: 12px; }
    .hero { padding-top: 54px; }
    .feature-grid, .doc-grid, .footer-grid { grid-template-columns: 1fr; }
    .node-grid { grid-template-columns: 1fr; }
    .footer-bottom { flex-direction: column; }
}

/* Database-backed forms, blog and admin additions */
.flash-wrap { padding-top: 1rem; }
.flash, .notice { border: 1px solid rgba(79, 172, 254, .35); background: rgba(12, 24, 45, .86); border-radius: 16px; padding: 1rem 1.1rem; margin: 0 0 1rem; color: #eaf6ff; }
.flash-success, .notice.success { border-color: rgba(126, 242, 157, .65); box-shadow: 0 0 24px rgba(126, 242, 157, .12); }
.flash-danger, .notice.danger { border-color: rgba(255, 99, 99, .65); box-shadow: 0 0 24px rgba(255, 99, 99, .12); }
.flash-warn, .notice.warn { border-color: rgba(255, 180, 68, .65); box-shadow: 0 0 24px rgba(255, 180, 68, .12); }
.narrow { max-width: 900px; }
.form-card { background: rgba(5, 14, 28, .88); border: 1px solid rgba(79,172,254,.28); border-radius: 24px; padding: 1.25rem; box-shadow: 0 0 36px rgba(54, 146, 255, .1); }
.form-card.compact { padding: 1rem; }
.form-card label { display: block; margin: 0 0 1rem; color: #d8e8ff; font-weight: 700; }
.form-card input, .form-card textarea, .form-card select { width: 100%; margin-top: .4rem; border: 1px solid rgba(79,172,254,.35); background: rgba(2, 8, 18, .95); color: #fff; border-radius: 12px; padding: .85rem .9rem; font: inherit; outline: none; }
.form-card input:focus, .form-card textarea:focus, .form-card select:focus { border-color: #7ef29d; box-shadow: 0 0 0 3px rgba(126,242,157,.12); }
.form-card .hp, .hp { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }
.check-inline { display: flex !important; align-items: flex-start; gap: .65rem; font-weight: 500 !important; }
.check-inline input { width: auto; margin-top: .2rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid rgba(79,172,254,.45); background: rgba(12,24,45,.82); color: #eaf6ff; border-radius: 999px; padding: .75rem 1rem; text-decoration: none; cursor: pointer; font-weight: 800; }
.btn.primary { border-color: rgba(126,242,157,.8); background: linear-gradient(135deg, rgba(38,132,255,.26), rgba(126,242,157,.22)); }
.btn.danger { border-color: rgba(255,99,99,.85); color: #ffb7b7; }
.btn.ghost { background: transparent; }
.btn.small { padding: .45rem .7rem; font-size: .85rem; }
.text-link { color: #7ef29d; font-weight: 800; text-decoration: none; }
.post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.post-card { background: rgba(5, 14, 28, .82); border: 1px solid rgba(79,172,254,.26); border-radius: 24px; padding: 1.2rem; min-height: 240px; }
.post-card h2 { margin-top: .2rem; }
.post-card h2 a { color: #fff; text-decoration: none; }
.article-body { background: rgba(5, 14, 28, .78); border: 1px solid rgba(79,172,254,.22); border-radius: 24px; padding: 1.4rem; line-height: 1.8; color: #eaf6ff; }
.soft-divider { border: 0; border-top: 1px solid rgba(79,172,254,.22); margin: 2rem 0; }
.comment { border: 1px solid rgba(79,172,254,.2); background: rgba(12, 24, 45, .5); border-radius: 18px; padding: 1rem; margin: .75rem 0; }
.comment span { display: block; color: #98b8df; font-size: .9rem; margin-top: .2rem; }
.admin-nav { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.2rem; }
.admin-nav a { border: 1px solid rgba(79,172,254,.32); border-radius: 999px; padding: .55rem .8rem; color: #eaf6ff; text-decoration: none; background: rgba(12,24,45,.65); }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.metric { border: 1px solid rgba(126,242,157,.28); background: rgba(5,14,28,.82); border-radius: 18px; padding: 1rem; }
.metric strong { display: block; font-size: 2rem; color: #7ef29d; }
.metric span { color: #c8ddf7; }
.table-wrap { overflow-x: auto; border: 1px solid rgba(79,172,254,.22); border-radius: 18px; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 900px; background: rgba(5, 14, 28, .8); }
.admin-table th, .admin-table td { padding: .85rem; text-align: left; border-bottom: 1px solid rgba(79,172,254,.16); vertical-align: top; }
.admin-table th { color: #7ef29d; background: rgba(12,24,45,.72); }
.inline-form { display: inline-block; margin: .15rem; }
.actions { min-width: 230px; }
.badge { display: inline-flex; border: 1px solid rgba(79,172,254,.35); border-radius: 999px; padding: .25rem .55rem; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: #dbeeff; }
.badge-ok { border-color: rgba(126,242,157,.6); color: #7ef29d; }
.badge-warn { border-color: rgba(255,180,68,.7); color: #ffd08a; }
.badge-danger { border-color: rgba(255,99,99,.8); color: #ff9b9b; }
.danger-text { color: #ff9b9b; }
pre { white-space: pre-wrap; overflow-x: auto; background: rgba(2, 8, 18, .95); border: 1px solid rgba(79,172,254,.22); border-radius: 14px; padding: 1rem; }
code { color: #7ef29d; }

@media (max-width: 980px) {
    .post-grid, .metric-grid { grid-template-columns: 1fr; }
}
