/* Dependency graph explorer (graph.html). Tokens come from site.css. */

.graph-page {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.graph-page .site-header { position: relative; flex: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--paper); padding: 8px 12px; }
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- toolbar ---------- */
.gx-toolbar {
  flex: none;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding: 10px var(--s3);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  font-size: 14px;
  position: relative; z-index: 40;
}
.gx-modes { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); padding: 2px; }
.gx-modes button {
  font: inherit; font-weight: 600; border: 0; background: transparent; color: var(--muted);
  padding: 5px 14px; border-radius: 999px; cursor: pointer;
}
.gx-modes button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.gx-modes button:disabled { opacity: .45; cursor: default; }

.gx-search { position: relative; flex: 1 1 280px; max-width: 460px; min-width: 0; }
.gx-search input {
  width: 100%; font: inherit; font-size: 15px;
  padding: 7px 34px 7px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--ink);
}
.gx-search input::placeholder { color: #8a8a8a; }
.gx-kbd {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font: 12px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 4px;
  padding: 0 5px; background: var(--panel); pointer-events: none;
}
.gx-search input:focus + .gx-kbd { display: none; }
.gx-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60;
  margin: 0; padding: 4px; list-style: none;
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 25, 80, .14);
  max-height: min(60vh, 440px); overflow-y: auto;
}
.gx-results li {
  display: grid; grid-template-columns: auto 1fr; gap: 0 10px; align-items: baseline;
  padding: 6px 8px; border-radius: 6px; cursor: pointer; line-height: 1.35;
}
.gx-results li[aria-selected="true"], .gx-results li:hover { background: var(--brand-light); }
.gx-results .r-num { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.gx-results .r-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gx-results .r-meta { grid-column: 2; font-size: 12px; color: var(--muted); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gx-results .r-empty { display: block; color: var(--muted); cursor: default; }
.gx-results .r-empty:hover { background: none; }

.gx-focus-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.gx-focus-controls[hidden] { display: none; }
.gx-seg { display: inline-flex; align-items: center; gap: 0; }
.gx-seg-label { font-weight: 600; margin-right: 8px; white-space: nowrap; }
.gx-seg-label .short { display: none; }
.gx-seg button {
  font: inherit; font-size: 13px; min-width: 34px; padding: 4px 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); margin-left: -1px;
}
.gx-seg button:first-of-type { border-radius: 6px 0 0 6px; margin-left: 0; }
.gx-seg button:last-of-type { border-radius: 0 6px 6px 0; }
.gx-seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); position: relative; z-index: 1; }
.gx-check { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }
.gx-check input { margin: 0; accent-color: var(--accent); }

