:root {
    --ink: #14213D;
    --ink-soft: #2A3B5C;
    --parchment: #FAF7F0;
    --parchment-dim: #F1EBDC;
    --pine: #2B6E5E;
    --rust: #C9622C;
    --rust-dim: #E4A47C;
    --slate: #6B7280;
    --line: #DAD3BF;
    --white: #FFFDF9;
    --serif: "Newsreader", Georgia, serif;
    --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", "Courier New", monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--parchment);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

img,
svg {
    display: block;
    max-width: 100%;
}

:focus-visible {
    outline: 2px solid var(--rust);
    outline-offset: 3px;
}

.wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 32px;
}

.eyebrow {
    font-family: var(--mono);
    font-size: 12.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--rust);
    display: flex;
    align-items: center;
    gap: 10px;
}

.eyebrow::before {
    content: "";
    width: 22px;
    height: 1px;
    background: var(--rust);
    display: inline-block;
}

h1,
h2,
h3 {
    font-family: var(--serif);
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--ink);
}

/* ---------------- NAV ---------------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(250, 247, 240, .92);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
}

.nav .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 76px;
}

.brand {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-decoration: none;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.brand .mark {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--rust);
    letter-spacing: .08em;
    font-weight: 500;
}

.navlinks {
    display: flex;
    align-items: center;
    gap: 36px;
    list-style: none;
}

.navlinks a {
    text-decoration: none;
    font-size: 14.5px;
    color: var(--ink-soft);
    transition: color .15s ease;
}

.navlinks a:hover {
    color: var(--rust);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--sans);
    font-size: 14.5px;
    font-weight: 500;
    text-decoration: none;
    padding: 11px 20px;
    border-radius: 3px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .15s ease;
}

.btn-primary {
    background: var(--ink);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--rust);
}

.btn-ghost {
    border-color: var(--ink);
    color: var(--ink);
    background: transparent;
}

.btn-ghost:hover {
    border-color: var(--rust);
    color: var(--rust);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 44px;
    height: 40px;
    padding: 0;
    background: none;
    border: 1px solid var(--line);
    border-radius: 3px;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    width: 18px;
    height: 1.5px;
    background: var(--ink);
    transition: transform .18s ease, opacity .18s ease;
}

.nav-toggle.is-open span:nth-child(1) {
    transform: translateY(5.5px) rotate(45deg);
}

.nav-toggle.is-open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-open span:nth-child(3) {
    transform: translateY(-5.5px) rotate(-45deg);
}

.label-short {
    display: none;
}

/* Keep anchor targets clear of the sticky header */
section[id],
main[id] {
    scroll-margin-top: 96px;
}

/* ---------------- HERO ---------------- */
.hero {
    padding: 88px 0 40px;
    border-bottom: 1px solid var(--line);
}

.hero-top {
    display: grid;
    grid-template-columns: 1.1fr .8fr;
    gap: 64px;
    align-items: end;
}

.hero h1 {
    font-size: clamp(34px, 4.6vw, 56px);
    line-height: 1.08;
    margin: 20px 0 24px;
}

.hero h1 em {
    font-style: italic;
    color: var(--rust);
}

.hero-sub {
    font-size: 17px;
    color: var(--ink-soft);
    max-width: 44ch;
    margin-bottom: 32px;
}

.hero-actions {
    display: flex;
    gap: 14px;
    margin-bottom: 8px;
}

.hero-stat-col {
    border-left: 1px solid var(--line);
    padding-left: 32px;
}

.hero-stat-col p {
    font-size: 15px;
    color: var(--ink-soft);
    margin-bottom: 22px;
}

.stat-row {
    display: flex;
    gap: 28px;
}

.stat {
    font-family: var(--mono);
}

.stat .num {
    font-size: 26px;
    color: var(--ink);
    display: block;
    line-height: 1;
    margin-bottom: 6px;
}

.stat .label {
    font-size: 11.5px;
    color: var(--slate);
    text-transform: uppercase;
    letter-spacing: .06em;
}

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

    .hero-stat-col {
        border-left: none;
        border-top: 1px solid var(--line);
        padding-left: 0;
        padding-top: 24px;
    }
}

/* ---------------- SCHEMATIC ---------------- */
.schematic-section {
    padding: 56px 0 80px;
}

.schematic-caption {
    text-align: center;
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--slate);
    letter-spacing: .04em;
    margin-top: 18px;
}

.schematic-svg text {
    font-family: var(--mono);
}

.schem-hub-label {
    font-family: var(--serif);
    font-style: italic;
    font-size: 17px;
    fill: var(--ink);
}

.schem-node-rect {
    fill: var(--white);
    stroke: var(--ink);
    stroke-width: 1.3;
}

