/* fuego-systheme — the system atlas look: light, structural, family-tinted. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #dde1e6;
  --text: #21272a;
  --muted: #697077;
  --accent: #0f62fe;
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, monospace;

  --c-api: #0f62fe;
  --c-data: #007d79;
  --c-tests: #8a3ffc;
  --c-infra: #ff832b;
  --c-containers: #1192e8;
  --c-decisions: #d02670;
  --c-diagrams: #6929c4;
  --c-docs: #697077;

  --green: #24a148;
  --orange: #ba4e00;
  --red: #da1e28;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

code, .mono { font-family: var(--mono); font-size: 0.875em; }

/* Links wear the ink color with a soft permanent underline; hover shifts to
   the accent — no bare-blue, no popping underlines. Navigational surfaces
   (topbar, tree, cards, code views) opt out of the underline below. */
a {
  color: inherit;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: #b9c2cf;
  text-underline-offset: 3px;
  transition: color 0.1s ease, text-decoration-color 0.1s ease;
}
a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.topbar a, .tree-file, .entry-list a, .rail-title, .rail-foot a, .yaml-doc a,
.term, .ref-list a, .decision-list a, .row a, footer a {
  text-decoration: none;
}
.yaml-doc .y-link { color: var(--accent); font-weight: 400; }
.row a, .entry-list a, .decision-list a { color: var(--text); }
.row a:hover, .entry-list a:hover, .decision-list a:hover { color: var(--accent); }

/* ---- chrome ---- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
}
.topbar nav { display: flex; align-items: center; gap: 1.25rem; height: 3.25rem; max-width: 1100px; margin: 0 auto; }
.topbar .site-name { font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.topbar .spacer { flex: 1; }
.topbar a { color: var(--muted); font-size: 0.9rem; }
.topbar a:hover { color: var(--text); text-decoration: none; }

.shell {
  flex: 1;
  display: flex;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  align-items: stretch;
}
main { flex: 1; min-width: 0; max-width: 920px; padding: 2.5rem 2rem; }

/* ---- repo file tree (JetBrains-flavored) ---- */

.filetree {
  width: 264px;
  flex: none;
  border-right: 1px solid var(--border);
  padding: 1.25rem 0.6rem 2rem;
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-y: auto;
  user-select: none;
}
.filetree nav { position: sticky; top: 1rem; }

.tree-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-row:hover { background: #eceef1; }

.tree-dir > summary { list-style: none; cursor: pointer; color: var(--text); font-weight: 500; }
.tree-dir > summary::-webkit-details-marker { display: none; }
.tree-dir > summary .tree-row::before {
  content: "";
  flex: none;
  width: 0;
  height: 0;
  border-left: 5px solid var(--muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.12s ease;
}
.tree-dir[open] > summary .tree-row::before { transform: rotate(90deg); }

.tree-children { margin-left: 0.85rem; border-left: 1px solid var(--border); padding-left: 0.35rem; }

.tree-file { display: block; color: var(--text); }
.tree-file:hover { text-decoration: none; }
.tree-file .tree-row::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--border);
}
.ft-openapi    .tree-row::before { background: var(--c-api); }
.ft-dbml       .tree-row::before { background: var(--c-data); }
.ft-playwright .tree-row::before { background: var(--c-tests); }
.ft-k8s        .tree-row::before { background: var(--c-infra); }
.ft-docker     .tree-row::before { background: var(--c-containers); }
.ft-adr        .tree-row::before { background: var(--c-decisions); }
.ft-mermaid    .tree-row::before { background: var(--c-diagrams); }
.ft-md         .tree-row::before { background: var(--c-docs); }
.tree-file.is-current .tree-row { background: #e3edff; color: var(--accent); font-weight: 600; }
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .filetree { width: auto; border-right: none; border-bottom: 1px solid var(--border); }
}

