/* MBG Solutions — site styles
   Concept: a drafting sheet. Cool paper, brand navy ink (from the logo), a drawing grid
   behind the hero and a title block that summarises the company. Everything else stays quiet. */

:root {
    --paper: #f4f6f7;
    --surface: #ffffff;
    --ink: #15222c;
    --ink-2: #4a5a66;
    --navy: #003b6d;
    --navy-strong: #00294d;
    --on-navy: #ffffff;
    --line: #c5d0d8;
    --grid-minor: #e3e9ed;
    --grid-major: #d3dce2;
    --mark: #b7791f;
    --ok: #1f6b45;
    --ok-bg: #e8f3ed;
    --error: #a42a1f;
    --error-bg: #f8e9e7;
    --logo-plate: transparent;

    --font: "Archivo", "Segoe UI", system-ui, -apple-system, sans-serif;
    --wrap: 72rem;
    --gutter: clamp(1rem, 4vw, 2.5rem);
    --radius: 4px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #0f1820;
        --surface: #16222d;
        --ink: #e4ebf0;
        --ink-2: #9dafbc;
        --navy: #8dbbea;
        --navy-strong: #b3d3f3;
        --on-navy: #0f1820;
        --line: #2c3d4a;
        --grid-minor: #17232d;
        --grid-major: #1e2d39;
        --mark: #e0a647;
        --ok: #7fd1a4;
        --ok-bg: #143024;
        --error: #f19a8f;
        --error-bg: #3a1c19;
        --logo-plate: #ffffff;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --paper: #0f1820;
    --surface: #16222d;
    --ink: #e4ebf0;
    --ink-2: #9dafbc;
    --navy: #8dbbea;
    --navy-strong: #b3d3f3;
    --on-navy: #0f1820;
    --line: #2c3d4a;
    --grid-minor: #17232d;
    --grid-major: #1e2d39;
    --mark: #e0a647;
    --ok: #7fd1a4;
    --ok-bg: #143024;
    --error: #f19a8f;
    --error-bg: #3a1c19;
    --logo-plate: #ffffff;
    color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 1.0625rem;
    line-height: 1.6;
    font-stretch: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

main { flex: 1 0 auto; }

img { max-width: 100%; height: auto; }

h1, h2, h3, h4 {
    margin: 0 0 .5em;
    line-height: 1.12;
    color: var(--ink);
}

h1 { font-size: 2rem; font-weight: 750; font-stretch: 112%; letter-spacing: -.015em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); font-weight: 720; font-stretch: 110%; letter-spacing: -.01em; }
h3 { font-size: 1.2rem; font-weight: 680; font-stretch: 104%; }
h4 { font-size: .875rem; font-weight: 620; font-stretch: 85%; color: var(--ink-2); margin: 1rem 0 .4rem; }

p { margin: 0 0 1rem; }

a { color: var(--navy); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--navy-strong); text-decoration-thickness: 2px; }

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

code { font-size: .9em; }

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: 1rem; top: -3rem;
    background: var(--navy); color: var(--on-navy);
    padding: .5rem 1rem; z-index: 100;
    border-radius: var(--radius);
}
.skip-link:focus { top: .75rem; }

/* ---------- Header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.header-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-height: 4.25rem;
}

.brand { display: inline-flex; flex: none; background: var(--logo-plate); border-radius: var(--radius); padding: 2px 6px; margin-left: -6px; }
.brand img { display: block; width: 209px; height: auto; }

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    gap: 1.5rem;
}

.site-nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 1.6rem;
    margin: 0;
    padding: 0;
}

.nav-sections { margin-left: auto !important; }

.site-nav a {
    color: var(--ink-2);
    text-decoration: none;
    font-size: .95rem;
    font-weight: 560;
    font-stretch: 94%;
}
.site-nav a:hover { color: var(--navy); }

.nav-toggle {
    display: none;
    margin-left: auto;
    width: 2.75rem; height: 2.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    position: relative;
}
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
    position: absolute;
    left: 50%;
    width: 1.1rem; height: 2px;
    background: var(--ink);
    transform: translateX(-50%);
    content: "";
}
.nav-toggle-bars { top: 50%; margin-top: -1px; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }

@media (max-width: 60rem) {
    .nav-toggle { display: block; }
    .site-nav {
        display: none;
        position: absolute;
        top: 100%; left: 0; right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--line);
        padding: .5rem var(--gutter) 1rem;
    }
    .site-nav.is-open { display: flex; }
    .site-nav ul { flex-direction: column; align-items: stretch; gap: 0; }
    .site-nav li a { display: block; padding: .7rem 0; width: 100%; text-align: left; }
    .nav-sections { margin-left: 0 !important; }
    .brand img { width: 170px; }
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.9rem;
    padding: .6rem 1.25rem;
    border-radius: var(--radius);
    border: 1.5px solid var(--navy);
    font: inherit;
    font-size: 1rem;
    font-weight: 620;
    font-stretch: 98%;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.btn-primary { background: var(--navy); color: var(--on-navy); }
.btn-primary:hover { background: var(--navy-strong); border-color: var(--navy-strong); color: var(--on-navy); text-decoration: none; }
.btn-quiet { background: transparent; color: var(--navy); }
.btn-quiet:hover { background: var(--surface); color: var(--navy-strong); text-decoration: none; }

/* ---------- Hero: the drafting sheet ---------- */

