/* Classes — Swiss editorial-technical. Black, greys, one accent for attention only. */

@font-face {
  font-family: 'Geist';
  src: url('fonts/Geist-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist';
  src: url('fonts/Geist-Medium.woff2') format('woff2');
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('fonts/GeistMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('fonts/GeistMono-Medium.woff2') format('woff2');
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('fonts/GeistMono-Italic.woff2') format('woff2');
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #fff;
  --fg: #000;
  --grey-1: #f5f5f5;
  --grey-2: #e5e5e5;
  --grey-3: #a3a3a3;
  --grey-4: #737373;
  --grey-5: #404040;
  --accent: #FF4F00;
  --rule: 1px solid var(--grey-2);
  --rule-strong: 1px solid var(--fg);
  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --gutter: 24px;
  --pad: 32px;
  --editor-font: 14px;
  --editor-lh: 21px;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, select, textarea { font: inherit; color: inherit; }

code, pre, kbd { font-family: var(--mono); }

:focus-visible { outline: 1px solid var(--fg); outline-offset: 2px; }

/* ---------- 12-column grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* ---------- masthead ---------- */
.masthead {
  align-items: end;
  padding-top: 28px;
  padding-bottom: 20px;
  border-bottom: var(--rule-strong);
}
.brand { grid-column: 1 / span 5; }
.brand h1 {
  margin: 0;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.03em;
}
.tagline {
  margin: 8px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--grey-4);
}
.counts {
  grid-column: 6 / span 7;
  display: flex;
  justify-content: flex-end;
  margin: 0;
}
.counts > div {
  min-width: 120px;
  padding: 0 0 0 16px;
  border-left: var(--rule);
}
.counts > div + div { margin-left: 16px; }
.counts dt {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--grey-4);
}
.counts dd {
  margin: 4px 0 0;
  font-family: var(--mono);
  font-size: 48px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.count-issues.has-issues dd,
.count-issues.has-issues dt { color: var(--accent); }

/* ---------- toolbar ---------- */
.toolbar {
  align-items: center;
  padding-top: 12px;
  padding-bottom: 12px;
  border-bottom: var(--rule);
}
.toolbar .field { grid-column: 1 / span 6; display: flex; align-items: center; gap: 12px; }
.toolbar .actions { grid-column: 7 / span 6; display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.label, .section-label, .tab, .btn, .hint, select {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.label { text-transform: uppercase; color: var(--grey-4); }

select {
  appearance: none;
  -webkit-appearance: none;
  border: var(--rule-strong);
  border-radius: 0;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23000'/%3E%3C/svg%3E") no-repeat right 10px center;
  padding: 7px 30px 7px 10px;
  min-width: 200px;
  font-size: 13px;
}

.btn {
  appearance: none;
  border: var(--rule-strong);
  border-radius: 0;
  background: var(--bg);
  padding: 7px 12px;
  cursor: pointer;
  text-transform: uppercase;
  line-height: 1.2;
}
.btn:hover { background: var(--fg); color: var(--bg); }
.btn.small { padding: 4px 9px; }
.btn.done { background: var(--fg); color: var(--bg); }

/* ---------- workspace ---------- */
.workspace { padding-top: 0; padding-bottom: 24px; row-gap: 0; }
.col-left { grid-column: 1 / span 4; min-width: 0; border-right: var(--rule); padding-right: var(--gutter); }
.col-right { grid-column: 5 / span 8; min-width: 0; }

.panel { padding: 20px 0 24px; border-bottom: var(--rule); min-width: 0; }
.panel:last-child { border-bottom: 0; }

.section-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.section-label .idx { color: var(--grey-3); }
.section-label .aside { margin-left: auto; font-weight: 400; color: var(--grey-4); text-transform: none; letter-spacing: 0.02em; }
.section-label .status:not(:empty) { color: var(--accent); }

.hint { color: var(--grey-4); margin: 8px 0 0; font-size: 11px; }
.hint.inline { margin: 0 0 0 8px; }

/* ---------- editor ---------- */
.editor {
  display: flex;
  border: var(--rule-strong);
  height: 52vh;
  min-height: 320px;
  overflow: hidden;
  background: var(--bg);
}
.gutter {
  flex: 0 0 auto;
  min-width: 44px;
  padding: 10px 8px 10px 0;
  overflow: hidden;
  border-right: var(--rule);
  background: var(--grey-1);
  color: var(--grey-3);
  font-family: var(--mono);
  font-size: var(--editor-font);
  line-height: var(--editor-lh);
  text-align: right;
  user-select: none;
  white-space: pre;
}
.gutter span { display: block; padding-left: 8px; border-left: 2px solid transparent; }
.gutter span.err { color: var(--accent); border-left-color: var(--accent); }
.editor-main { position: relative; flex: 1 1 auto; min-width: 0; }
.line-mark {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--editor-lh);
  background: rgba(255, 79, 0, 0.09);
  border-left: 2px solid var(--accent);
  pointer-events: none;
}
textarea#source {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  outline: none;
  resize: none;
  background: transparent;
  font-family: var(--mono);
  font-size: var(--editor-font);
  line-height: var(--editor-lh);
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  color: var(--fg);
  caret-color: var(--fg);
}
.editor:focus-within { outline: 1px solid var(--fg); outline-offset: 2px; }

/* ---------- syntax help ---------- */
.syntax { margin-top: 16px; border-top: var(--rule); }
.syntax summary {
  cursor: pointer;
  padding: 10px 0;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  list-style: none;
}
.syntax summary::-webkit-details-marker { display: none; }
.syntax summary::before { content: '+'; display: inline-block; width: 16px; }
.syntax[open] summary::before { content: '\2212'; }
.syntax-body { font-size: 13px; }
.syntax-body pre {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: var(--grey-1);
  border: var(--rule);
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
}
.syntax-body p { color: var(--grey-5); margin: 10px 0 0; }
.syntax-body code { font-size: 12px; }
.ref { width: 100%; border-collapse: collapse; font-size: 12px; }
.ref th, .ref td { text-align: left; vertical-align: top; padding: 5px 0; border-top: var(--rule); }
.ref th { font-family: var(--mono); font-weight: 400; white-space: nowrap; padding-right: 12px; width: 1%; }
.ref td { color: var(--grey-5); }

/* ---------- checks ---------- */
.checks { list-style: none; margin: 0; padding: 0; border-top: var(--rule-strong); }
.checks li { border-bottom: var(--rule); }
.checks button {
  display: grid;
  grid-template-columns: 52px 44px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  width: 100%;
  padding: 9px 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
}
.checks button:hover, .checks button.active { background: var(--grey-1); }
.checks .sev, .checks .ln { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.checks .sev { color: var(--accent); padding-left: 4px; }
.checks .sev.warning { color: var(--accent); opacity: 0.8; }
.checks .ln { color: var(--grey-4); }
.checks .msg { overflow-wrap: anywhere; }
.checks .ok { padding: 10px 0; font-family: var(--mono); font-size: 12px; color: var(--grey-4); }

/* ---------- diagram ---------- */
.diagram-tools { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.diagram {
  position: relative;
  height: 62vh;
  min-height: 360px;
  border: var(--rule-strong);
  overflow: hidden;
  background: var(--bg);
  cursor: grab;
  touch-action: pan-x pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.diagram.dragging { cursor: grabbing; }
.diagram svg { display: block; width: 100%; height: 100%; }
.diagram .node { cursor: pointer; }
.diagram.stale svg { opacity: 0.45; }
.diagram .empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--mono); font-size: 12px; color: var(--grey-4);
}

/* ---------- code ---------- */
.tabs { display: flex; align-items: stretch; border-bottom: var(--rule-strong); flex-wrap: wrap; }
.tab {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  padding: 8px 14px 8px 0;
  margin-right: 14px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--grey-4);
}
.tab[aria-selected='true'] { color: var(--fg); border-bottom-color: var(--fg); }
.tabs .copy { margin-left: auto; align-self: center; }
.code {
  margin: 0;
  padding: 14px 16px;
  max-height: 520px;
  overflow: auto;
  background: var(--grey-1);
  border: var(--rule);
  border-top: 0;
  font-size: 12.5px;
  line-height: 1.55;
  tab-size: 4;
  white-space: pre;
}

/* ---------- footer ---------- */
.footer { border-top: var(--rule-strong); padding-top: 14px; padding-bottom: 28px; }
.footer p { grid-column: 1 / -1; margin: 0; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--grey-4); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .col-left { grid-column: 1 / span 5; }
  .col-right { grid-column: 6 / span 7; }
  .counts dd { font-size: 40px; }
}

@media (max-width: 820px) {
  :root { --pad: 16px; --gutter: 16px; --editor-font: 16px; --editor-lh: 24px; }
  .brand, .counts, .toolbar .field, .toolbar .actions, .col-left, .col-right { grid-column: 1 / -1; }
  .masthead { padding-top: 20px; padding-bottom: 16px; row-gap: 16px; }
  .brand h1 { font-size: 34px; }
  .counts { justify-content: flex-start; }
  .counts > div { min-width: 0; flex: 1 1 0; }
  .counts > div:first-child { border-left: 0; padding-left: 0; }
  .counts dd { font-size: 36px; }
  .toolbar { row-gap: 10px; }
  .toolbar .field select { flex: 1 1 auto; min-width: 0; font-size: 16px; }
  .toolbar .actions { justify-content: stretch; }
  .toolbar .actions .btn { flex: 1 1 0; }
  .col-left { border-right: 0; padding-right: 0; }
  .editor { height: 46vh; min-height: 280px; }
  .diagram { height: 58vh; min-height: 320px; }
  .hint.inline { display: none; }
  .code { max-height: 420px; font-size: 12px; }
}
