/* MM4I GmbH house style
   Palette: chosen paper neutral, cool ink, stamp-ink indigo accent.
   Tokens carry both themes; no colour is declared outside :root blocks. */

:root {
  --paper:        #F4F5F2;
  --paper-raised: #FBFBF9;
  --paper-sunk:   #EAECE8;
  --ink:          #14191B;
  --ink-soft:     #4E5856;
  --ink-faint:    #7C8683;
  --rule:         #D6DAD6;
  --rule-strong:  #B4BBB6;
  --accent:       #2B3391;
  --accent-soft:  #D5D9EE;
  --accent-ink:   #FFFFFF;
  --focus:        #2B3391;

  --f-display: "Newsreader", Georgia, "Times New Roman", serif;
  --f-body:    "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-mono:    "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --measure: 66ch;
  --gutter: 11rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:        #101416;
    --paper-raised: #171C1F;
    --paper-sunk:   #0A0D0F;
    --ink:          #E9ECE8;
    --ink-soft:     #A3ADA9;
    --ink-faint:    #78827F;
    --rule:         #2A3134;
    --rule-strong:  #3E4649;
    --accent:       #9AA4FF;
    --accent-soft:  #2A3160;
    --accent-ink:   #0B0F26;
    --focus:        #9AA4FF;
  }
}

:root[data-theme="dark"] {
  --paper:        #101416;
  --paper-raised: #171C1F;
  --paper-sunk:   #0A0D0F;
  --ink:          #E9ECE8;
  --ink-soft:     #A3ADA9;
  --ink-faint:    #78827F;
  --rule:         #2A3134;
  --rule-strong:  #3E4649;
  --accent:       #9AA4FF;
  --accent-soft:  #2A3160;
  --accent-ink:   #0B0F26;
  --focus:        #9AA4FF;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: var(--accent-ink); }

a { color: inherit; text-decoration-color: var(--rule-strong); text-underline-offset: 0.22em; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 1px; }

/* ── page frame ───────────────────────────────────────────── */

.doc {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4.5vw, 3.5rem);
}

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

@media (min-width: 64rem) {
  .band { grid-template-columns: var(--gutter) minmax(0, var(--measure)); gap: 0 3rem; }
}

.band > .flow { display: flex; flex-direction: column; gap: 1.15rem; }

/* ── margin gutter: real record identifiers, as on a specification ── */

.mark {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.5rem;
}

.mark .mark-key {
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.65rem;
}

.mark .mark-ref { font-variant-numeric: tabular-nums; word-break: break-word; }

@media (min-width: 64rem) {
  .mark { position: sticky; top: 2.5rem; text-align: right; align-items: flex-end; }
}

/* ── typography ───────────────────────────────────────────── */

.eyebrow {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0;
}

h1, h2, h3, h4 { text-wrap: balance; margin: 0; }

h1 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(2.15rem, 5.2vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.018em;
}

h2 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  line-height: 1.14;
  letter-spacing: -0.012em;
}

h3 {
  font-family: var(--f-body);
  font-weight: 600;
  font-size: 1.0625rem;
  line-height: 1.35;
  letter-spacing: -0.005em;
}

p { margin: 0; }
.lede { font-size: 1.2rem; line-height: 1.55; color: var(--ink-soft); }
.muted { color: var(--ink-soft); }
strong { font-weight: 600; }
em.term { font-style: normal; font-weight: 600; color: var(--ink); }

/* ── section rule: label sits on the line, like a running head ── */

.sec { padding: clamp(3.5rem, 7vw, 6rem) 0 0; }

.sec-rule {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.sec-rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.sec-rule .eyebrow { color: var(--accent); white-space: nowrap; }

/* ── hero ─────────────────────────────────────────────────── */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 2rem 0 0;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1rem;
}

.wordmark {
  font-family: var(--f-body);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
}

.wordmark .four { color: var(--accent); font-weight: 600; }

nav.top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

nav.top a { text-decoration: none; color: var(--ink-soft); }
nav.top a:hover { color: var(--accent); }

.hero { padding: clamp(3rem, 8vw, 6.5rem) 0 0; }

/* The thesis runs the full frame width; the body below stays on the measure. */
.hero-thesis { margin-bottom: clamp(2.25rem, 4.5vw, 3.5rem); }

.hero-thesis .sentence { display: block; text-wrap: balance; }

.hero-body { max-width: 58ch; display: flex; flex-direction: column; gap: 1.15rem; }