.hero {
    position: relative;
    padding-block: clamp(3.5rem, 9vw, 7rem) clamp(3rem, 7vw, 5.5rem);
    background-color: var(--paper);
    background-image:
        linear-gradient(var(--grid-major) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
        linear-gradient(var(--grid-minor) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
    background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
    background-position: -1px -1px;
    border-bottom: 1px solid var(--line);
}

/* Fade the grid out toward the lower left so the headline sits on clean paper */
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 70% 90% at 15% 60%, var(--paper) 30%, transparent 75%);
    pointer-events: none;
}

.hero-grid {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: end;
}

/* Registration marks at the sheet corners */
.hero-grid::before,
.hero-grid::after {
    content: "";
    position: absolute;
    width: 18px; height: 18px;
    border-color: var(--ink-2);
    border-style: solid;
    opacity: .55;
}
.hero-grid::before { top: -2.25rem; left: calc(var(--gutter) - 1.25rem); border-width: 1.5px 0 0 1.5px; }
.hero-grid::after { bottom: -2rem; right: calc(var(--gutter) - 1.25rem); border-width: 0 1.5px 1.5px 0; }

.hero h1 {
    font-size: clamp(2.35rem, 5.4vw, 4.4rem);
    font-weight: 780;
    font-stretch: 116%;
    line-height: 1.02;
    letter-spacing: -.025em;
    max-width: 14ch;
    margin-bottom: 1.5rem;
}

.lede {
    font-size: clamp(1.1rem, 1.6vw, 1.25rem);
    line-height: 1.55;
    color: var(--ink-2);
    max-width: 38rem;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 2rem 0 0; }

/* Title block */
.title-block {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1.5px solid var(--ink);
    font-size: .95rem;
    line-height: 1.4;
    animation: draw-in .8s cubic-bezier(.2, .7, .2, 1) .15s both;
}

.title-block caption {
    caption-side: top;
    text-align: left;
    background: var(--surface);
    border: 1.5px solid var(--ink);
    border-bottom: 0;
    padding: .8rem 1rem;
    font-weight: 760;
    font-stretch: 118%;
    font-size: 1.15rem;
    letter-spacing: -.01em;
    color: var(--ink);
}

.title-block th,
.title-block td {
    padding: .65rem 1rem;
    border-top: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.title-block th {
    width: 34%;
    font-weight: 600;
    font-stretch: 82%;
    color: var(--ink-2);
    border-right: 1px solid var(--line);
}

.title-block tfoot th,
.title-block tfoot td { border-top: 1.5px solid var(--ink); }

.rev {
    float: right;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-stretch: 82%;
    font-weight: 600;
    color: var(--ink-2);
}
.rev::before {
    content: "";
    width: 0; height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid var(--mark);
}

@keyframes draw-in {
    from { clip-path: inset(0 100% 0 0); }
    to { clip-path: inset(0 0 0 0); }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .title-block { animation: none; }
    .btn { transition: none; }
}

@media (max-width: 52rem) {
    .hero-grid { grid-template-columns: 1fr; align-items: start; }
    .hero-grid::before, .hero-grid::after { display: none; }
    .hero h1 { max-width: 16ch; }
}

/* ---------- Sections ---------- */

.section {
    padding-block: clamp(3.5rem, 8vw, 6rem);
    border-bottom: 1px solid var(--line);
}

.section-intro { max-width: 36rem; margin-bottom: 2.5rem; }
.section-intro p { color: var(--ink-2); font-size: 1.1rem; margin: 0; }

/* Product spec list */
.spec-list { border-bottom: 1px solid var(--line); }

.spec-row {
    display: grid;
    grid-template-columns: 13rem minmax(0, 1fr) 17rem;
    gap: 1.25rem 2.5rem;
    padding-block: 1.75rem;
    border-top: 1px solid var(--line);
}

.spec-name h3 { margin-bottom: .2rem; font-size: 1.4rem; font-stretch: 110%; }
.spec-name p { margin: 0; color: var(--ink-2); font-size: .9rem; font-stretch: 86%; font-weight: 560; }

.spec-text { margin: 0; max-width: 34rem; }
.spec-link { display: inline-block; margin-top: .5rem; font-weight: 600; }

.spec-stack { margin: 0; font-size: .95rem; color: var(--ink-2); }
.spec-stack-label {
    display: block;
    font-size: .8rem;
    font-weight: 620;
    font-stretch: 82%;
    color: var(--ink-2);
    margin-bottom: .15rem;
    opacity: .85;
}

@media (max-width: 56rem) {
    .spec-row { grid-template-columns: 1fr; gap: .5rem; }
}

/* Engineering */
.section-eng { background: var(--surface); }

.eng-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 3rem;
    align-items: start;
}

