/* MKA Plus site styles.
   Layout: systems view — diagrams, to-scale charts and hairline tables carry the story.
   Palette: deep green accent on cool grey-green neutrals; highlighter yellow marks citations. */

:root {
  --bg: #F5F7F6;
  --surface: #FFFFFF;
  --ink: #16201D;
  --muted: #56635E;
  --line: #D9E0DC;
  --grid: #E9EEEB;
  --band: #E9EEEB;
  --accent: #0D6352;
  --accent-soft: #E3EFEB;
  --on-accent: #FFFFFF;
  --mark: #EFE3A0;
  --mark-ink: #3A3410;
  --bar: #56635E;

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --max: 1160px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1412; --surface: #161D1A; --ink: #E4EBE7; --muted: #97A59F; --line: #28332F;
    --grid: #141B18; --band: #141B18; --accent: #55C2A6; --accent-soft: #15302A; --on-accent: #0B1411;
    --mark: #4A4318; --mark-ink: #F3E9B8; --bar: #6E7B76;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1412; --surface: #161D1A; --ink: #E4EBE7; --muted: #97A59F; --line: #28332F;
  --grid: #141B18; --band: #141B18; --accent: #55C2A6; --accent-soft: #15302A; --on-accent: #0B1411;
  --mark: #4A4318; --mark-ink: #F3E9B8; --bar: #6E7B76;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: inherit; }
a:focus-visible, .btn:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px;
}
.wrap { max-width: var(--max); margin: 0 auto; padding-inline: 24px; }
@media (max-width: 480px) { .wrap { padding-inline: 16px; } }

h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); line-height: .98; font-weight: 800; font-stretch: 112%; letter-spacing: -.02em; max-width: 14em; }
h1.sm { font-size: clamp(2.1rem, 4.6vw, 3.4rem); line-height: 1.02; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.5rem); line-height: 1.08; font-weight: 700; font-stretch: 108%; letter-spacing: -.01em; }
h3 { font-size: 1.08rem; font-weight: 700; font-stretch: 104%; line-height: 1.3; }
p { margin: 0; }
.tag { font-family: var(--mono); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.lede { font-size: 1.15rem; max-width: 40em; color: var(--muted); }
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.stack-lg { display: grid; gap: 24px; align-content: start; min-width: 0; }
.narrow { max-width: 820px; }
.cite { font-family: var(--mono); font-size: .8em; background: var(--mark); color: var(--mark-ink); padding: .05em .4em; border-radius: 3px; white-space: nowrap; }
code { font-family: var(--mono); font-size: .9em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .8em 1.3em; border-radius: 8px; font: 600 .95rem/1.2 var(--body);
  text-decoration: none; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
@media (prefers-reduced-motion: no-preference) {
  .btn { transition: transform .15s; }
  .btn:hover { transform: translateY(-1px); }
}

/* ---------- header ---------- */
.site-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 14px; }
.logo { font-family: var(--display); font-weight: 800; font-stretch: 115%; font-size: 1.2rem; text-decoration: none; letter-spacing: -.01em; white-space: nowrap; }
.logo span { color: var(--accent); }
.logo { display: inline-flex; align-items: center; line-height: 0; }
.logo img { display: block; height: 28px; width: auto; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo img { filter: invert(1) hue-rotate(180deg); } }
:root[data-theme="dark"] .logo img { filter: invert(1) hue-rotate(180deg); }
.nav-links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; font-size: .95rem; }
.nav-links a { display: block; text-decoration: none; padding: .4em .8em; border-radius: 6px; color: var(--muted); }
.nav-links a:hover { background: var(--grid); color: var(--ink); }
.nav-links a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.nav-right { display: flex; align-items: center; gap: 10px; }
.menu { display: none; position: relative; }
.menu summary { list-style: none; cursor: pointer; padding: .55em .8em; border: 1.5px solid var(--line); border-radius: 8px; font-weight: 600; font-size: .9rem; }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] .nav-links {
  display: grid; position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px;
  box-shadow: 0 18px 40px -24px rgba(0,0,0,.4);
}
.desktop-nav { display: block; }
@media (max-width: 900px) {
  .desktop-nav { display: none; }
  .menu { display: block; }
  .menu .nav-links { display: none; }
}
@media (max-width: 420px) { .nav-right .btn.primary { padding: .65em .9em; font-size: .85rem; } }

/* ---------- sections ---------- */
section { padding-block: 96px; }
section.tight { padding-top: 0; }
@media (max-width: 640px) { section { padding-block: 60px; } }
.surface { background: var(--surface); border-block: 1px solid var(--line); }
.band { background: var(--band); border-block: 1px solid var(--line); }
.gridbg {
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
}
.split { display: grid; grid-template-columns: .8fr 1.2fr; gap: 56px; align-items: start; }
.split.even { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .split, .split.even { grid-template-columns: 1fr; gap: 32px; } }