.hero-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
  margin-top: 0.6rem;
  font-family: var(--f-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-jump a { text-decoration: none; color: var(--accent); border-bottom: 1px solid var(--accent-soft); padding-bottom: 2px; }
.hero-jump a:hover { border-bottom-color: var(--accent); }

/* Diagrams and card grids break out of the 66ch text measure. */
.wide { margin-top: clamp(2rem, 4vw, 3rem); }

/* ── three systems: separate entities, shown as such ───────── */

.systems {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

@media (min-width: 40rem) { .systems { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.system {
  background: var(--paper-raised);
  padding: 1.5rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.system-tag {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.system p:not(.system-tag):not(.system-link) { font-size: 1rem; color: var(--ink-soft); }

.system-link {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: auto;
}

.system-link a { color: var(--accent); text-decoration: none; }
.system-link a:hover { text-decoration: underline; }

/* -- three roads joining, then rising as one stack ---------- */

.roads { overflow-x: auto; padding-bottom: 0.5rem; }

.roads svg { display: block; min-width: 980px; width: 100%; height: auto; }

.rd-road  { fill: none; stroke: var(--rule-strong); stroke-width: 1.5; }
.rd-spine { fill: none; stroke: var(--accent); stroke-width: 1.75; }
.rd-arrow { fill: none; stroke: var(--accent); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.rd-node  { fill: var(--paper); stroke: var(--accent); stroke-width: 1.75; }
.rd-dot   { fill: var(--paper); stroke: var(--rule-strong); stroke-width: 1.25; }

.rd-band-apex { fill: var(--accent); stroke: var(--accent); }

.rd-title-apex { font-family: var(--f-body); font-weight: 600; font-size: 15px; letter-spacing: 0.9px; fill: var(--accent-ink); }
.rd-gate { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.rd-gate-label { font-family: var(--f-mono); font-size: 12.5px; letter-spacing: 1.2px; fill: var(--accent); }
.rd-step { font-family: var(--f-body); font-size: 13px; fill: var(--ink-soft); }
.rd-name { font-family: var(--f-mono); font-size: 13px; letter-spacing: 1.3px; fill: var(--accent); }

.figure-note {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  line-height: 1.6;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  margin-top: 1.1rem;
  max-width: 44rem;
}



/* ── argument list: unnumbered, because these arguments are independent ── */

.args { display: flex; flex-direction: column; gap: 1.9rem; margin: 0; padding: 0; }
.arg { display: flex; flex-direction: column; gap: 0.45rem; }

.arg-key {
  font-family: var(--f-body);
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--ink);
}

.arg-key::before {
  content: "\00B7";
  color: var(--accent);
  margin-right: 0.5rem;
}

/* ── register entries ─────────────────────────────────────── */

.register { display: flex; flex-direction: column; gap: 0; }

.entry {
  display: grid;
  gap: 0.55rem;
  padding: 1.6rem 0;
  border-top: 1px solid var(--rule);
}

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

.entry-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1rem; justify-content: space-between; }

.entry-status {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
}

.refs {
  font-family: var(--f-mono);
  font-size: 0.74rem;
  line-height: 1.7;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  margin: 0.2rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.refs li { display: flex; gap: 0.75rem; }
.refs .r-k { color: var(--ink-faint); min-width: 8.5rem; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.66rem; padding-top: 0.15rem; }
.refs .r-v { word-break: break-word; }

/* ── structure panel ──────────────────────────────────────── */

.structure {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.tier { display: flex; flex-direction: column; gap: 0.35rem; }
.tier-name { font-family: var(--f-body); font-weight: 600; font-size: 1rem; }
.tier-role { font-size: 0.95rem; color: var(--ink-soft); }

.tier-link {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── contact ──────────────────────────────────────────────── */

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

@media (min-width: 42rem) { .contact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.contact-block { display: flex; flex-direction: column; gap: 0.3rem; }
.contact-block .eyebrow { margin-bottom: 0.45rem; }
.contact-block address { font-style: normal; line-height: 1.7; }

/* ── footer ───────────────────────────────────────────────── */

footer.foot {
  margin-top: clamp(4rem, 8vw, 7rem);
  border-top: 1px solid var(--rule);
  padding: 1.5rem 0 3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 2rem;
  justify-content: space-between;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

footer.foot nav { display: flex; flex-wrap: wrap; gap: 0.6rem 1.5rem; }
footer.foot a { text-decoration: none; }
footer.foot a:hover { color: var(--accent); }

/* ── legal pages ──────────────────────────────────────────── */

.legal { display: flex; flex-direction: column; gap: 2.25rem; padding-top: clamp(2.5rem, 6vw, 4rem); }
.legal section { display: flex; flex-direction: column; gap: 0.7rem; max-width: var(--measure); }
.legal h2 { font-size: clamp(1.35rem, 2.4vw, 1.75rem); }
.legal address { font-style: normal; line-height: 1.75; }

.todo {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 0.55rem 0.85rem;
  font-family: var(--f-mono);
  font-size: 0.74rem;
  line-height: 1.6;
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
