/*
 * This is a manifest file that'll be compiled into application.css.
 */

/* bms-docs' own vocabulary, defined in terms of the BMS design system's
 * semantic tokens (bms_design.css, linked ahead of this file).
 *
 * The ~1000 lines below already speak in these names — var(--panel),
 * var(--ink), var(--line) — so adopting the system is this block, not a rewrite
 * of every rule. The names stay; what they resolve to becomes the shared OKLCH
 * ramps instead of hardcoded hex.
 *
 * There is no dark-mode block here any more. The design system's semantic layer
 * flips under `html.dark`, so these aliases follow it for free — see the boot
 * script in the layout, which sets that class from the stored choice or the OS.
 */
:root {
  color-scheme: light dark;

  /* surfaces */
  --bg: var(--color-canvas);
  --bg-accent: var(--color-surface-sunken);
  --panel: var(--color-surface);
  --panel-border: var(--color-border);
  --line: var(--color-border);

  /* text */
  --ink: var(--color-text);
  --muted: var(--color-text-muted);

  /* the editorial sidebar, which the system names as its own nav surface */
  --sidebar-bg: var(--color-nav-surface);
  --sidebar-border: var(--color-border-strong);
  --sidebar-ink: var(--color-nav-text);
  --sidebar-heading: var(--color-text-subtle);

  /* status */
  --danger: var(--color-danger-600);
  --success: var(--color-success-600);
  --warning: var(--color-warning-600);

  /* Not aliases: the system carries no shadow or scrim tokens, so these stay
     bms-docs' own. color-mix keeps them following the theme rather than
     freezing a light-mode rgba(). */
  --topbar-bg: color-mix(in oklab, var(--color-surface) 92%, transparent);
  --flash-bg: color-mix(in oklab, var(--color-accent) 12%, transparent);
  --shadow-soft: 0 10px 30px color-mix(in oklab, var(--color-neutral-950) 6%, transparent);
  --shadow-strong: 0 18px 48px color-mix(in oklab, var(--color-neutral-950) 10%, transparent);
}

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

html {
  background: var(--bg);
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.12), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 100%);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: var(--color-primary-600);
  text-decoration: none;
}

