/* =============================================================
   CAH Transformation Engine — minimalist stylesheet
   White background, black IBM Plex type.
   No color accents. Emphasis via weight, spacing, and rules.
   ============================================================= */

:root {
    --bg: #ffffff;
    --fg: #000000;
    --muted: #6b6b6b;
    --border: #e5e5e5;
    --rule: #000000;
    --hover: #f5f5f5;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--fg);
    font-size: 15px;
    line-height: 1.55;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.mono {
    font-family: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

a { color: var(--fg); text-decoration: underline; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

/* ---------- Layout primitives ---------- */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px;
}

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

.site-header {
    border-bottom: 1px solid var(--rule);
    padding: 28px 0 20px;
}

.header-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.brand-name {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.brand-sub {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

.brand-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.meta-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--muted);
}

.meta-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    font-weight: 500;
}

/* ---------- Tabs ---------- */

.tabs-nav {
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.tabs-row {
    display: flex;
    gap: 32px;
}

.tab {
    appearance: none;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    padding: 16px 0;
    margin-bottom: -1px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0;
    cursor: pointer;
    transition: color 120ms ease;
}

.tab:hover { color: var(--fg); }

.tab.active {
    color: var(--fg);
    border-bottom-color: var(--fg);
    font-weight: 600;
}

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

.main {
    padding: 48px 32px 80px;
}

.tab-panel[hidden] { display: none; }

.panel-title {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.15;
    margin-bottom: 16px;
}

.lede {
    font-size: 17px;
    line-height: 1.55;
    max-width: 820px;
    color: var(--fg);
    margin-bottom: 48px;
}

.section-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 40px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.section-title:first-of-type { margin-top: 0; }

.prose {
    max-width: 820px;
    margin-bottom: 16px;
}

.prose-note {
    font-size: 12px;
    color: var(--muted);
    margin-top: 8px;
}

.link-row { margin-top: 48px; }

.deep-link {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    text-decoration: none;
    border-bottom: 1px solid var(--fg);
    padding-bottom: 2px;
}

.deep-link:hover { border-bottom-width: 2px; }

/* ---------- Grid cells ---------- */

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 8px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.cell {
    border: 1px solid var(--border);
    padding: 20px;
    background: var(--bg);
}

.cell.emphatic {
    border-color: var(--fg);
    background: var(--fg);
    color: var(--bg);
}

.cell.emphatic .cell-label,
.cell.emphatic .cell-note { color: var(--bg); opacity: 0.85; }

.cell-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.cell-value {
    font-size: 34px;
    font-weight: 500;
    line-height: 1.1;
    margin: 10px 0 6px;
    letter-spacing: -0.01em;
}

.cell-note {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.45;
}

.cell-desc {
    font-size: 13px;
    color: var(--fg);
    margin-top: 10px;
    line-height: 1.45;
}

/* ---------- Code blocks ---------- */

.code-block {
    border: 1px solid var(--border);
    background: var(--bg);
    padding: 18px 20px;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre;
    overflow-x: auto;
    margin-bottom: 8px;
}

/* ---------- Tables ---------- */

.kv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    border-top: 1px solid var(--fg);
    border-bottom: 1px solid var(--fg);
}

.kv-table th {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.kv-table th.num { text-align: right; }

.kv-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    color: var(--fg);
}

.kv-table tbody tr:last-child td { border-bottom: none; }
.kv-table tbody tr:hover { background: var(--hover); }

.kv-table td.num { text-align: right; }
.kv-table.wide td { font-size: 13px; line-height: 1.5; }

/* ---------- Bullet list ---------- */

.bullet-list {
    list-style: none;
    padding: 0;
    border-top: 1px solid var(--border);
}

.bullet-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    line-height: 1.55;
}

/* ---------- Quick wins block ---------- */

.quickwins-block {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 24px;
    border: 1px solid var(--border);
    padding: 20px;
    align-items: flex-start;
}

.qw-count {
    font-size: 56px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.02em;
}

.qw-body p { margin-bottom: 8px; }
.qw-body p:last-child { margin-bottom: 0; }

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

.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    margin-top: 64px;
    background: var(--bg);
}

.footer-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}

.footer-block {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    font-size: 11px;
    color: var(--muted);
}

.footer-block .mono { font-size: 11px; }
.footer-block.right { justify-content: flex-end; }

.footer-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

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

@media (max-width: 900px) {
    .container { padding: 0 20px; }
    .header-row { flex-direction: column; align-items: flex-start; }
    .tabs-row { gap: 20px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .grid-4, .grid-3 { grid-template-columns: 1fr 1fr; }
    .panel-title { font-size: 26px; }
    .lede { font-size: 15px; margin-bottom: 32px; }
    .cell-value { font-size: 28px; }
    .quickwins-block { grid-template-columns: 1fr; gap: 12px; }
    .qw-count { font-size: 42px; }
    .kv-table { font-size: 13px; }
    .kv-table th, .kv-table td { padding: 8px 10px; }
}

@media (max-width: 560px) {
    .grid-4, .grid-3 { grid-template-columns: 1fr; }
}
