/* ============================================================
   Facile Documentation — Andon Board design system (propagated)
   Shared with the Facile Deployer and Facile Apps: warm paper
   ground, ink, Ping crimson as the single committed color, amber
   as the one warning accent, vermilion reserved for faults.
   Archivo for display and UI; IBM Plex Mono for anything the
   machine reports.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* ground and ink */
  --paper: #f4f2ec;
  --card: #ffffff;
  --steel: #eceae2;
  --ink: #191d1f;
  --ink-2: #4c5457;
  --ink-3: #666f72;
  --line: #d9d6cc;
  --line-soft: #e6e3d9;

  /* andon signals */
  --green: #e8114b;        /* Ping crimson — brand, ready, go */
  --green-deep: #b00d3a;   /* deep crimson — offsets, success state */
  --green-wash: rgba(232, 17, 75, 0.12);
  --amber: #d9930d;
  --red: #c23b2e;          /* vermilion — faults and errors ONLY, never brand */
  --blue: #1f5fa8;

  /* lamps */
  --lamp-off: #c8c5bb;

  /* factory chrome */
  --bar: #191d1f;
  --bar-ink: #f4f2ec;

  /* field ground */
  --field-ground: #fbfaf7;

  /* elevation: flat, offset, stacked paper — never a glow */
  --shadow-card: 0 2px 0 rgba(25, 29, 31, 0.06), 0 14px 30px rgba(25, 29, 31, 0.07);
  --shadow-button: 0 3px 0 var(--green-deep), 0 12px 22px rgba(232, 17, 75, 0.26);
  --radius: 6px;
  --radius-sm: 4px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
}

/* Browser chrome the page did not draw still carries the design */
::selection { background: var(--green); color: #fff; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 2px; }
::marker { color: var(--ink-3); }

h1, h2, h3, h4, h5, h6 {
  margin: 2em 0 0.6em;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--ink);
  text-wrap: balance;
}
h1:first-child, h2:first-child, h3:first-child { margin-top: 0; }
h1 { font-size: 2.25rem; line-height: 1.08; }
h2 { font-size: 1.55rem; padding-bottom: 0.35em; border-bottom: 1px solid var(--line-soft); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }
h5 { font-size: 0.9rem; }
h6 { font-size: 0.8rem; }

p { margin: 0 0 1em; color: var(--ink-2); }
strong { color: var(--ink); font-weight: 700; }

a { color: var(--green-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

hr { border: none; border-top: 1px dashed var(--line); margin: 2em 0; }

.mono { font-family: 'IBM Plex Mono', ui-monospace, 'Courier New', monospace; }

code {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.86em;
  background: var(--steel);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--ink);
}

pre {
  background: var(--field-ground);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  overflow-x: auto;
  margin: 1.25em 0;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.7;
  letter-spacing: 0.02em;
  color: var(--ink);
}
pre code { background: none; padding: 0; font-size: inherit; }

/* the machine's scrollbar is part of the machine */
pre::-webkit-scrollbar { height: 10px; }
pre::-webkit-scrollbar-track { background: transparent; }
pre::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; border: 2px solid var(--field-ground); }
pre::-webkit-scrollbar-thumb:hover { background: #c4c1b5; }

/* ------------------------------------------------------------
   Factory header bar
   ------------------------------------------------------------ */

.factory-bar {
  height: 66px;
  background: var(--bar);
  color: var(--bar-ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
}
.factory-bar .brandmark { display: flex; align-items: center; gap: 12px; }
.factory-bar .badge-f {
  width: 30px; height: 30px;
  background: var(--green);
  border-radius: 4px;
  display: grid; place-items: center;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600; font-size: 13px; color: #fff;
  text-decoration: none;
}
.factory-bar .badge-f:hover { text-decoration: none; }
.factory-bar .wordmark {
  font-weight: 800; font-size: 19px; letter-spacing: 0.06em;
  color: var(--bar-ink); text-decoration: none;
}
.factory-bar .wordmark:hover { text-decoration: none; color: var(--bar-ink); }
.factory-bar .bar-page {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px; letter-spacing: 0.06em;
  color: var(--bar-ink);
  border: 1px solid #3a4145;
  padding: 7px 14px; border-radius: 3px;
  max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.factory-bar .bar-page b { color: #f58ba6; font-weight: 600; }

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

.wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 40px 72px;
}

.doc-grid {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.lane {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--green);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: break-word;
}

.panel-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-3);
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-label .ok { color: var(--green); }

/* sidebar nav lane */
.manual-lane { padding: 24px 20px; position: sticky; top: 24px; max-height: calc(100vh - 120px); overflow-y: auto; }
.manual-lane::-webkit-scrollbar { width: 10px; }
.manual-lane::-webkit-scrollbar-track { background: transparent; }
.manual-lane::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; border: 2px solid #fff; }

.doc-lane { padding: 36px 44px 44px; }

/* ------------------------------------------------------------
   Sidebar navigation — the manual's table of contents
   ------------------------------------------------------------ */

.manual-lane nav ul {
  list-style: none;
  margin: 0; padding: 0;
}
.manual-lane nav ul ul {
  padding-left: 0;
  margin: 0 0 4px;
}
.manual-lane nav li { margin: 0; }

/* top-level sections: mono stamped labels */
.manual-lane nav > ul > li > a {
  display: flex; align-items: center; gap: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-2);
  padding: 10px 8px 8px;
  margin-top: 6px;
  border-bottom: 1px dashed var(--line);
  border-radius: 0;
}
.manual-lane nav > ul > li:first-child > a { margin-top: 0; }
.manual-lane nav > ul > li > a:hover {
  color: var(--green-deep);
  text-decoration: none;
  background: none;
}

/* nested pages: human voice, indented under their section */
.manual-lane nav ul ul li a,
.manual-lane nav ul ul ul li a {
  display: block;
  font-family: 'Archivo', sans-serif;
  font-size: 14px;
  color: var(--ink-2);
  padding: 5px 8px 5px 20px;
  border-radius: var(--radius-sm);
  position: relative;
}
.manual-lane nav ul ul ul li a { padding-left: 36px; }
.manual-lane nav ul ul li a::before {
  content: '';
  position: absolute; left: 8px; top: 50%;
  width: 6px; height: 1px;
  background: var(--line);
}
.manual-lane nav ul ul ul li a::before { left: 24px; }
.manual-lane nav ul ul li a:hover {
  color: var(--green-deep);
  background: var(--field-ground);
  text-decoration: none;
}
.manual-lane nav a.nav-active {
  color: var(--green-deep) !important;
  background: var(--green-wash);
  font-weight: 600;
}
.manual-lane nav a.nav-active::before { background: var(--green); width: 10px; }

/* ------------------------------------------------------------
   Markdown body details
   ------------------------------------------------------------ */

.doc-lane ul, .doc-lane ol { margin: 0 0 1em; padding-left: 1.6em; }
.doc-lane li { margin-bottom: 0.4em; color: var(--ink-2); }
.doc-lane li strong { color: var(--ink); }
.doc-lane li::marker { color: var(--ink-3); }

.doc-lane blockquote {
  margin: 1.25em 0;
  padding: 12px 16px;
  background: var(--field-ground);
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--green);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-2);
  font-style: normal;
}
.doc-lane blockquote p:last-child { margin-bottom: 0; }

