/* Minimal on purpose: system fonts, one accent, dark mode via media query.
   Shares the visual tokens and chrome of seenix, trynix, and nixpkgs-multiverse. */
:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #6a6a6a;
  --line: #e0e0e0;
  --accent: #4f6bed;
  --code-bg: #f4f4f4;
  --error: #c94f4f;
  --error-bg: rgba(201, 79, 79, 0.11);
  --warn: #b37400;
  --warn-bg: rgba(179, 116, 0, 0.1);
  --ok: #26733b;
  --ok-bg: rgba(38, 115, 59, 0.1);
  --node-bg: #eef2ff;
  --node-err-bg: #fbe9e7;
  /* LLVM IR syntax palette */
  --hl-kw: #7c3aed;
  --hl-typ: #0369a1;
  --hl-attr: #b45309;
  --hl-sym: #1d4ed8;
  --hl-reg: #0f766e;
  --hl-lbl: #be123c;
  --hl-str: #15803d;
  --hl-num: #9333ea;
  --hl-com: #737373;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d;
    --fg: #e6e6e6;
    --muted: #9a9a9a;
    --line: #33363d;
    --accent: #8fa3ff;
    --code-bg: #22252c;
    --error: #e07070;
    --error-bg: rgba(224, 112, 112, 0.14);
    --warn: #e0b050;
    --warn-bg: rgba(224, 176, 80, 0.12);
    --ok: #66c27e;
    --ok-bg: rgba(102, 194, 126, 0.12);
    --node-bg: #1e2333;
    --node-err-bg: #2e1e20;
    /* LLVM IR syntax palette (dark) */
    --hl-kw: #c084fc;
    --hl-typ: #7dd3fc;
    --hl-attr: #fbbf24;
    --hl-sym: #93c5fd;
    --hl-reg: #5eead4;
    --hl-lbl: #fda4af;
    --hl-str: #86efac;
    --hl-num: #d8b4fe;
    --hl-com: #8b929e;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0 auto;
  padding: 1rem;
  max-width: 88rem;
  background: var(--bg);
  color: var(--fg);
  font:
    15px/1.5 system-ui,
    sans-serif;
}

h1 {
  font-size: 1.3rem;
  margin: 0.2rem 0;
}
h1 a {
  color: inherit;
  text-decoration: none;
}
h1 a.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
h1 .mark {
  display: block;
  border-radius: 5px;
}
h2 {
  font-size: 1.1rem;
  margin: 1.1rem 0 0.4rem;
}

header.site {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.3rem 1rem;
  margin: 0.2rem 0 0.6rem;
}

a {
  color: var(--accent);
}
.muted {
  color: var(--muted);
}
.lede {
  font-weight: 600;
}
.claim {
  text-decoration: underline var(--muted);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.intro {
  max-width: 64rem;
  margin: 0.4rem 0 0.8rem;
}

code,
kbd {
  font:
    13px/1.5 ui-monospace,
    monospace;
  background: var(--code-bg);
  border-radius: 3px;
  padding: 0.08rem 0.3rem;
}

#lanes {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  margin: 0.6rem 0 0.9rem;
  scrollbar-width: none;
}
#lanes a {
  flex: 0 0 auto;
  border-bottom: 2px solid transparent;
  padding: 0.4rem 0.85rem;
  color: var(--muted);
  text-decoration: none;
}
#lanes a.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

.examples {
  margin: 0.2rem 0 0.7rem;
  font-size: 14px;
  line-height: 1.8;
}
.examples a {
  text-decoration: none;
  padding: 0.12rem 0.42rem;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.examples a:hover {
  border-color: var(--line);
  background: var(--code-bg);
}
.examples a.active {
  background: var(--code-bg);
  border-color: var(--accent);
  color: var(--fg);
  font-weight: 600;
}
.examples a.kind-bug::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--error);
  margin-right: 5px;
  vertical-align: middle;
}
.examples a.kind-ok::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  margin-right: 5px;
  vertical-align: middle;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.6rem;
}
.toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  font-size: 13px;
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  color: var(--muted);
}

