/* AutoLens Pipeline Explainer — styles. Dark, calm, reference-reading design. */

:root {
  --bg: #121316;
  --bg-elevated: #191b1f;
  --bg-card: #1d2025;
  --bg-inset: #15171b;
  --border: #2b2e34;
  --border-soft: #23262b;
  --text: #e8e8ec;
  --text-dim: #c2c4cb;
  --text-muted: #86888f;
  --accent: #fffc00;
  --accent-soft: rgba(255, 252, 0, 0.12);
  --accent-border: rgba(255, 252, 0, 0.45);

  --ls: #6db2ef;
  --ls-bg: rgba(109, 178, 239, 0.12);
  --ls-border: rgba(109, 178, 239, 0.45);

  --clad: #c39cf0;
  --clad-bg: rgba(195, 156, 240, 0.12);
  --clad-border: rgba(195, 156, 240, 0.45);

  --al: var(--accent);
  --al-bg: var(--accent-soft);
  --al-border: var(--accent-border);

  --radius: 10px;
  --radius-sm: 6px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --nav-w: 240px;
  --content-max: 880px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
  font-size: 16px;
}

h1, h2, h3, h4 { font-family: var(--sans); font-weight: 650; line-height: 1.3; }
h2 { font-size: 1.6rem; margin: 0 0 0.35rem; }
h3 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin: 0 0 0.3rem;
}

p { margin: 0 0 0.75rem; color: var(--text-dim); }

a { color: var(--accent); }
a:hover { text-decoration: none; }

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

/* ---------- header ---------- */

.site-header {
  padding: 2.25rem clamp(1rem, 4vw, 3rem) 1.75rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg));
}

.site-header h1 { font-size: 1.9rem; margin: 0 0 0.5rem; color: var(--text); }

.tagline { font-size: 1.02rem; color: var(--text-dim); max-width: 760px; }

.sync-line {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.sync-line code {
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
}

/* ---------- layout ---------- */

.layout {
  display: flex;
  align-items: flex-start;
  max-width: 1400px;
  margin: 0 auto;
}

.side-nav {
  position: sticky;
  top: 0;
  flex: 0 0 var(--nav-w);
  width: var(--nav-w);
  height: 100vh;
  overflow-y: auto;
  padding: 2rem 1rem 2rem 1.5rem;
  border-right: 1px solid var(--border);
}

.side-nav .nav-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.side-nav ul { list-style: none; margin: 0; padding: 0; }

.side-nav li { margin: 0; }

.side-nav a {
  display: block;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.92rem;
  border-left: 2px solid transparent;
}

.side-nav a:hover {
  color: var(--text);
  background: var(--bg-card);
  border-left-color: var(--accent);
}

main {
  flex: 1;
  min-width: 0;
  padding: 2.5rem clamp(1rem, 4vw, 3rem) 8rem;
}

section {
  max-width: var(--content-max);
  margin: 0 0 4rem;
  scroll-margin-top: 1.5rem;
}

section > .section-intro { margin-bottom: 1.5rem; }

.section-kicker {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.4rem;
}

hr.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
  max-width: var(--content-max);
}

/* ---------- citations ---------- */

.cite {
  display: block;
  margin-top: 0.55rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text-muted);
}

.cite::before { content: "source: "; opacity: 0.7; }

/* ---------- badges (provenance) ---------- */

.badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--sans);
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-ls { background: var(--ls-bg); color: var(--ls); border-color: var(--ls-border); }
.badge-clad { background: var(--clad-bg); color: var(--clad); border-color: var(--clad-border); }
.badge-al { background: var(--al-bg); color: var(--al); border-color: var(--al-border); }

/* ---------- chips ---------- */

.chip {
  display: inline-block;
  padding: 0.14rem 0.55rem;
  margin: 0.15rem 0.3rem 0.15rem 0;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.76rem;
  background: var(--bg-inset);
  color: var(--text-dim);
  border: 1px solid var(--border);
  text-decoration: none;
}

.chip-tool { color: var(--text-dim); }

.chip-hr {
  color: var(--al);
  border-color: var(--al-border);
  background: var(--al-bg);
}