/* page hero (inner pages) */
.page-hero { padding-block: 72px 64px; border-bottom: 1px solid var(--line); }
.page-hero .stack-lg { max-width: 860px; }
.crumb { font-family: var(--mono); font-size: .75rem; color: var(--muted); text-decoration: none; }
.crumb:hover { color: var(--accent); }
.status { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: .25em .8em; width: fit-content; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* ---------- home hero + flow diagram ---------- */
.hero { padding-block: 64px 80px; }
.hero .top { display: grid; gap: 22px; }
.hero .stat { font-family: var(--mono); font-size: .88rem; max-width: 52em; }
.hero .stat b { color: var(--accent); font-weight: 500; }
.hero .stat a { color: var(--accent); }

.flow-row { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: stretch; margin-top: 48px; }
.node { background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 20px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.node.ai { border-color: var(--ink); }
.node.worker { border-color: var(--accent); background: var(--accent-soft); }
.node.docs { border-style: dashed; }
.node ul { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: .92rem; }
.node li::before { content: "› "; color: var(--muted); }
.node .who { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.node.worker .who { color: var(--accent); }
.link { display: grid; align-content: center; gap: 10px; padding: 0 14px; width: 150px; min-width: 0; }
.arrow { font-family: var(--mono); font-size: .74rem; color: var(--muted); display: grid; gap: 4px; }
.arrow i { display: block; height: 1.5px; background: var(--ink); position: relative; }
.arrow i::after { content: ""; position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left: 7px solid var(--ink); border-right: 0; }
.arrow.back { color: var(--accent); }
.arrow.back i { background: var(--accent); }
.arrow.back i::after { right: auto; left: -1px; border-left: 0; border-right: 7px solid var(--accent); }
@media (max-width: 900px) {
  .flow-row { grid-template-columns: 1fr; }
  .link { width: auto; padding: 14px 0 14px 24px; border-left: 1.5px dashed var(--line); margin-left: 24px; }
}

/* ---------- benchmark bars ---------- */
.bars { display: grid; gap: 30px; min-width: 0; }
.metric { display: grid; gap: 10px; }
.metric-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.delta { font-family: var(--display); font-weight: 800; font-stretch: 110%; font-size: 2rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.row { display: grid; grid-template-columns: 120px 1fr 92px; gap: 12px; align-items: center; font-size: .88rem; }
.row .lab { color: var(--muted); }
.row .val { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.track { height: 14px; background: var(--grid); border-radius: 3px; overflow: hidden; }
.fill { height: 100%; background: var(--bar); border-radius: 3px; min-width: 3px; }
.fill.lw { background: var(--accent); }
.quality { border-top: 1px solid var(--line); padding-top: 20px; display: grid; gap: 6px; }
.quality .big { font-family: var(--display); font-weight: 800; font-stretch: 110%; font-size: 1.5rem; }
.fn { font-size: .82rem; color: var(--muted); }
.fn a { color: var(--accent); }
@media (max-width: 480px) { .row { grid-template-columns: 88px 1fr 72px; font-size: .8rem; } }
@media (prefers-reduced-motion: no-preference) {
  .fill { transform-origin: left; animation: grow .9s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes grow { from { transform: scaleX(.001); } to { transform: scaleX(1); } }
}

/* ---------- steps, pillars, rows ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 40px; }
.step { border-top: 3px solid var(--ink); padding-top: 16px; display: grid; gap: 8px; align-content: start; }
.step .k { font-family: var(--display); font-weight: 800; font-size: 2.4rem; line-height: 1; color: var(--accent); font-stretch: 110%; }
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; } }

.pillars { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 40px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--line); gap: 1px; }
.pillars.two { grid-template-columns: repeat(2, 1fr); }
.pillar { background: var(--surface); padding: 24px; display: grid; gap: 8px; align-content: start; }
.pillar p, .pillar li { color: var(--muted); font-size: .95rem; }
.pillar ul { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; }
@media (max-width: 860px) { .pillars { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .pillars, .pillars.two { grid-template-columns: 1fr; } }

.rows { margin-top: 36px; display: grid; border-top: 1px solid var(--line); }
.rows > div { display: grid; grid-template-columns: 240px 1fr; gap: 24px; padding-block: 18px; border-bottom: 1px solid var(--line); }
.rows p { color: var(--muted); }
.rows .note { font-family: var(--mono); font-size: .75rem; color: var(--accent); margin-left: .4em; text-transform: uppercase; letter-spacing: .05em; }
@media (max-width: 640px) { .rows > div { grid-template-columns: 1fr; gap: 4px; } }

/* question table (Marshal) */
.qs { display: grid; background: var(--surface); border: 1.5px solid var(--accent); border-radius: 10px; overflow: hidden; min-width: 0; }
.q { display: grid; grid-template-columns: 130px 1fr; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); font-size: .93rem; }
.q:last-child { border-bottom: 0; }
.q b { font-family: var(--mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); font-weight: 500; padding-top: 2px; }
@media (max-width: 480px) { .q { grid-template-columns: 1fr; gap: 4px; } }

/* approval chain */
.chain { margin: 0; padding: 0; list-style: none; font-size: .92rem; }
.chain li { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.chain .dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent); justify-self: center; }
.chain li:last-child .dot { background: var(--accent); }
.chain .ok { font-family: var(--mono); font-size: .75rem; color: var(--accent); }
.chain li.deny .dot { border-color: var(--muted); border-style: dashed; background: transparent; }
.chain li.deny .ok { color: var(--muted); }

/* worker report sample */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 26px; font-size: .92rem; min-width: 0; box-shadow: 0 18px 40px -30px rgba(0,0,0,.35); }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 14px; }
.sheet-head span { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.sheet h4 { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin: 16px 0 8px; }
.sheet h4:first-of-type { margin-top: 0; }
.sheet ol { margin: 0; padding-left: 1.3em; display: grid; gap: 10px; }
.sheet blockquote { margin: 0; padding-left: 12px; border-left: 2px solid var(--line); color: var(--muted); }
.sheet .nf { color: var(--muted); }

/* data table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 560px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 500; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.num { font-family: var(--mono); font-size: .88rem; }
tr:last-child td { border-bottom: 0; }
td strong { color: var(--accent); }

/* prose */
.prose { max-width: 720px; display: grid; gap: 16px; }
.prose h2 { font-size: 1.5rem; margin-top: 24px; }
.prose ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.prose li { color: var(--muted); }
.prose p { color: var(--muted); }
.prose strong { color: var(--ink); }
/* blog post: hero and body share one centered reading column */
.post-col, .page-hero .post-col { max-width: 70ch; margin-inline: auto; }
.post-fig { margin: 12px 0; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 18px; min-width: 0; }
.post-fig .fn { margin: 0; }
.track.stacked { display: flex; }
.fill.seg { border-radius: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .82rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--bar); margin-right: 6px; }
.legend i.lw { background: var(--accent); }
.modes { display: grid; gap: 22px; }
.mode { display: grid; gap: 10px; }
.mode-flow { display: flex; align-items: stretch; }
.mode-flow .node { flex: 1 1 0; padding: 14px; gap: 4px; }
.mode-flow .node h3 { font-size: .92rem; }
.mode-flow .to { align-self: center; padding: 0 8px; color: var(--muted); font-family: var(--mono); }
@media (max-width: 640px) {
  .post-fig { padding: 18px; }
  .mode-flow { flex-direction: column; }
  .mode-flow .to { align-self: flex-start; padding: 2px 0 2px 16px; transform: rotate(90deg); transform-origin: 22px center; }
}

.note-box { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 14px 18px; border-radius: 0 8px 8px 0; font-size: .95rem; }

/* forms */
.form { display: grid; gap: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; min-width: 0; }
.field { display: grid; gap: 6px; }
.field label, .field legend { font-weight: 600; font-size: .92rem; }
.field .hint { font-size: .82rem; color: var(--muted); }
.field input, .field select, .field textarea {
  font: inherit; font-size: 1rem; color: var(--ink); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: 8px; padding: .7em .8em; width: 100%;
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
fieldset.field { border: 0; padding: 0; margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checks label { font-weight: 400; display: inline-flex; gap: 8px; align-items: center; }
.checks input { width: auto; accent-color: var(--accent); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 560px) { .two-col { grid-template-columns: 1fr; } .form { padding: 20px; } }
.form-result { font-size: .9rem; color: var(--accent); }

/* contact card */
.contact-card { display: grid; gap: 14px; }
.contact-card dt { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.contact-card dd { margin: 0 0 6px; }

/* ---------- footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); color: var(--muted); padding-block: 48px; font-size: .9rem; }
.site-footer .wrap { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--ink); }
.site-footer .logo { color: var(--ink); }
.site-footer .legal { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 20px; font-size: .82rem; }
@media (max-width: 760px) { .site-footer .wrap { grid-template-columns: 1fr; } }
