/* The Perimeter — shared styles (site/index.html, site/de/index.html) */

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

:root {
  --bg:      #0a0b0a;
  --panel:   #101210;
  --line:    #1e211e;
  --fg:      #d5d8d3;
  --dim:     #6d746c;
  --faint:   #454b45;
  --allow:   #4ade80;
  --hold:    #e3b341;
  --deny:    #f2695c;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:    #fbfbf9;
    --panel: #f3f3ef;
    --line:  #e0e0d8;
    --fg:    #1c1e1c;
    --dim:   #6b706a;
    --faint: #a9aea7;
    --allow: #10893e;
    --hold:  #9a6b00;
    --deny:  #c0392b;
  }
}
:root[data-theme="light"] {
  --bg:#fbfbf9; --panel:#f3f3ef; --line:#e0e0d8; --fg:#1c1e1c;
  --dim:#6b706a; --faint:#a9aea7; --allow:#10893e; --hold:#9a6b00; --deny:#c0392b;
}
:root[data-theme="dark"] {
  --bg:#0a0b0a; --panel:#101210; --line:#1e211e; --fg:#d5d8d3;
  --dim:#6d746c; --faint:#454b45; --allow:#4ade80; --hold:#e3b341; --deny:#f2695c;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.65;
  font-variant-ligatures: none;
  -webkit-font-smoothing: antialiased;
}

/* Centred text column. The paper apparatus (numbered sections, abstract,
   captioned figures) stays; only the column's position changed. */
main {
  max-width: 88ch;
  margin: 0 auto;
  padding: 3.5rem 5vw 8rem;
}

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

.dim   { color: var(--dim); }
.faint { color: var(--faint); }
.allow { color: var(--allow); }
.hold  { color: var(--hold); }
.deny  { color: var(--deny); }

a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--faint);
}
a:hover { color: var(--allow); border-bottom-color: var(--allow); }

hr {
  border: 0;
  border-top: 1px dashed var(--line);
  margin: 3.2rem 0;
}

p { margin: 0 0 1rem; max-width: 68ch; }
p:last-child { margin-bottom: 0; }

/* ---------- header ---------- */

header { margin-bottom: 3.2rem; }

.prompt {
  color: var(--dim);
  font-size: 12.5px;
  margin-bottom: 2.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0 .55ch;
}
.prompt b { color: var(--allow); font-weight: 400; }

/* language switcher, right-aligned on the prompt row */
.lang { margin-left: auto; display: flex; gap: 0 .8ch; }
.lang a { border-bottom-color: transparent; }
.lang a:hover { border-bottom-color: var(--allow); }
.lang [aria-current="page"] { color: var(--fg); }

.cursor {
  display: inline-block;
  width: 1ch;
  background: var(--allow);
  animation: blink 1.15s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

/* ---------- title block: title left, document metadata right ---------- */

.titleblock {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.2rem 3ch;
  align-items: start;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .28em;
  text-transform: uppercase;
  margin: 0 0 .9rem;
}

.tagline { font-size: 15px; margin-bottom: .3rem; }

.meta {
  font-size: 12.5px;
  color: var(--dim);
  text-align: right;
  white-space: nowrap;
}
.meta div + div { margin-top: .15rem; }

@media (max-width: 620px) {
  .titleblock { grid-template-columns: 1fr; }
  .meta { text-align: left; white-space: normal; }
}

/* ---------- abstract: flush heading, indented body (RFC habit) ---------- */

.abstract { margin: 2.6rem 0 0; padding-left: 0; }
.abstract h2 { text-indent: 0; }
.abstract > *:not(h2) { padding-left: 3ch; max-width: 74ch; }

.keywords {
  margin-top: 1rem;
  font-size: 12.5px;
  color: var(--dim);
}

/* ---------- numbered sections: numbers hang in the left margin ---------- */

section { margin: 0; padding-left: 4.5ch; }

h2 {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: .06em;
  margin: 0 0 1.3rem;
  text-indent: -4.5ch;
}
h2 .n {
  display: inline-block;
  width: 4.5ch;
  font-weight: 400;
  color: var(--dim);
  text-indent: 0;
}

@media (max-width: 560px) {
  section { padding-left: 3ch; }
  h2 { text-indent: -3ch; }
  h2 .n { width: 3ch; }
}

/* ---------- figures ---------- */

figure { margin: 1.6rem 0; }
figcaption {
  margin-top: .6rem;
  font-size: 12px;
  color: var(--dim);
  max-width: 72ch;
}
figcaption b { font-weight: 400; color: var(--fg); }

/* ---------- code / diagram blocks ---------- */

/* Figure panels size to their art, not to the text column — but never wider
   than the space available, in which case they scroll inside themselves. */
.block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1.1rem 1.2rem;
  margin: 1.6rem 0;
  overflow-x: auto;
  width: max-content;
  max-width: 100%;
}
.block pre {
  margin: 0;
  font: inherit;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
}
.block.tight pre { line-height: 1.5; }
figure .block { margin: 0; }
/* box-drawing glyphs only join into continuous strokes near line-height 1 */
.block.diagram pre { line-height: 1.15; }

/* ---------- key/value rows ---------- */

dl {
  margin: 0;
  display: grid;
  grid-template-columns: 15ch 1fr;
  gap: .55rem 2ch;
}
dl dt { color: var(--dim); }
dl dd { margin: 0; }

@media (max-width: 560px) {
  dl { grid-template-columns: 1fr; gap: .1rem; }
  dl dd { margin-bottom: .8rem; }
}

ul { margin: 0; padding-left: 2.2ch; list-style: none; }
li { margin-bottom: .5rem; position: relative; }
li::before {
  content: "—";
  position: absolute;
  left: -2.2ch;
  color: var(--faint);
}

/* ---------- status ---------- */

.led {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--allow);
  margin-right: .8ch;
  vertical-align: middle;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .led { animation: none; } }

footer {
  margin-top: 4.5rem;
  padding-top: 1.4rem;
  border-top: 1px dashed var(--line);
  color: var(--dim);
  font-size: 12.5px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .6rem 2ch;
}