.chip-hr:hover { background: var(--accent); color: #1a1a00; }

.chip-skill-own { color: var(--al); border-color: var(--al-border); background: var(--al-bg); }
.chip-skill-clad { color: var(--clad); border-color: var(--clad-border); background: var(--clad-bg); }

.chip-row { margin: 0.4rem 0 0.9rem; }

.chip-row-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 0.3rem;
}

/* ---------- process-model / provenance flow boxes ---------- */

.flow-col {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 560px;
  margin: 1.25rem 0 1.5rem;
}

.flow-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
}

.flow-box strong { color: var(--text); }

.flow-box span.detail { display: block; color: var(--text-muted); font-size: 0.85rem; margin-top: 0.2rem; }

.flow-arrow {
  text-align: center;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0.35rem 0;
  font-family: var(--mono);
}

/* ---------- provenance layer stack ---------- */

.layer-stack { max-width: var(--content-max); margin: 1.5rem 0; }

.layer {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem 1.4rem;
  background: var(--bg-card);
  border-left-width: 4px;
}

.layer-al { border-left-color: var(--al); }
.layer-clad { border-left-color: var(--clad); }
.layer-ls { border-left-color: var(--ls); }

.layer-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.layer-head h3 { margin: 0; }

.layer ul { margin: 0.4rem 0 0.6rem; padding-left: 1.2rem; }
.layer li { margin-bottom: 0.25rem; color: var(--text-dim); }

.callout {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
}

.callout p:last-child { margin-bottom: 0; }

/* ---------- pipeline phase cards ---------- */

.phase-col { max-width: var(--content-max); }

details.phase-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}

details.phase-card[open] { border-color: var(--border-soft); }

details.phase-card summary {
  cursor: pointer;
  padding: 1.1rem 1.35rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

details.phase-card summary::-webkit-details-marker { display: none; }

.summary-text strong {
  display: block;
  font-size: 1.05rem;
  color: var(--text);
}

.summary-text span {
  display: block;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  font-weight: 400;
}

.summary-caret {
  flex: 0 0 auto;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 1.1rem;
  width: 1.4rem;
  text-align: center;
}

details.phase-card[open] .summary-caret::before { content: "\2212"; }
details.phase-card:not([open]) .summary-caret::before { content: "+"; }

.phase-body {
  padding: 0 1.35rem 1.35rem;
  border-top: 1px solid var(--border);
}

.wh-block { margin-top: 1rem; }

.wh-block p { margin-bottom: 0.35rem; }

.substeps {
  margin: 0.4rem 0 0.6rem;
  padding-left: 1.3rem;
}

.substeps li { margin-bottom: 0.45rem; color: var(--text-dim); }

/* ---------- data-shape stage cards ---------- */

.stage-col { max-width: var(--content-max); }

details.stage-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}

details.stage-card[open] { border-color: var(--border-soft); }