.schem-node-title {
    font-family: var(--sans);
    font-weight: 600;
    font-size: 15px;
    fill: var(--ink);
}

.schem-node-sub {
    font-size: 9.5px;
    fill: var(--slate);
}

.schem-line {
    stroke: var(--ink);
    stroke-width: 1.1;
    fill: none;
}

.schem-ring {
    stroke: var(--line);
    stroke-width: 1;
    fill: none;
    stroke-dasharray: 2 5;
}

.schem-dot {
    fill: var(--rust);
}

.schematic-mobile {
    display: none;
    margin: 0 auto;
}

.schematic-mobile text {
    font-family: var(--mono);
}

.schem-m-hub {
    font-family: var(--serif);
    font-style: italic;
    font-size: 19px;
    fill: var(--ink);
}

.schem-m-title {
    font-family: var(--sans);
    font-weight: 600;
    font-size: 15px;
    fill: var(--ink);
}

.schem-m-sub {
    font-size: 10.5px;
    fill: var(--slate);
}

/* ---------------- SYSTEMS ---------------- */
.systems {
    padding: 88px 0;
    background: var(--parchment-dim);
    border-bottom: 1px solid var(--line);
}

.section-head {
    max-width: 640px;
    margin-bottom: 56px;
}

.section-head h2 {
    font-size: clamp(28px, 3.2vw, 38px);
    margin-top: 16px;
}

.section-head p {
    color: var(--ink-soft);
    font-size: 16px;
    margin-top: 14px;
    max-width: 56ch;
}

.system-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
}

.system-card {
    background: var(--white);
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
}

.system-code {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--rust);
    letter-spacing: .05em;
    margin-bottom: 14px;
}

.system-card h3 {
    font-size: 22px;
    margin-bottom: 4px;
}

.system-full {
    font-size: 13px;
    color: var(--slate);
    margin-bottom: 16px;
    font-style: italic;
    font-family: var(--serif);
}

.system-card p {
    font-size: 14.5px;
    color: var(--ink-soft);
    margin-bottom: 20px;
    flex-grow: 1;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.chip {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ink);
    background: var(--parchment-dim);
    border: 1px solid var(--line);
    padding: 4px 9px;
    border-radius: 2px;
    white-space: nowrap;
}

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

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

/* ---------------- PROCESS ---------------- */
.process {
    padding: 88px 0;
    border-bottom: 1px solid var(--line);
}

.process-list {
    margin-top: 20px;
}

.process-item {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 32px;
    padding: 28px 0;
    border-top: 1px solid var(--line);
}

.process-item:last-child {
    border-bottom: 1px solid var(--line);
}

.process-code {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--rust);
    letter-spacing: .04em;
    padding-top: 3px;
}

.process-body h3 {
    font-size: 21px;
    font-weight: 500;
    margin-bottom: 8px;
}

.process-body p {
    color: var(--ink-soft);
    font-size: 15px;
    max-width: 66ch;
}

@media (max-width:700px) {
    .process-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* ---------------- LAYER (middleware) ---------------- */
.layer {
    padding: 72px 0;
    background: var(--ink);
    color: var(--parchment);
    border-bottom: 1px solid var(--line);
}

.layer .eyebrow {
    color: var(--rust-dim);
}

.layer .eyebrow::before {
    background: var(--rust-dim);
}

.layer h2 {
    color: var(--white);
    font-size: clamp(24px, 3vw, 32px);
    margin: 16px 0 14px;
}

.layer p {
    color: #C7CCDA;
    max-width: 56ch;
    font-size: 15.5px;
    margin-bottom: 32px;
}

.layer-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.layer-chip {
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--parchment);
    border: 1px solid #3B4C72;
    padding: 8px 14px;
    border-radius: 2px;
}

/* ---------------- CTA ---------------- */
.cta {
    padding: 100px 0;
    text-align: center;
}

.cta h2 {
    font-size: clamp(28px, 4vw, 42px);
    max-width: 16ch;
    margin: 18px auto 20px;
}

.cta p {
    color: var(--ink-soft);
    max-width: 52ch;
    margin: 0 auto 34px;
    font-size: 16px;
}

.cta .hero-actions {
    justify-content: center;
}

.cta-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ---------------- FOOTER ---------------- */
footer {
    border-top: 1px solid var(--line);
    padding: 48px 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 32px;
}

.footer-brand {
    font-family: var(--serif);
    font-size: 19px;
    margin-bottom: 10px;
}

.footer-grid p {
    font-size: 13.5px;
    color: var(--slate);
    max-width: 32ch;
}