button {
  font: inherit;
  font-size: 13px;
  color: var(--fg);
  padding: 0.3rem 0.7rem;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
button:hover {
  border-color: var(--accent);
}

.status-pill {
  font:
    13px/1.4 ui-monospace,
    monospace;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--code-bg);
}
.status-pill.ok {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: var(--ok);
}
.status-pill.err {
  color: var(--error);
  background: var(--error-bg);
  border-color: var(--error);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 0.9rem;
  align-items: start;
}
@media (max-width: 960px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

.pane {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
}
.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  background: var(--code-bg);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.pane-title {
  font-weight: 600;
}
.pane-title a {
  text-decoration: none;
  font-family: ui-monospace, monospace;
}
.pane-title a:hover {
  text-decoration: underline;
}

.subtabs {
  display: flex;
  gap: 0.5rem;
}
.subtabs a {
  text-decoration: none;
  color: var(--muted);
  font-size: 12px;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}
.subtabs a.active {
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
}

.editor-wrap {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  min-height: 29rem;
  max-height: 44rem;
  overflow: auto;
  font:
    13px/1.55 ui-monospace,
    monospace;
}
.gutter {
  padding: 0.65rem 0.45rem 0.65rem 0;
  text-align: right;
  color: var(--muted);
  background: var(--code-bg);
  border-right: 1px solid var(--line);
  user-select: none;
}
.gutter .ln {
  height: 1.55em;
  padding-right: 0.3rem;
}
.gutter .ln.err {
  background: var(--error-bg);
  color: var(--error);
  font-weight: 700;
}
.gutter .ln.warn {
  color: var(--warn);
  font-weight: 700;
}

/* Syntax-highlighted editor: highlighted <pre> and transparent <textarea> share one grid cell. */
.editor-stage {
  display: grid;
  min-height: 29rem;
  overflow-x: auto;
}
.ir-highlight,
#ir-input {
  grid-area: 1 / 1;
  margin: 0;
  padding: 0.65rem 0.75rem;
  font: inherit;
  line-height: 1.55;
  white-space: pre;
  tab-size: 2;
  letter-spacing: 0;
  word-spacing: 0;
}
.ir-highlight {
  min-height: 29rem;
  min-width: 100%;
  pointer-events: none;
  color: var(--fg);
}
#ir-input {
  width: 100%;
  height: 100%;
  min-height: 29rem;
  border: 0;
  outline: none;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: transparent;
  caret-color: var(--fg);
}
#ir-input::selection {
  background: rgba(79, 107, 237, 0.25);
}

/* LLVM IR syntax tokens */
.hl-line {
  display: inline-block;
  min-width: 100%;
}
.hl-line-err {
  background: var(--error-bg);
}
.hl-line-warn {
  background: var(--warn-bg);
}
.hl-kw {
  color: var(--hl-kw);
  font-weight: 600;
}
.hl-typ {
  color: var(--hl-typ);
}
.hl-attr {
  color: var(--hl-attr);
  font-weight: 600;
}
.hl-sym {
  color: var(--hl-sym);
  font-weight: 600;
}
.hl-reg {
  color: var(--hl-reg);
}
.hl-lbl {
  color: var(--hl-lbl);
  font-weight: 600;
}
.hl-str {
  color: var(--hl-str);
}
.hl-num {
  color: var(--hl-num);
}
.hl-com {
  color: var(--hl-com);
  font-style: italic;
}

.diag-panel {
  border-bottom: 1px solid var(--line);
}
.diag-pre {
  margin: 0;
  padding: 0.75rem;
  font:
    12.5px/1.5 ui-monospace,
    monospace;
  overflow-x: auto;
  white-space: pre;
  max-height: 22rem;
  overflow-y: auto;
}
.diag-err {
  color: var(--error);
  font-weight: 700;
}
.diag-warn {
  color: var(--warn);
  font-weight: 700;
}
.diag-ok {
  color: var(--ok);
  font-weight: 600;
}
.diag-gutter {
  color: var(--accent);
}
.diag-help {
  color: var(--muted);
}

.graph-panel {
  padding: 0.65rem 0.75rem;
}
.roots-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
  font:
    12px/1.4 ui-monospace,
    monospace;
}
.root-chip {
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--code-bg);
}
.root-chip.state-freed,
.root-chip.state-moved {
  border-color: var(--accent);
}
.root-chip.state-maybe-freed,
.root-chip.state-maybe-moved {
  border-color: var(--error);
  color: var(--error);
}

.graph-svg {
  overflow-x: auto;
  text-align: center;
}
.graph-svg svg.dot-svg {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  max-height: 34rem;
  width: auto;
  height: auto;
}
.dot-details {
  margin-top: 0.6rem;
  border-top: 1px solid var(--line);
  padding-top: 0.4rem;
  font-size: 12px;
}
.dot-details summary {
  cursor: pointer;
  user-select: none;
}

.libir-grid {
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}
@media (max-width: 800px) {
  .libir-grid {
    grid-template-columns: 1fr;
  }
}
.libir-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.libir-item {
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.4;
}
.libir-item.active {
  border-color: var(--accent);
  background: var(--code-bg);
}
.libir-item strong {
  display: block;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  margin-bottom: 0.15rem;
}
.libir-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.libir-detail {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  min-width: 0;
}
.code-view {
  margin: 0;
  padding: 0.75rem;
  background: var(--bg);
  font:
    12.5px/1.55 ui-monospace,
    monospace;
  overflow-x: auto;
  max-height: 36rem;
}

.rules-prose {
  max-width: 64rem;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 0.5rem 0 1.4rem;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.data-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

footer {
  margin-top: 2rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
  text-align: center;
}
#store {
  margin-top: 0.3rem;
}
#store code {
  font-size: min(12px, 2.1vw);
  white-space: nowrap;
  background: none;
  padding: 0;
}
