/* Industrial Equations - shared stylesheet
 * Timeless, engineered, document-like.
 * Monospace-dominant, Swiss grid, RAL 2004 signal.
 */

@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Inter:wght@400;500;600;700&display=swap");

:root {
    --paper: #f2f0ec;
    --paper-2: #e8e5de;
    --ink: #1a1917;
    --ink-2: #4a4843;
    --ink-3: #8a867d;
    --rule: #b8b5ae;
    --rule-2: #d4d1c9;
    --signal: #f44611; /* RAL 2004 */
    --signal-ink: #b53408;

    --mono:
        "JetBrains Mono", "Berkeley Mono", "IBM Plex Mono", ui-monospace,
        SFMono-Regular, Menlo, monospace;
    --sans: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;

    --fs-xs: 10px;
    --fs-sm: 11px;
    --fs-base: 13px;
    --fs-md: 15px;
    --fs-lg: 18px;
    --fs-xl: 28px;
    --fs-display: 56px;

    --cell: 20px;

    --sidebar-w: 248px;
    --header-h: 88px;
}

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

html,
body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--mono);
    font-size: var(--fs-base);
    line-height: 1.45;
    font-feature-settings:
        "tnum" 1,
        "zero" 1,
        "calt" 0,
        "liga" 0;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
}

a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--signal);
}
a:hover {
    color: var(--signal-ink);
    background: rgba(244, 70, 17, 0.08);
}

h1,
h2,
h3,
h4 {
    font-weight: 500;
}

/* ----- Layout scaffold ----- */

.grid {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
}

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

.header {
    grid-column: 1 / -1;
    border-bottom: none;
    background: var(--paper);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    height: var(--header-h);
    padding: 0 20px;
    width: var(--sidebar-w);
    box-sizing: border-box;
    overflow: hidden;
    z-index: 2;
    background: var(--paper);
    border-right: 1px solid var(--ink);
}

.header-row {
    display: flex;
}

.mark {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.02em;
    line-height: 1;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
}

/* 01 · NESTED */
.mark-nested {
    padding: 0;
    max-width: 100%;
}
.mark-nested .nest {
    padding: 3px 5px;
    border: 1px solid var(--ink);
}
.mark-nested .n1 {
    border-color: var(--ink);
}
.mark-nested .n2 {
    border-color: var(--ink-2);
}
.mark-nested .n3 {
    border-color: var(--signal);
}
.mark-nested .wm {
    font-size: 12px;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

/* ----- Sidebar ----- */

.sidebar {
    border-right: 1px solid var(--ink);
    background: var(--paper);
    padding: 0;
    position: sticky;
    top: var(--header-h);
    align-self: start;
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
}

.sidebar-section {
    border-bottom: 1px solid var(--rule);
}
.sidebar-section:last-child {
    border-bottom: none;
}

.tree {
    padding: 14px 20px 14px;
    font-family: var(--mono);
    font-size: var(--fs-base);
}
.sidebar-nav {
    list-style: none;
}
.sidebar-nav li {
    border: none;
}
.sidebar-nav li a {
    display: block;
    padding: 2px 0;
    border: none;
    color: var(--ink-2);
    font-size: var(--fs-base);
    white-space: pre;
}
.sidebar-nav li a:hover {
    background: none;
    color: var(--ink);
}
.sidebar-nav li.active a {
    background: none;
    color: var(--signal);
    font-weight: 700;
}
.sidebar-nav .branch {
    color: var(--ink-3);
}
.sidebar-nav li.active .branch {
    color: var(--signal);
}

/* ----- Main ----- */

.main {
    padding: 0;
    min-width: 0;
    min-height: calc(100vh - var(--header-h));
}

.section:not(:last-child) {
    border-bottom: 1px solid var(--ink);
}

.section-body {
    padding: 20px;
}

/* ----- Two-column layout ----- */

.two-col {
    margin-top: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}
.two-col .small {
    margin-bottom: 8px;
}

/* ----- Contact card grid ----- */

.card-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    border: 1px solid var(--rule);
}
.card-grid > .card {
    padding: 18px;
    border-right: 1px solid var(--rule);
}
.card-grid > .card:last-child {
    border-right: none;
}
.card .label {
    font-size: var(--fs-lg);
    letter-spacing: 0.02em;
    margin: 8px 0 6px;
}
.card .value {
    font-size: var(--fs-md);
}
.card .meta {
    margin-top: 10px;
    line-height: 1.6;
}
.card .key {
    font-family: var(--mono);
    font-size: var(--fs-sm);
    letter-spacing: 0.04em;
}

/* ----- Prose ----- */

.prose {
    max-width: 68ch;
    font-size: var(--fs-md);
    line-height: 1.6;
}
.prose p + p {
    margin-top: 1em;
}
.prose strong {
    font-weight: 700;
}