.footer-col h4 {
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--slate);
    margin-bottom: 14px;
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    margin-bottom: 10px;
}

.footer-col a {
    text-decoration: none;
    font-size: 14px;
    color: var(--ink-soft);
}

.footer-col a:hover {
    color: var(--rust);
}

.footer-bottom {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--slate);
}

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

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

    .footer-bottom {
        flex-direction: column;
        gap: 8px;
    }
}

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

    * {
        transition: none !important;
    }
}

/* ============================================================
   MOBILE / RESPONSIVE
   Ordered largest breakpoint first so rules cascade correctly.
   ============================================================ */

/* ---- Tablet: 900px ---- */
@media (max-width: 900px) {
    .hero-top {
        gap: 44px;
    }
}

/* ---- Collapse nav into a menu panel: 860px ---- */
@media (max-width: 860px) {
    section[id],
    main[id] {
        scroll-margin-top: 76px;
    }

    .nav .wrap {
        height: 64px;
        gap: 12px;
    }

    .brand {
        font-size: 19px;
    }

    /* The tagline crowds the bar once the toggle appears */
    .brand .mark {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    /* Nav links become a dropdown panel beneath the bar */
    .navlinks {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 4px 20px 14px;
        background: var(--parchment);
        border-bottom: 1px solid var(--line);
        box-shadow: 0 14px 26px rgba(20, 33, 61, .08);
    }

    .navlinks.open {
        display: flex;
    }

    .navlinks li {
        border-top: 1px solid var(--line);
    }

    .navlinks a {
        display: block;
        padding: 15px 2px;
        font-size: 15.5px;
    }

    .hero {
        padding: 56px 0 32px;
    }

    .hero h1 {
        font-size: clamp(30px, 6.6vw, 46px);
    }

    .schematic-section {
        padding: 36px 0 56px;
    }

    .systems,
    .process {
        padding: 60px 0;
    }

    .layer {
        padding: 56px 0;
    }

    .cta {
        padding: 72px 0;
    }

    .section-head {
        margin-bottom: 40px;
    }
}

/* ---- Swap in the vertical schematic: 760px ---- */
@media (max-width: 760px) {
    .schematic-svg {
        display: none;
    }

    .schematic-mobile {
        display: block;
        max-width: 420px;
    }

    .schematic-caption {
        text-align: left;
        max-width: 420px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* ---- Phone: 620px ---- */
@media (max-width: 620px) {
    .wrap {
        padding: 0 20px;
    }

    /* Shorter CTA label so brand + button + toggle fit one line */
    .label-long {
        display: none;
    }

    .label-short {
        display: inline;
    }

    .nav-cta {
        padding: 10px 14px;
        font-size: 14px;
    }

    .navlinks {
        padding-left: 20px;
        padding-right: 20px;
    }

    .hero {
        padding: 44px 0 28px;
    }

    .hero-sub {
        font-size: 16px;
        margin-bottom: 26px;
    }

    .hero-stat-col p {
        font-size: 14.5px;
    }

    /* 26px mono overflows two-across on a phone */
    .stat-row {
        flex-wrap: wrap;
        gap: 22px 26px;
    }

    .stat .num {
        font-size: 19px;
    }

    .stat .label {
        font-size: 11px;
    }

    .section-head h2 {
        font-size: clamp(25px, 6vw, 32px);
    }

    .section-head p {
        font-size: 15px;
    }

    .system-card {
        padding: 26px 20px;
    }

    .process-body p,
    .layer p {
        font-size: 14.5px;
    }

    .cta h2 {
        font-size: clamp(26px, 7vw, 36px);
        max-width: 20ch;
    }

    .cta p {
        font-size: 15px;
    }

    footer {
        padding: 40px 0;
    }

    .footer-bottom {
        margin-top: 36px;
    }
}

/* ---- Stack the button pairs: 520px ---- */
@media (max-width: 520px) {
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .hero-actions .btn {
        justify-content: center;
        padding: 13px 20px;
    }

    .cta .hero-actions {
        width: 100%;
    }

    .cta-wrap {
        align-items: stretch;
    }

    .cta-wrap .eyebrow {
        justify-content: center;
    }

    /* Chips can exceed the card width once padding is subtracted */
    .chip {
        white-space: normal;
    }
}

/* ---- Small phones: 400px ---- */
@media (max-width: 400px) {
    .wrap {
        padding: 0 16px;
    }

    .brand {
        font-size: 17.5px;
    }

    .nav-cta {
        padding: 9px 12px;
        font-size: 13.5px;
    }

    .nav-toggle {
        width: 40px;
    }

    .hero h1 {
        font-size: 28px;
    }

    .layer-chip,
    .chip {
        font-size: 11px;
    }
}