details.stage-card summary {
  cursor: pointer;
  padding: 1.1rem 1.35rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

details.stage-card summary::-webkit-details-marker { display: none; }

details.stage-card[open] .summary-caret::before { content: "\2212"; }
details.stage-card:not([open]) .summary-caret::before { content: "+"; }

.stage-body { padding: 0 1.35rem 1.35rem; border-top: 1px solid var(--border); }

.stage-does { margin-top: 1rem; }
.stage-does p { margin-bottom: 0.35rem; }

pre.type-pre, pre.json-pre {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  overflow-x: auto;
  white-space: pre;
  margin: 0.5rem 0;
}

pre.type-pre { color: var(--text-dim); }
pre.json-pre { color: var(--text); }

.example-block { margin-top: 0.9rem; }

.example-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.example-label { font-size: 0.78rem; color: var(--text-muted); }

.honesty-note { font-size: 0.82rem; color: var(--text-muted); margin: 0.3rem 0 0; }

.cross-links { font-size: 0.82rem; margin-top: 0.8rem; }
.cross-links a { margin-right: 0.75rem; }

.badge-real { background: rgba(84, 209, 133, 0.14); color: #54d185; border-color: rgba(84, 209, 133, 0.45); }
.badge-constructed { background: rgba(255, 179, 71, 0.14); color: #ffb347; border-color: rgba(255, 179, 71, 0.45); }
.badge-loaded { background: rgba(84, 209, 133, 0.14); color: #54d185; border-color: rgba(84, 209, 133, 0.45); }
.badge-excluded { background: rgba(140, 143, 150, 0.14); color: var(--text-muted); border-color: var(--border); }

/* ---------- tables ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.92rem;
}

th, td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--text-muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  background: var(--bg-inset);
}

td { color: var(--text-dim); }

td code, th code { font-family: var(--mono); font-size: 0.85rem; color: var(--text); }

.table-wrap { overflow-x: auto; max-width: var(--content-max); }

/* ---------- hard rule cards ---------- */

.hr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.85rem;
  max-width: var(--content-max);
}

.hr-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  scroll-margin-top: 1.5rem;
}

.hr-card .hr-id {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.82rem;
  display: block;
  margin-bottom: 0.15rem;
}

.hr-card .hr-title { color: var(--text); font-weight: 600; display: block; margin-bottom: 0.35rem; }

.hr-card .hr-prevents { color: var(--text-dim); font-size: 0.9rem; margin: 0; }

.hr-card .hr-prevents strong { color: var(--text-muted); font-weight: 600; }

/* ---------- skills section ---------- */

.skill-row {
  display: grid;
  grid-template-columns: 180px 1fr 220px 100px;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-soft);
  align-items: start;
}

.skill-row:first-child { border-top: 1px solid var(--border-soft); }

.skill-name { font-family: var(--mono); color: var(--text); font-size: 0.92rem; }

.skill-desc p { margin: 0 0 0.3rem; font-size: 0.92rem; }

.skill-gate { color: var(--text-muted); font-size: 0.84rem; }
.skill-gate strong { color: var(--text-dim); font-weight: 600; }

@media (max-width: 820px) {
  .skill-row { grid-template-columns: 1fr; gap: 0.3rem; }
}

/* ---------- own-skills glossary cards (Appendix I) ---------- */

.skill-list { max-width: var(--content-max); margin-bottom: 1.25rem; }

.skill-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.75rem;
}

.skill-item-excluded { border-style: dashed; opacity: 0.9; }

.skill-item-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.skill-item-head .skill-name { font-size: 0.98rem; }

.skill-teaches, .skill-used, .skill-reason { font-size: 0.9rem; margin: 0 0 0.35rem; }
.skill-teaches:last-child, .skill-used:last-child, .skill-reason:last-child { margin-bottom: 0; }
.skill-teaches strong, .skill-used strong, .skill-reason strong { color: var(--text-muted); font-weight: 600; }

/* ---------- agent cards ---------- */

.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.85rem;
  max-width: var(--content-max);
}

.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
}

.agent-card .agent-name { font-family: var(--mono); color: var(--text); font-weight: 600; display: block; }
.agent-card .agent-model { color: var(--text-muted); font-size: 0.78rem; display: block; margin-bottom: 0.4rem; }
.agent-card p { font-size: 0.9rem; margin-bottom: 0.3rem; }

/* ---------- glossary ---------- */

.glossary-item {
  border-bottom: 1px solid var(--border-soft);
  padding: 1.1rem 0;
  scroll-margin-top: 1.5rem;
}

.glossary-item:first-child { border-top: 1px solid var(--border-soft); }

.glossary-item h3 { margin: 0 0 0.35rem; font-family: var(--mono); font-size: 1.05rem; color: var(--accent); }

.glossary-item .matters { color: var(--text-dim); }
.glossary-item .matters strong { color: var(--text-muted); font-weight: 600; }

/* ---------- footgun / note callouts ---------- */

.note {
  background: var(--bg-inset);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin: 1rem 0;
  font-size: 0.9rem;
  color: var(--text-dim);
  max-width: var(--content-max);
}

.note h4 { color: var(--text-muted); }

/* ---------- failure map lead ---------- */

.lead-framing {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.5rem;
  max-width: var(--content-max);
}

.status-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  white-space: nowrap;
}

footer.site-footer {
  max-width: var(--content-max);
  color: var(--text-muted);
  font-size: 0.85rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
  .side-nav { display: none; }
  main { padding: 2rem 1.25rem 6rem; }
}