/* ----- Data tables ----- */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-base);
    font-family: var(--mono);
}
.table th,
.table td {
    border: 1px solid var(--rule);
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
}
.table th {
    background: var(--paper-2);
    font-weight: 500;
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-2);
}
.table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.table tr:hover td {
    background: rgba(244, 70, 17, 0.04);
}
.table td .sig {
    color: var(--signal);
}

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

.colophon {
    grid-column: 1 / -1;
    border-top: 1px solid var(--rule);
    background: var(--paper);
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
}
.colophon-left {
    grid-column: 2;
    padding: 6px 20px;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--rule);
    line-height: 1.3;
    text-align: center;
}
.colophon-right {
    padding: 14px 20px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    font-size: var(--fs-xs);
    color: var(--ink-2);
}
.colophon-right h4 {
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-3);
    font-weight: 500;
    margin-bottom: 6px;
}
.colophon-right a {
    color: var(--ink);
}

/* ----- Generic helpers ----- */

.sig {
    color: var(--signal);
}
.small {
    font-size: var(--fs-xs);
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ----- Service catalogue grid (SwissMicros-style) ----- */

.service-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: 680px;
}

.service-card {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 16px;
    align-items: center;
    border: 1px solid var(--rule);
    padding: 12px 16px;
    text-decoration: none;
    color: var(--ink);
    background: var(--paper);
    transition: background 80ms linear;
}
.service-card:hover {
    background: var(--paper-2);
}

.service-visual {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--rule);
    background: var(--paper);
    padding: 6px;
    box-sizing: border-box;
    margin-bottom: 0;
}
.sv-nest {
    border: 1px solid var(--ink);
    padding: 4px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sv-n1 {
    border-color: var(--ink);
}
.sv-n2 {
    border-color: var(--ink-2);
    padding: 3px 8px;
}
.sv-n3 {
    border-color: var(--signal);
    padding: 2px 6px;
}
.sv-tag {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
    letter-spacing: 0.08em;
    color: var(--ink);
}

.service-meta {
    display: grid;
    gap: 6px;
    align-content: start;
}
.service-title {
    font-family: var(--mono);
    font-weight: 700;
    font-size: var(--fs-lg);
    letter-spacing: 0.01em;
    line-height: 1.2;
    color: var(--ink);
}
.service-blurb {
    font-size: var(--fs-sm);
    color: var(--ink-2);
    line-height: 1.5;
}

/* ----- Responsive ----- */

@media (max-width: 900px) {
    :root {
        --header-h: 64px;
    }

    .grid {
        grid-template-columns: 1fr;
    }
    .header-row,
    .colophon {
        grid-template-columns: 1fr;
    }

    .brand {
        width: 100%;
        justify-content: center;
        border-right: none;
        border-bottom: 1px solid var(--ink);
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--ink);
    }

    .main {
        padding-top: 12px;
    }

    /* Compact horizontal nav on mobile */
    .tree {
        padding: 10px 16px;
    }
    .sidebar-nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px 18px;
    }
    .sidebar-nav li a {
        white-space: normal;
    }
    .sidebar-nav .branch {
        display: none;
    }

    .section-body {
        padding: 16px;
    }

    .two-col {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .card-grid {
        grid-template-columns: 1fr;
    }
    .card-grid > .card {
        border-right: none;
        border-bottom: 1px solid var(--rule);
    }
    .card-grid > .card:last-child {
        border-bottom: none;
    }

    .colophon-right {
        grid-template-columns: repeat(2, 1fr);
    }
    .colophon-left {
        grid-column: 1;
    }

    /* Tables: let cells wrap instead of overflowing the viewport */
    .table {
        table-layout: fixed;
        width: 100%;
    }
    .table th,
    .table td {
        word-wrap: break-word;
        overflow-wrap: anywhere;
    }
    /* Override inline column widths set in markup */
    .table th[style*="width"] {
        width: auto !important;
    }
}

@media (max-width: 600px) {
    :root {
        --fs-display: 36px;
        --fs-xl: 22px;
        --fs-lg: 16px;
    }

    .mark-nested .nest {
        padding: 2px 4px;
    }
    .mark-nested .wm {
        font-size: 11px;
    }

    .section-body {
        padding: 14px;
    }

    .service-card {
        grid-template-columns: 52px 1fr;
        gap: 12px;
        padding: 10px 12px;
    }
    .service-visual {
        height: 40px;
        padding: 3px;
    }
    .sv-nest {
        padding: 2px 5px;
    }
    .sv-nest.sv-n2 {
        padding: 1px 4px;
    }
    .sv-nest.sv-n3 {
        padding: 1px 3px;
    }
    .sv-tag {
        font-size: 10px;
        letter-spacing: 0.06em;
    }

    .table th,
    .table td {
        padding: 6px 8px;
        font-size: var(--fs-sm);
    }
    /* Override inline column widths set in markup */
    .table th[style*="width"] {
        width: auto !important;
    }

    .v-client-head {
        flex-wrap: wrap;
        gap: 4px 12px;
    }
}