.doc-lane img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin: 1.25em 0;
  background: #fff;
}
img[src*="#flow"] { width: 100%; }

.doc-lane table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 14px;
  background: var(--card);
}
.doc-lane th {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  text-align: left;
  color: var(--ink-2);
  background: var(--steel);
  padding: 9px 12px;
  border-bottom: 2px solid var(--line);
}
.doc-lane td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2);
  vertical-align: top;
}
.doc-lane tr:last-child td { border-bottom: 1px solid var(--line); }
.doc-lane tbody tr:hover td { background: var(--field-ground); }

.doc-lane details {
  margin: 1.25em 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
}
.doc-lane details summary {
  cursor: pointer; user-select: none; list-style: none;
  display: flex; align-items: center; gap: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-2);
  padding: 10px 14px;
}
.doc-lane details summary::-webkit-details-marker { display: none; }
.doc-lane details summary::before {
  content: '';
  width: 8px; height: 8px;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(-45deg);
  transition: transform 140ms ease-out;
  flex: none;
}
.doc-lane details[open] summary::before { transform: rotate(45deg); }
.doc-lane details[open] summary { border-bottom: 1px dashed var(--line); }
.doc-lane details > *:not(summary) { padding: 0 14px; }

/* release lists */
.release-list { list-style: none; padding: 0; margin: 0; }
.release-list li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: 11px 4px;
  border-bottom: 1px dashed var(--line);
  margin: 0;
}
.release-list li:last-child { border-bottom: none; }
.release-date {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px; letter-spacing: 0.06em;
  color: var(--ink-3); white-space: nowrap;
}

/* ------------------------------------------------------------
   Responsive law: 980px stack / 640px single column
   ------------------------------------------------------------ */

@media (max-width: 980px) {
  .wrap { padding: 28px 24px 56px; }
  .doc-grid { grid-template-columns: 1fr; }
  .manual-lane { position: static; max-height: none; }
  .factory-bar { padding: 0 20px; }
  .doc-lane { padding: 26px 26px 34px; }
}

@media (max-width: 640px) {
  .wrap { padding: 20px 14px 48px; }
  .doc-lane { padding: 20px 16px 26px; }
  .factory-bar { padding: 0 14px; }
  .factory-bar .bar-page { display: none; }
  h1 { font-size: 1.7rem; }
}

/* ------------------------------------------------------------
   Motion: one authored entrance, everything else 140ms states
   ------------------------------------------------------------ */

@keyframes lane-settle {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.lane { animation: lane-settle 420ms cubic-bezier(0.16, 1, 0.3, 1) both; }

@media (prefers-reduced-motion: reduce) {
  .lane { animation: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