a:hover {
  color: var(--color-primary-700);
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.stroke-current {
  stroke: currentColor;
}

/* Shell (layout, sidebar, topbar) is now styled inline with Tailwind utilities
 * in app/views/layouts/application.html.erb and app/views/shared/_sidebar|_topbar.
 * The classes that used to live here (.app-shell, .shell-*, .dropdown-*, .icon-button,
 * .user-trigger, etc.) have been removed. Page-level classes (.panel, .hero, .stack,
 * etc.) remain below.
 */

/* Shell navigation (rendered by shared/_shell_nav for the docs + admin sidebar).
 * Colours are defined here, unlayered, on purpose: the global `a` rule above
 * paints every anchor primary-blue, and Tailwind text utilities live in
 * @layer utilities, which an unlayered rule beats. Setting nav colours here is
 * what makes the links legible (light ink) instead of low-contrast blue-on-black. */
.shell-nav-heading {
  color: #aeb9c9;
}

.shell-nav-link,
.shell-nav-summary,
.shell-nav-child {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  color: #e5ebf2;
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.25rem;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.shell-nav-summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.shell-nav-summary::-webkit-details-marker {
  display: none;
}

.shell-nav-link svg,
.shell-nav-summary svg,
.shell-nav-child svg {
  flex: none;
}

.shell-nav-text {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.shell-nav-link:hover,
.shell-nav-summary:hover,
.shell-nav-child:hover {
  background-color: rgba(148, 163, 184, 0.16);
  color: #ffffff;
}

.shell-nav-link.is-active,
.shell-nav-summary.is-active {
  background-color: rgba(148, 163, 184, 0.24);
  color: #ffffff;
}

.shell-nav-chevron {
  flex: none;
  color: #93a3b8;
  transition: transform 0.2s ease;
}

.shell-nav-group[open] > .shell-nav-summary .shell-nav-chevron {
  transform: rotate(90deg);
}

.shell-nav-children {
  margin: 0.125rem 0 0.5rem 1.6rem;
  padding-left: 0.6rem;
  border-left: 1px solid rgba(148, 163, 184, 0.28);
}

/* Everything inside an expanded group (topics, nested folder headers) reads
   one step smaller than the top-level nav. */
.shell-nav-children .shell-nav-child,
.shell-nav-children .shell-nav-summary {
  font-size: 0.8rem;
  line-height: 1.1rem;
  padding: 0.35rem 0.6rem;
}

.shell-nav-children .shell-nav-chevron {
  width: 0.85rem;
  height: 0.85rem;
}

.shell-nav-child {
  color: #c6d0dd;
  font-weight: 450;
  font-size: 0.85rem;
  padding-top: 0.375rem;
  padding-bottom: 0.375rem;
}

.shell-nav-child.is-active {
  background-color: rgba(148, 163, 184, 0.2);
  color: #ffffff;
}

.flash {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 0.85rem;
  background: var(--flash-bg);
  border: 1px solid rgba(59, 130, 246, 0.18);
}

.flash-alert {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.16);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero,
.section-header,
.panel-grid,
.card-grid,
.button-row {
  display: grid;
  gap: 1rem;
}

.hero,
.section-header {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.panel-grid,
.card-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.button-row {
  grid-auto-flow: column;
  justify-content: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 0.95rem;
  padding: 1.4rem;
  box-shadow: var(--shadow-soft);
}

.panel-spotlight {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
}

.panel-subtle {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.03), transparent 9rem), var(--panel);
}

.panel-danger {
  border-color: rgba(220, 38, 38, 0.24);
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--color-primary-600);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
}

.lede {
  max-width: 44rem;
  margin: 0;
  color: var(--muted);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid #cbd5e1;
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-soft);
}

.button:hover {
  background: rgba(59, 130, 246, 0.06);
}

.button-primary {
  background: var(--color-primary-600);
  border-color: var(--color-primary-600);
  color: white;
}

.button-primary:hover {
  background: var(--color-primary-700);
  color: white;
}

.app-card-title {
  margin: 0 0 0.25rem;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-primary-600);
  text-align: left;
  cursor: pointer;
}

.app-card-title:hover {
  color: var(--color-primary-700);
  text-decoration: underline;
}