/* ---------- main area ---------- */
.gx-main { flex: 1 1 auto; min-height: 0; display: flex; position: relative; }
.gx-stage { position: relative; flex: 1 1 auto; min-width: 0; background:
  radial-gradient(circle at 1px 1px, #dfe7f7 1px, transparent 0) 0 0 / 22px 22px, #fbfcff; }
.gx-cy { position: absolute; inset: 0; }

.gx-focusbar {
  position: absolute; left: 12px; top: 12px; z-index: 5; max-width: min(560px, calc(100% - 80px));
  background: rgba(255, 255, 255, .95); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 12px; font-size: 14px; line-height: 1.4; box-shadow: 0 4px 16px rgba(0, 25, 80, .07);
}
.gx-focusbar .fb-title { font-weight: 600; }
.gx-focusbar .fb-title .num { font-variant-numeric: tabular-nums; }
.gx-focusbar .fb-stats { color: var(--muted); font-size: 13px; }
.gx-focusbar button.linklike { font-size: 13px; }

.gx-banner {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 6;
  max-width: calc(100% - 24px); width: max-content;
  background: var(--ink); color: #fff; border-radius: 999px; padding: 6px 8px 6px 16px;
  font-size: 13px; display: flex; align-items: center; gap: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.gx-banner[hidden] { display: none; }
.gx-banner button { font: inherit; font-weight: 600; border: 0; border-radius: 999px; padding: 4px 12px; cursor: pointer; background: #fff; color: var(--accent); white-space: nowrap; }

.gx-zoom { position: absolute; right: 12px; top: 12px; z-index: 5; display: flex; flex-direction: column; gap: 6px; }
.gx-zoom button {
  width: 34px; height: 34px; display: grid; place-items: center; font: 600 18px var(--sans);
  border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.95); color: var(--ink); cursor: pointer;
}
.gx-zoom button[hidden] { display: none; }
.gx-zoom button:hover { color: var(--accent); border-color: var(--accent); }

.gx-legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 5; font-size: 12px;
  background: rgba(255, 255, 255, .95); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px 10px; max-width: calc(100% - 24px);
}
.gx-legend summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.gx-legend-body { display: grid; grid-template-columns: auto auto; gap: 3px 16px; margin-top: 6px; }
.gx-legend-body .lg-row { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.gx-legend-body .lg-head { grid-column: 1 / -1; font-weight: 600; margin-top: 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.gx-legend-body svg { flex: none; }
.gx-legend-body .lg-scale { grid-column: 1 / -1; }
.gx-legend-body .lg-row svg + svg { margin-left: -3px; }
.gx-legend-body .lg-note { grid-column: 1 / -1; color: var(--muted); font-size: 11px; max-width: 230px; white-space: normal; margin-top: 2px; }

.gx-tooltip {
  position: absolute; z-index: 20; pointer-events: none; max-width: 320px;
  background: var(--ink); color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 13px; line-height: 1.35;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
}
.gx-tooltip .tt-num { font-weight: 600; }
.gx-tooltip .tt-sub { color: #c9d6f2; font-size: 12px; }
.gx-busy {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 8;
  background: rgba(251, 252, 255, .6); font-weight: 600; color: var(--muted);
}
.gx-busy[hidden] { display: none; }
.gx-noscript { padding: var(--s3); }
.gx-fatal {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 9;
  width: min(460px, calc(100% - 32px)); background: var(--paper); border: 1px solid var(--line);
  border-left: 4px solid var(--st-assumed); border-radius: var(--radius); padding: 14px 18px;
  box-shadow: 0 8px 28px rgba(0, 25, 80, .12); font-size: 15px; line-height: 1.5;
}
.gx-fatal[hidden] { display: none; }
.gx-fatal p { margin: 0 0 8px; }
.gx-fatal p:last-child { margin-bottom: 0; }

/* ---------- side panel ---------- */
.gx-panel {
  flex: none; width: 420px; max-width: 45vw; border-left: 1px solid var(--line);
  background: var(--paper); display: flex; flex-direction: column; min-height: 0; outline: none;
}
.gx-panel.is-closed { display: none; }
.gx-panel-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px 0 20px; min-height: 40px; }
.gx-grip { display: none; }
.gx-panel-title { display: none; }
.gx-panel-close {
  margin-left: auto; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent;
  font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer;
}
.gx-panel-close:hover { background: var(--panel); color: var(--ink); }
.gx-panel-back { font: inherit; font-size: 13px; font-weight: 600; border: 0; background: none; color: var(--accent); cursor: pointer; padding: 4px 0; }
.gx-panel-body { flex: 1 1 auto; overflow-y: auto; padding: 4px 20px 28px; font-size: 15px; overscroll-behavior: contain; }

.gx-panel-body h2 { font-size: 22px; line-height: 1.25; margin: 4px 0 8px; outline: none; }
.gx-panel-body h3 {
  font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  margin: 22px 0 8px; padding-top: 14px; border-top: 1px solid #e6edfb;
}
.gx-panel-body p { margin: 0 0 10px; }
.gx-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; color: var(--muted); }
.gx-kicker .num { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.gx-label { font-family: var(--mono); font-size: 12px; color: var(--muted); word-break: break-all; }
.gx-statement { background: var(--panel); border-radius: 8px; padding: 12px 14px; margin: 12px 0; line-height: 1.55; overflow-x: auto; }
.gx-statement p:last-child { margin-bottom: 0; }
.gx-statement ol, .gx-statement ul { padding-left: 1.3em; margin: 6px 0; }
.gx-statement .katex-display { margin: .6em 0; overflow-x: auto; overflow-y: hidden; }
.gx-note { font-size: 14px; border-left: 3px solid var(--st-assumed); background: var(--st-assumed-bg); padding: 8px 12px; border-radius: 0 8px 8px 0; margin: 10px 0; }
.gx-note.proved { border-color: var(--st-formalized); background: var(--st-formalized-bg); }
.gx-note.excluded { border-color: var(--st-excluded); background: var(--st-excluded-bg); }
.gx-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.gx-actions .btn { padding: 7px 16px; font-size: 14px; }

.gx-lean { list-style: none; margin: 0; padding: 0; }
.gx-lean li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 4px 0; }
.gx-lean a { font-family: var(--mono); font-size: 13px; word-break: break-all; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 999px; line-height: 18px; white-space: nowrap; }
.tag-draft { background: #fff7d6; color: #7a5a00; }
.tag-reviewed { background: var(--st-formalized-bg); color: var(--st-formalized); }
.tag-axiom { background: var(--st-assumed-bg); color: var(--st-assumed); }
.tag-kind { background: var(--panel); color: var(--muted); }

.gx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 999px; padding: 2px 10px 2px 8px;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.proof { border-style: dashed; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
/* status markers differ in shape as well as colour: circle, diamond, ring */
.dot-formalized { background: var(--st-formalized); }
.dot-assumed { background: var(--st-assumed); border-radius: 1px; transform: rotate(45deg) scale(.92); }
.dot-excluded { background: transparent; box-shadow: inset 0 0 0 2px var(--st-excluded); }
.chip-group { border-style: double; border-width: 3px; border-color: var(--line); padding: 0 9px; color: var(--accent); font-weight: 600; }
.gx-sub { font-size: 13px; color: var(--muted); margin: 10px 0 6px; }

.linklike { font: inherit; border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-weight: 600; }
.linklike:hover { text-decoration: underline; }

/* rests-on */
.gx-rests .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 12px; }
.gx-rests .stat { background: var(--panel); border-radius: 8px; padding: 8px 10px; }
.gx-rests .stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.gx-rests .stat span { font-size: 12px; color: var(--muted); }
.gx-rests .bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--panel); margin-bottom: 12px; }
.gx-rests .bar i { display: block; height: 100%; }
.gx-list { list-style: none; margin: 0; padding: 0; }
.gx-list li { padding: 6px 0; border-bottom: 1px solid #eef2fb; line-height: 1.4; }
.gx-list li:last-child { border-bottom: 0; }
.gx-list .row { display: flex; align-items: baseline; gap: 8px; }
.gx-list .row .num { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gx-list .row .ttl { flex: 1; min-width: 0; }
.gx-list .row .go { font-size: 12px; white-space: nowrap; }
.gx-list .src { font-size: 12px; color: var(--muted); margin: 2px 0 0 16px; }
.gx-group-title { font-weight: 600; font-size: 14px; margin: 12px 0 2px; }

/* section list (overview) */
.gx-entlist { list-style: none; margin: 0; padding: 0; }
.gx-entlist li button {
  width: 100%; text-align: left; font: inherit; font-size: 14px; display: grid; grid-template-columns: 12px auto 1fr;
  gap: 8px; align-items: baseline; border: 0; background: none; padding: 5px 6px; border-radius: 6px; cursor: pointer; color: var(--ink);
}
.gx-entlist li button:hover, .gx-entlist li button:focus-visible { background: var(--brand-light); }
.gx-entlist .num { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gx-entlist .k { color: var(--muted); font-size: 12px; margin-right: 4px; }

.gx-start { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.gx-start button {
  width: 100%; text-align: left; font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--paper);
  border-radius: var(--radius); padding: 10px 12px; line-height: 1.35; color: var(--ink);
}
.gx-start button:hover, .gx-start button:focus-visible { border-color: var(--accent); background: var(--brand-light); }
.gx-start .num { font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.gx-start .why { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.gx-intro { font-size: 15px; }
.gx-home-link { font-size: 13px; }
.gx-panel-body h3:focus, .gx-panel-body h3:focus-visible { outline: none; }
.gx-seclist { list-style: none; margin: 0 0 6px; padding: 0; }
.gx-seclist li button {
  width: 100%; text-align: left; font: inherit; font-size: 14px; display: grid; grid-template-columns: auto 1fr;
  gap: 0 8px; align-items: baseline; border: 0; background: none; padding: 5px 6px; border-radius: 6px; cursor: pointer; color: var(--ink);
}
.gx-seclist li button:hover, .gx-seclist li button:focus-visible { background: var(--brand-light); }
.gx-seclist .num { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gx-seclist .cnt { grid-column: 2; font-size: 12.5px; color: var(--muted); }
.gx-kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 14px; }
.gx-kv dt { color: var(--muted); }
.gx-kv dd { margin: 0; }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .gx-toolbar { padding: 8px 16px; gap: 6px 12px; }
  .gx-search { flex: 1 1 140px; max-width: none; }
  .gx-search input { font-size: 16px; padding: 6px 10px; }
  .gx-modes button { padding: 5px 11px; }
  .gx-kbd { display: none; }
  .gx-focus-controls { order: 4; gap: 4px 12px; font-size: 13px; }
  .gx-seg button { min-width: 28px; padding: 3px 5px; }
  .gx-seg-label { margin-right: 5px; }
  .gx-seg-label .long { display: none; }
  .gx-seg-label .short { display: inline; }
  .gx-check { font-size: 13px; }

  .gx-panel {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 30; width: auto; max-width: none;
    height: 55%; border-left: 0; border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0; box-shadow: 0 -10px 30px rgba(0, 25, 80, .16);
  }
  .gx-panel.is-collapsed { height: 44px; }
  .gx-panel.is-collapsed .gx-panel-body { display: none; }
  .gx-panel-head { padding: 4px 8px 0 16px; position: relative; min-height: 40px; cursor: grab; }
  .gx-panel-title {
    display: block; flex: 1; min-width: 0; font-weight: 600; font-size: 14px; padding-top: 10px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .gx-panel-back .long { display: none; }
  .gx-panel-back { padding-top: 10px; }
  .gx-grip { display: block; position: absolute; left: 50%; top: 6px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: #c9d3e6; }
  .gx-panel-body { padding: 4px 16px 24px; }
  .gx-panel-body h2 { font-size: 19px; }
  .gx-focusbar { left: 8px; top: 8px; right: 52px; max-width: none; padding: 6px 10px; font-size: 13px; }
  .gx-zoom { right: 8px; top: 8px; }
  .gx-zoom button { width: 32px; height: 32px; }
  .gx-legend { left: 8px; bottom: 52px; }  /* clear of the collapsed bottom sheet */
  .gx-main:has(.gx-panel.is-closed) .gx-legend { bottom: 8px; }
  .gx-banner .long { display: none; }
  .gx-focusbar .fb-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .gx-banner { bottom: 52px; font-size: 12px; border-radius: 12px; padding: 6px 6px 6px 12px; }
  .gx-tooltip { display: none !important; }
}
@media (max-width: 640px) {
  .graph-page .site-header { padding: 8px 16px; gap: 0; }
  .graph-page .brand { font-size: 17px; }
  .graph-page .brand-logo { height: 30px; }
  .graph-page .site-nav { gap: 2px 7px; font-size: 12px; }
}