.feature-product {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 1.5rem;
    padding: 2rem;
    border: 1px solid var(--line);
    border-left: 4px solid var(--mark);
    border-radius: var(--radius);
    background: var(--paper);
}
.feature-product h3 { font-size: 1.6rem; font-stretch: 112%; margin-bottom: .2rem; }
.feature-kind { color: var(--ink-2); font-size: .9rem; font-stretch: 86%; font-weight: 560; margin-bottom: 1rem; }
.feature-product p:last-of-type { max-width: 34rem; }
.feature-logo { display: block; margin-top: .3rem; }

@media (max-width: 52rem) {
    .eng-grid { grid-template-columns: 1fr; gap: 0; }
    .feature-product { grid-template-columns: 1fr; padding: 1.5rem; }
}

/* Technologies */
.tech-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tech-group { padding: 0 2rem; border-left: 1px solid var(--line); }
.tech-group:first-child { padding-left: 0; border-left: 0; }
.tech-group > p { color: var(--ink-2); font-size: .98rem; }

.tags {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin: 0 0 .5rem;
    padding: 0;
}
.tags li {
    padding: .2rem .55rem;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--surface);
    font-size: .875rem;
    font-stretch: 90%;
    line-height: 1.5;
}

@media (max-width: 56rem) {
    .tech-grid { grid-template-columns: 1fr; gap: 2rem; }
    .tech-group { padding: 0; border-left: 0; }
    .tech-group + .tech-group { padding-top: 2rem; border-top: 1px solid var(--line); }
}

/* About */
.about-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr);
    gap: 3rem;
}
.about-lead {
    font-size: clamp(1.35rem, 2.4vw, 1.75rem);
    font-stretch: 104%;
    font-weight: 520;
    line-height: 1.35;
    color: var(--ink);
    max-width: 30ch;
}
.about-text > p:not(.about-lead) { color: var(--ink-2); max-width: 40rem; }
.tags-quiet li { background: transparent; }

@media (max-width: 52rem) {
    .about-grid { grid-template-columns: 1fr; gap: .5rem; }
}

/* Contact */
.section-contact { border-bottom: 0; }

.contact-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
    gap: 3rem;
}

.contact-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: clamp(1.25rem, 3vw, 2rem);
}

@media (max-width: 52rem) {
    .contact-grid { grid-template-columns: 1fr; gap: 0; }
}

/* ---------- Forms ---------- */

.form { margin: 0; }

.field { margin-bottom: 1.15rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 36rem) { .field-row { grid-template-columns: 1fr; } }

.field label {
    display: block;
    margin-bottom: .35rem;
    font-weight: 600;
    font-size: .95rem;
}

.field input:not([type="checkbox"]):not([type="hidden"]),
.field select,
.field textarea {
    width: 100%;
    padding: .65rem .8rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
    line-height: 1.4;
}
.field textarea { resize: vertical; min-height: 9rem; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
    border-color: var(--navy);
    outline-offset: 1px;
}

.field-check input:not([type="hidden"]) { max-width: 8rem; }

.field-hint { margin: .35rem 0 0; font-size: .875rem; color: var(--ink-2); }

.field-error { display: block; color: var(--error); font-size: .9rem; margin-top: .3rem; }
.field-error:empty { display: none; }
.input-validation-error { border-color: var(--error) !important; }

.form-errors ul { margin: 0 0 1rem; padding: .75rem 1rem .75rem 2rem; color: var(--error); background: var(--error-bg); border-radius: var(--radius); }
.validation-summary-valid { display: none; }

.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin: 1.5rem 0 0; }

/* ---------- Notices ---------- */

.notice {
    padding: 1rem 1.25rem;
    border-left: 4px solid;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 1.5rem;
}
.notice h3 { margin-bottom: .3rem; }
.notice p:last-child { margin-bottom: 0; }
.notice-ok { border-color: var(--ok); background: var(--ok-bg); }
.notice-error { border-color: var(--error); background: var(--error-bg); }

/* ---------- Error page ---------- */

.auth { padding-block: clamp(2.5rem, 7vw, 5rem); }

.auth-panel {
    max-width: 30rem;
    margin-inline: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 4px solid var(--navy);
    border-radius: var(--radius);
    padding: clamp(1.5rem, 4vw, 2.5rem);
}

.panel-code { color: var(--ink-2); font-stretch: 85%; font-weight: 600; margin-bottom: .25rem; }

/* ---------- Footer ---------- */

.site-footer {
    border-top: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-2);
    font-size: .875rem;
}
.footer-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .5rem 2rem;
    padding-block: 1.5rem;
}
.footer-row p { margin: 0; }
.footer-copy { color: var(--ink); font-weight: 560; }
.footer-meta { flex: 1 1 22rem; }