.button-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.button-danger:hover {
  background: #b91c1c;
  color: white;
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-row-wide {
  grid-column: 1 / -1;
}

.form-row-inline {
  flex-direction: row;
  align-items: center;
  gap: 1.2rem;
}

.form-subheading {
  margin: 1.75rem 0 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.form-row label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.form-grid input[type="text"],
.form-grid select,
.form-grid textarea,
.form-control {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.75rem;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

.form-grid textarea,
.form-control {
  min-height: 9rem;
  resize: vertical;
}

.form-control-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  line-height: 1.5;
}

.form-grid input[type="text"]:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.form-control:focus {
  outline: 0;
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

/* Compact button for inline table actions (e.g. deleting a draft topic). */
.button-small {
  min-height: 1.9rem;
  padding: 0.25rem 0.7rem;
  font-size: 0.8rem;
  border-radius: 0.55rem;
}

/* Right-aligned, shrink-to-fit action cell in listing tables. */
.table-actions {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

/* AI assist row: instruction input beside the Improve button. */
.assist-row {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
}

.assist-row .form-control {
  flex: 1 1 auto;
  min-height: 2.75rem;
}

.assist-status {
  min-height: 1.25rem;
  margin-bottom: 0;
}

.assist-status-error {
  color: var(--danger);
}

/* Draft topic editor: the markdown editor beside its actions pane
   (Save, AI assist, Rename). Marksmith's own Preview tab handles preview. */
.editor-split {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .editor-split {
    grid-template-columns: minmax(0, 1fr) 22rem;
    align-items: start;
  }
}

.editor-actions {
  display: grid;
  /* minmax(0, 1fr), not the implicit `auto`. An auto track sizes to its widest
     item's max-content, and a grid item's min-width defaults to auto, so the
     column refuses to shrink: the YAML in the Meta pane made both panels 417px
     wide inside a 352px column and pushed the page 40px past the viewport.
     Capping the track is what makes overflow-x on the pre actually engage. */
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  align-content: start;
  min-width: 0;
}

/* Same reason, one level down: a panel is a grid item too, and its own contents
   must be allowed to shrink rather than set its floor. */
.editor-actions > .panel {
  min-width: 0;
}

.editor-pane h2 {
  margin-top: 0;
}

/* Marksmith inside the editor pane: fill the panel and match the old
   textarea's working height. */
.editor-pane .marksmith-editor-wrapper {
  width: 100%;
}

.editor-pane .marksmith-textarea {
  min-height: 28rem;
}

.attach-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

/* The label inside a nav accordion header doubles as a link to that
   section's page listing; keep it reading like the rest of the summary. */
.shell-nav-summary-link {
  color: inherit;
}

.shell-nav-summary-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
}

.checkbox input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
}

.form-actions {
  display: flex;
  justify-content: flex-start;
  gap: 0.75rem;
  margin-top: 1rem;
}

.status,
.review-health {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.3rem 0.72rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.status {
  background: rgba(148, 163, 184, 0.14);
  color: var(--muted);
}

.status-completed,
.review-health-good {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}

.status-running,
.status-pending,
.review-health-warning {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warning);
}

.status-failed {
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger);
}

.status-draft {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
  margin-top: 0.95rem;
}

.artifact-group + .artifact-group {
  margin-top: 1.5rem;
}

.artifact-group-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.artifact-group-header h3 {
  margin: 0;
}

.artifact-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.artifact-meta-grid strong {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.artifact-meta-span {
  grid-column: 1 / -1;
}

.review-stat {
  padding: 0.95rem 1rem;
  border-radius: 0.85rem;
  border: 1px solid var(--line);
  background: rgba(59, 130, 246, 0.04);
}

.review-stat strong,
.review-stat span {
  display: block;
}

.review-stat strong {
  margin-bottom: 0.25rem;
}

.muted-detail {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.88rem;
}

/* .table comes from the design system now — same intent (uppercase headers,
 * muted, ruled rows) on the shared tokens, so every BMS app's tables read alike.
 * .table-actions below is bms-docs' own and still applies: an unlayered rule
 * beats the gem's @layer components. */

.code-block,
.doc-block {
  margin: 0;
  padding: 1rem;
  border-radius: 0.85rem;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--line);
  white-space: pre-wrap;
  overflow-x: auto;
}

.markdown-body {
  max-width: 70ch;
  line-height: 1.7;
}

.markdown-body > :first-child {
  margin-top: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 1.5rem 0 0.85rem;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.markdown-body h1 {
  font-size: 2rem;
  font-weight: 800;
}

.markdown-body h2 {
  font-size: 1.45rem;
  font-weight: 750;
}

.markdown-body h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote,
.markdown-body pre {
  margin: 0 0 1rem;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.5rem;
}

.markdown-body ul {
  list-style: disc;
}

.markdown-body ol {
  list-style: decimal;
}

.markdown-body li + li {
  margin-top: 0.35rem;
}

.markdown-body li > ul,
.markdown-body li > ol {
  margin-top: 0.45rem;
}

.markdown-body blockquote {
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--color-primary-300);
  background: rgba(59, 130, 246, 0.06);
  color: var(--muted);
  border-radius: 0 0.7rem 0.7rem 0;
}

.markdown-body .anchor {
  display: none;
}

.markdown-body code {
  padding: 0.1rem 0.35rem;
  border-radius: 0.35rem;
  background: rgba(59, 130, 246, 0.1);
}

.markdown-body pre code {
  display: block;
  padding: 1rem;
  overflow-x: auto;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
}

/* --- Blueprint: the draft's structure --------------------------------------- */
/* The lead panel: this is what a draft IS, so it reads before the diff. */
.panel-lead {
  border-left: 3px solid var(--color-primary-500);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.panel-header h2 {
  margin: 0;
}

.blueprint-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Nesting is the point of the blueprint, so indentation carries a rule the eye
   can follow rather than relying on whitespace alone. */
.blueprint-tree .blueprint-tree {
  margin-left: 0.6rem;
  padding-left: 0.9rem;
  border-left: 1px solid var(--line);
}

.blueprint-node {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.4rem 0;
}

.blueprint-label {
  font-weight: 600;
}

.blueprint-path {
  font-size: 0.8rem;
  color: var(--muted);
  background: rgba(148, 163, 184, 0.12);
  padding: 0.05rem 0.35rem;
  border-radius: 0.3rem;
}

.blueprint-open {
  font-size: 0.8rem;
  margin-left: auto;
}

/* The quadrant colours match the map's, so a type means the same thing
   wherever it is shown. */
.blueprint-type {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 0.3rem;
  color: #fff;
  background: var(--muted);
}

.blueprint-type.is-tutorial { background: var(--color-primary-500); }
.blueprint-type.is-how_to { background: var(--success); }
.blueprint-type.is-reference { background: var(--color-primary-800); }
.blueprint-type.is-explanation { background: var(--warning); }

/* The textarea is the form's field and stays in the DOM; CodeMirror renders
   beside it. Hidden only once the editor has actually booted, so a JS failure
   leaves a usable textarea rather than nothing. */
.blueprint-source {
  width: 100%;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85rem;
}

.blueprint-source.is-editor-backed {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.blueprint-mount .cm-editor {
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  max-height: 60vh;
  font-size: 0.85rem;
}

.blueprint-mount .cm-editor.cm-focused {
  outline: 2px solid var(--color-primary-500);
  outline-offset: 1px;
}

.blueprint-mount .cm-scroller {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.blueprint-help dt {
  font-weight: 600;
  margin-top: 0.6rem;
}

.blueprint-help dd {
  margin: 0.1rem 0 0;
  color: var(--muted);
}

.panel-danger {
  border-left: 3px solid var(--danger);
}

/* A published draft is history, not a failure — warning, not danger. */
.panel-notice {
  border-left: 3px solid var(--warning);
}

/* The read-only view of a topic: the markdown as it went live, in the same
   monospace shape as the editor so the two are visibly the same thing. */
/* Front matter panes. The published one is read-only YAML; the editable one is
   a plain textarea, because front matter is an open set of keys and a field per
   key can only ever expose the ones someone thought of in advance. */
.meta-yaml {
  margin: 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  overflow-x: auto;
}

.meta-yaml code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre;
}

.meta-editor {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  resize: vertical;
}

.form-error {
  color: var(--danger, #b3261e);
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
}

.topic-readonly {
  width: 100%;
  min-height: 28rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  resize: vertical;
}

/* --- Classification review ------------------------------------------------- */
.classify-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.classify-table th,
.classify-table td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.classify-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.classify-table td:first-child,
.classify-table th:first-child {
  width: 3rem;
}

.classify-table .form-control {
  min-width: 9rem;
}

/* A low-confidence row is tinted, not hidden — the operator should look at it,
   and it is still ticked if the assistant proposed a type. */
.classify-table tr.is-low {
  background: color-mix(in oklab, var(--warning) 7%, transparent);
}

/* --- Documentation map and tags (Design 22, phase 06) ---------------------- */
.doc-map {
  display: block;
  width: 100%;
  max-height: 70vh;
  overflow: visible;
}

.doc-map-edges path {
  fill: none;
  stroke: var(--color-primary-500);
  stroke-width: 1;
  /* Chords overlap heavily in a dense corpus; low opacity lets density read as
     density rather than as a solid block. */
  opacity: 0.28;
}

.doc-map-nodes circle {
  fill: var(--muted);
  transition: fill 0.15s ease, r 0.15s ease;
}

.doc-map-nodes a:hover circle,
.doc-map-nodes a:focus circle {
  fill: var(--color-primary-600);
  r: 6;
}

.doc-map-nodes a:focus-visible circle {
  outline: 2px solid var(--color-primary-600);
  outline-offset: 2px;
}

/* The Diátaxis quadrants are data, not decoration: a typed corpus shows its
   balance at a glance. An untyped document keeps the neutral fill. */
.doc-map-nodes .is-typed-tutorial { fill: var(--color-primary-500); }
.doc-map-nodes .is-typed-how_to { fill: var(--success); }
.doc-map-nodes .is-typed-reference { fill: var(--color-primary-800); }
.doc-map-nodes .is-typed-explanation { fill: var(--warning); }

.doc-map-sections text {
  font-size: 13px;
  font-weight: 600;
  fill: var(--ink);
}

.doc-map-count {
  font-weight: 400;
  fill: var(--muted);
}

.doc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.5rem;
}

.doc-tag {
  font-size: 0.8rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--color-primary-700);
  text-decoration: none;
}

.doc-tag:hover {
  background: rgba(59, 130, 246, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  .doc-map-nodes circle { transition: none; }
}

/* --- Callouts and block directives (Design 22, phase 01) -------------------
   Two syntaxes render to the same visual language:
     "> [!NOTE]"  -> .markdown-alert.markdown-alert-note   (Obsidian + GitHub)
     ":::note"    -> .note                                 (block directive)
   Both are scoped under .markdown-body: a directive's class is just its name,
   so ".warning" must never be a global rule. The hue is one custom property,
   so a new type is one selector rather than a new block. color-mix keeps the
   tint derived from the hue, which means both themes work from the same rule. */
.markdown-body .markdown-alert,
.markdown-body .note,
.markdown-body .tip,
.markdown-body .important,
.markdown-body .warning,
.markdown-body .caution {
  --alert-hue: var(--color-primary-500);
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-left: 4px solid var(--alert-hue);
  border-radius: 0 0.7rem 0.7rem 0;
  background: color-mix(in oklab, var(--alert-hue) 9%, transparent);
}

.markdown-body .markdown-alert > :last-child,
.markdown-body .note > :last-child,
.markdown-body .tip > :last-child,
.markdown-body .important > :last-child,
.markdown-body .warning > :last-child,
.markdown-body .caution > :last-child {
  margin-bottom: 0;
}

.markdown-body .markdown-alert-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--alert-hue);
}

.markdown-body .markdown-alert-tip,
.markdown-body .tip {
  --alert-hue: var(--success);
}

.markdown-body .markdown-alert-important,
.markdown-body .important {
  --alert-hue: var(--color-primary-700);
}

.markdown-body .markdown-alert-warning,
.markdown-body .warning {
  --alert-hue: var(--warning);
}

.markdown-body .markdown-alert-caution,
.markdown-body .caution {
  --alert-hue: var(--danger);
}

/* Wikilinks read as in-corpus references rather than outbound links. The line
   has to be set as well as the style: links carry text-decoration: none, so a
   lone decoration-style would be inert. */
.markdown-body a.wikilink {
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.15em;
}

@media (max-width: 960px) {
  .shell-main {
    margin-left: 0;
  }

  .desktop-sidebar {
    display: none;
  }

  .mobile-sidebar {
    display: block;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }

  .mobile-sidebar.is-open {
    transform: translateX(0);
  }

  .topbar-mobile-toggle {
    display: inline-flex;
  }
}

@media (max-width: 720px) {
  .shell-topbar-inner {
    min-height: 4.5rem;
  }

  .shell-topbar-start {
    flex: 1;
  }

  .topbar-search {
    width: 100%;
  }

  .user-meta {
    display: none;
  }

  .hero,
  .section-header {
    grid-template-columns: 1fr;
  }

  .shell-topbar-inner,
  .container,
  .flash {
    width: min(1400px, calc(100% - 1rem));
  }
}