footer {
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.kicker {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.page-title { font-size: 1.9rem; line-height: 1.25; letter-spacing: -0.02em; margin-bottom: 0.75rem; }
.page-title.mono { font-family: var(--mono); font-size: 1.5rem; }

.lede { color: var(--muted); margin-bottom: 1.5rem; max-width: 46rem; }
.pre-line { white-space: pre-line; }

/* ---- landing page ---- */

main:has(.repo-home) { max-width: 1080px; }
.repo-home .lede { margin-bottom: 2rem; }

/* Keep the header clear of the fixed decision card: when the rail exists,
   title, lede, and the .gitignore stay within the main column's width. */
@media (min-width: 1081px) {
  .repo-home:has(.decision-rail) > .page-title,
  .repo-home:has(.decision-rail) > .lede,
  .repo-home:has(.decision-rail) > .gitignore {
    max-width: calc(100% - 300px - 1.75rem);
  }
}

.home-cols { display: flex; gap: 1.75rem; align-items: flex-start; }
.home-main { flex: 1; min-width: 0; }

.decision-rail { width: 300px; flex: none; }
/* Fixed to the viewport (the rail div reserves the column; with no
   left/right offset a fixed box keeps its static x-position), so the card
   follows the scroll — and scrolls internally if it outgrows the screen. */
.decision-card {
  position: fixed;
  top: 4.75rem;
  width: 300px;
  max-height: calc(100vh - 7.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(20, 30, 50, 0.06);
  padding: 1rem 1.15rem 0.8rem;
  scrollbar-width: thin;
}
.decision-card::-webkit-scrollbar { width: 6px; }
.decision-card::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.rail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.35rem; }
.rail-head h2 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}
.rail-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--c-decisions);
  background: #fdeff5;
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
}
.rail-group {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0.75rem 0 0.15rem;
}
.rail-list { list-style: none; }
.rail-decision { padding: 0.45rem 0.1rem; }
.rail-decision + .rail-decision { border-top: 1px solid #eef0f3; }
.rail-decision.is-open {
  border-left: 2px solid var(--orange);
  padding-left: 0.6rem;
  border-top: none;
}
.rail-top { display: flex; align-items: baseline; gap: 0.45rem; margin-bottom: 0.1rem; }
.rail-top .adr-num { font-size: 0.72rem; }
.rail-date, .rail-deadline { font-size: 0.72rem; color: var(--muted); }
.rail-deadline { color: var(--orange); font-weight: 600; }
.rail-decision .status { font-size: 0.62rem; padding: 0.02rem 0.4rem; }
.rail-title {
  display: block;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text);
}
.rail-title:hover { color: var(--accent); }
.rail-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.8rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
}
.rail-foot a { color: var(--muted); font-weight: 600; }
.rail-foot a:hover { color: var(--accent); }

@media (max-width: 1080px) {
  .home-cols { flex-direction: column; }
  .decision-rail { width: 100%; }
  .decision-card { position: static; width: auto; max-height: none; }
}
.home-sec { margin-bottom: 2.75rem; }
.sec-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  margin-bottom: 0.9rem;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.module {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
}
.module header { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.module h3 { font-size: 0.95rem; }
.module-chips { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.entry-list { list-style: none; }
.entry-list li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}
.entry-list li a { flex: 1; min-width: 0; }

.type-chip {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
}
.type-openapi    { color: var(--c-api); }
.type-dbml       { color: var(--c-data); }
.type-playwright { color: var(--c-tests); }
.type-k8s        { color: var(--c-infra); }
.type-docker     { color: var(--c-containers); }
.type-adr        { color: var(--c-decisions); }
.type-mermaid    { color: var(--c-diagrams); }

.gitignore { margin: -1rem 0 1.75rem; font-size: 0.8rem; }
.gitignore summary { color: var(--muted); cursor: pointer; width: fit-content; }
.gitignore summary:hover { color: var(--text); }
.gitignore pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
  color: var(--muted);
}

/* README panel: open by default, the × collapses it to just the title. */
.readme-panel { margin-bottom: 2.75rem; }
.readme-panel > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.readme-panel > summary::-webkit-details-marker { display: none; }
.readme-panel > summary .sec-title { flex: 1; margin-bottom: 0.9rem; }
.panel-toggle { color: var(--muted); font-size: 1.05rem; line-height: 1; }
.panel-toggle::before { content: "+"; }
.readme-panel[open] .panel-toggle::before { content: "×"; }
.panel-toggle:hover { color: var(--text); }

.decision-list { list-style: none; }
.decision-list li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.4rem 0.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.decision-list-open { margin-bottom: 0.75rem; }
.decision-list-open li { background: #fffdf4; }
.adr-num { color: var(--muted); font-size: 0.8rem; }
.decision-date { color: var(--muted); font-size: 0.8rem; }
.decision-retired { margin-top: 0.6rem; font-size: 0.85rem; color: var(--muted); }
.decision-group { margin-bottom: 1.75rem; }
.decision-group .sec-title { border-bottom: none; padding-bottom: 0; }

.readme {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem 1.75rem;
}

/* ---- yaml-shaped API index ---- */

.yaml-doc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.4rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.75;
  overflow-x: auto;
}
.y-line { white-space: nowrap; }
.y-i1 { padding-left: 1.6rem; }
.y-i2 { padding-left: 3.2rem; }
.y-key { color: var(--c-decisions); }
.y-str { color: var(--text); }
.y-path { color: var(--c-api); font-weight: 600; }
.y-comment { color: var(--muted); }
.y-link { color: var(--accent); }
.y-method { font-weight: 700; text-transform: lowercase; }
.y-method-GET    { color: var(--green); }
.y-method-POST   { color: var(--accent); }
.y-method-PUT    { color: var(--orange); }
.y-method-PATCH  { color: var(--c-diagrams); }
.y-method-DELETE { color: var(--red); }
.y-line.is-deprecated .y-method, .y-line.is-deprecated .y-comment { text-decoration: line-through; }

.erd-canvas { margin-bottom: 1.5rem; }

/* ---- rows: the structural unit of artifact pages ---- */

