/* Blob view — numbered source lines. Owned by views/blob.html */

.source {
  margin: .75rem 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow-x: auto;
}
.source table { border-collapse: collapse; font-size: .8rem; }
.source tr:target { background: rgba(167, 139, 250, 0.18); }
.source .ln {
  padding: 0 .75rem;
  text-align: right;
  color: var(--fg-subtle);
  user-select: none;
  white-space: nowrap;
  border-right: 1px solid var(--line);
}
.source .ln a { color: inherit; }
.source .lc {
  padding: 0 .75rem;
  white-space: pre;
  width: 100%;
}

/* Syntax highlighting, set by internal/modules/highlight.go. Tokens without
   a mapped class (punctuation, operators, plain names) are left uncoloured. */
.source .tok-k  { color: var(--syn-kw); }
.source .tok-s  { color: var(--syn-str); }
.source .tok-n  { color: var(--syn-num); }
.source .tok-fn { color: var(--syn-fn); }
.source .tok-c  { color: var(--fg-subtle); font-style: italic; }

/* JSON/YAML: a parse-error banner, and per-level indent guides set by
   internal/modules/structured.go. Width is inlined per span since the
   indent unit (2 vs 4 spaces) varies by file. */
.notice-warn { border-left-color: var(--del); }
.source .ind {
  display: inline-block;
  border-left: 1px solid var(--line-soft);
  height: 1.2em;
  vertical-align: text-top;
}

/* Fold controls. The chevron lives in the gutter, but the gutter reserves
   its width on every row -- otherwise line numbers jog sideways down the
   file depending on which lines happen to open a block. */
.source.foldable .ln { position: relative; padding-left: 1.5rem; }
.source .fold {
  position: absolute;
  left: .15rem;
  top: 0;
  width: 1.1rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--fg-subtle);
  font: inherit;
  line-height: inherit;
  cursor: pointer;
}
.source .fold::before { content: "▾"; display: block; }
.source .fold[aria-expanded="false"]::before { content: "▸"; }
.source .fold:hover { color: var(--accent); }
.source tr.is-collapsed .lc::after {
  content: " " attr(data-fold-note);
  color: var(--fg-subtle);
}
.source tr.is-hidden { display: none; }

/* Search state. Matches are marked at row level: rewriting the cell to wrap
   hits in <mark> would destroy the highlight spans underneath. */
.source tr.is-match { background: rgba(167, 139, 250, 0.10); }
.source tr.is-current { background: rgba(167, 139, 250, 0.28); }

/* YAML anchors and aliases, resolved in internal/modules/structured.go. */
.source .aref {
  margin-left: .6rem;
  padding: 0 .3rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  color: var(--fg-muted);
  font-size: .9em;
  text-decoration: none;
  white-space: nowrap;
}
.source .aref:hover { color: var(--accent); border-color: var(--accent); }
.source .anchor-uses {
  margin-left: .6rem;
  color: var(--fg-subtle);
  font-size: .85em;
}

/* Toolbar, built at runtime by static/js/structured.js -- a page without JS
   never shows it. */
.sbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  margin-top: .75rem;
}
.sbar-q {
  flex: 1 1 14rem;
  min-width: 0;
  padding: .3rem .5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--fg);
  font: inherit;
  font-size: .8rem;
}
.sbar-q:focus { outline: none; border-color: var(--accent); }
.sbar-count {
  min-width: 5.5rem;
  color: var(--fg-subtle);
  font-size: .75rem;
  text-align: right;
}
.sbar-scope { display: flex; }
.sbar-scope button,
.sbar-btn {
  padding: .3rem .55rem;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--fg-muted);
  font: inherit;
  font-size: .75rem;
  cursor: pointer;
}
.sbar-scope button { border-radius: 0; margin-left: -1px; }
.sbar-scope button:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); margin-left: 0; }
.sbar-scope button:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.sbar-btn { border-radius: var(--r-sm); }
.sbar-scope button:hover,
.sbar-btn:not(:disabled):hover { color: var(--fg); border-color: var(--line-soft); }
.sbar-scope button[aria-pressed="true"],
.sbar-btn[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
}
.sbar-btn:disabled { opacity: .45; cursor: default; }