.row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.45rem 0.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.row-key { font-weight: 600; }
.row-note { color: var(--muted); flex: 1; min-width: 8rem; }
.row-end { margin-left: auto; color: var(--muted); }
.rel-arrow { color: var(--muted); font-size: 0.8rem; }

.ref-list { list-style: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}
.card h3 { font-size: 0.95rem; margin-bottom: 0.5rem; }
.card .row:last-child { border-bottom: none; }

/* ---- chips & statuses ---- */

.meta-chip {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}
.meta-deadline { border-color: var(--orange); color: var(--orange); }

.status {
  display: inline-block;
  padding: 0.05rem 0.55rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.status-accepted   { background: #defbe6; color: var(--green); }
.status-proposed   { background: #edf5ff; color: var(--accent); }
.status-tbd        { background: #fff8e1; color: var(--orange); }
.status-deprecated,
.status-superseded { background: #f4f4f4; color: var(--muted); text-decoration: line-through; }
.status-required   { background: #fff1f1; color: var(--red); text-transform: lowercase; }
.status-pk         { background: #f6f2ff; color: var(--c-tests); }
.status-skip, .status-fixme { background: #fff8e1; color: var(--orange); text-transform: lowercase; }
.status-slow, .status-only  { background: #edf5ff; color: var(--accent); text-transform: lowercase; }
.status-ref   { background: #e5f6ff; color: var(--c-containers); }
.status-count { background: #edf5ff; color: var(--accent); }
.status-stage { background: #e5f6ff; color: var(--c-containers); text-transform: none; }

/* ---- API ---- */

.method {
  display: inline-block;
  min-width: 3.6rem;
  text-align: center;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: var(--muted);
}
.method-GET    { background: var(--green); }
.method-POST   { background: var(--accent); }
.method-PUT    { background: var(--orange); }
.method-PATCH  { background: var(--c-diagrams); }
.method-DELETE { background: var(--red); }

.op-title { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.op-path { font-size: 1.2rem; }
.op-ref.is-deprecated .op-path { text-decoration: line-through; color: var(--muted); }
.op-summary { font-weight: 600; margin-bottom: 0.25rem; }

.deprecated-banner {
  background: #fff8e1;
  border: 1px solid var(--orange);
  color: var(--orange);
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

.status-code {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
  min-width: 2.6rem;
}
.sc-200, .sc-201, .sc-202, .sc-204 { color: var(--green); }
.sc-404, .sc-400, .sc-429 { color: var(--orange); }
.sc-500, .sc-503 { color: var(--red); }

/* ---- ADR ---- */

.adr-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.adr-supersession {
  display: flex; gap: 1.5rem; flex-wrap: wrap;
  font-size: 0.85rem; color: var(--muted);
  border-left: 3px solid var(--border);
  padding-left: 0.9rem;
  margin-bottom: 1.25rem;
}
.adr-footer { margin-top: 2rem; font-size: 0.85rem; color: var(--muted); }
.adr-footer code { margin-right: 0.4rem; }

/* ---- Dockerfile ---- */

.dockerfile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  font-size: 0.9rem;
}
.docker-stage {
  display: flex; align-items: baseline; gap: 0.6rem;
  padding: 0.5rem 0.25rem 0.3rem;
  border-top: 2px solid var(--border);
  margin-top: 0.5rem;
}
.docker-stage:first-child { border-top: none; margin-top: 0; }
.docker-line { display: flex; align-items: baseline; gap: 0.75rem; padding: 0.18rem 0.25rem; }
.docker-kw { font-family: var(--mono); font-size: 0.75rem; font-weight: 700; color: var(--c-containers); min-width: 5.5rem; }
.docker-args { white-space: pre-wrap; word-break: break-word; }
.docker-comment { color: var(--muted); font-style: italic; font-size: 0.85rem; }

/* ---- diagrams ---- */

.diagram-canvas {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  overflow-x: auto;
}
.diagram-canvas .mermaid { display: flex; justify-content: center; width: 100%; }

/* ---- taxonomy ---- */

.term-cloud { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.term {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.9rem;
  font-size: 0.9rem;
}
.term:hover { border-color: var(--accent); text-decoration: none; }
.term-count { color: var(--muted); font-size: 0.8rem; }

/* ---- playwright ---- */

.titlepath { color: var(--muted); font-size: 0.85rem; }
.chip-test { border-color: var(--c-tests); color: var(--c-tests); }

/* ---- prose (markdown) ---- */

.prose { max-width: 46rem; }
.prose h1, .prose h2, .prose h3 { letter-spacing: -0.01em; margin: 1.6rem 0 0.6rem; }
.prose h1:first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin-bottom: 0.9rem; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  margin-bottom: 0.9rem;
}
.prose blockquote { border-left: 3px solid var(--border); padding-left: 1rem; color: var(--muted); }
.prose table { border-collapse: collapse; margin-bottom: 0.9rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 0.35rem 0.7rem; font-size: 0.9rem; }
.prose th { background: var(--surface); }

.yaml-block {
  background: var(--bg);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  font-family: var(--mono);
  white-space: pre;
}
