/* Barnado design doc set — air-gap-friendly stylesheet
   No external fonts, no CDN, no JS frameworks.
   Optimized for: long-form reading, sidebar nav, embedded SVG. */

:root {
  --bg: #faf8f5;
  --bg-card: #ffffff;
  --bg-sidebar: #f1ede7;
  --bg-code: #f4f0ea;
  --ink: #1a1816;
  --ink-soft: #5a544c;
  --ink-faint: #8a847a;
  --accent: #b8542a;            /* warm rust — matches matte-dark exterior + warm wood interior intent */
  --accent-soft: #e8d4c4;
  --rule: #d8d2c8;
  --green: #2e7d4f;
  --yellow: #c8961c;
  --red: #b53b2c;
  --content-width: 760px;
  --sidebar-width: 280px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1714;
    --bg-card: #221e1a;
    --bg-sidebar: #15120f;
    --bg-code: #2a2520;
    --ink: #f4ece2;
    --ink-soft: #c0b8ad;
    --ink-faint: #8a847a;
    --accent: #d97a4a;
    --accent-soft: #4a3328;
    --rule: #3a342d;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout: sidebar + main */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--rule);
  padding: 24px 20px;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  font-size: 14px;
}

.sidebar h1 {
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 4px 0;
  color: var(--accent);
}

.sidebar .subtitle {
  color: var(--ink-faint);
  font-size: 12px;
  margin-bottom: 20px;
  letter-spacing: 0.02em;
}

.sidebar h2 {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 22px 0 8px 0;
  font-weight: 600;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0 0 12px 0;
}

.sidebar li {
  margin: 0;
  padding: 0;
}

.sidebar a {
  color: var(--ink-soft);
  text-decoration: none;
  display: block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  transition: background 0.1s ease;
}

.sidebar a:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

.sidebar a.current {
  background: var(--accent);
  color: white;
}

.sidebar .ldd-num {
  display: inline-block;
  width: 22px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

main {
  padding: 48px 56px;
  max-width: calc(var(--content-width) + 112px);
  width: 100%;
}

/* Typography */
h1, h2, h3, h4 {
  color: var(--ink);
  font-weight: 600;
  line-height: 1.25;
  margin-top: 1.6em;
  margin-bottom: 0.5em;
}

h1 { font-size: 30px; margin-top: 0; letter-spacing: -0.01em; }
h2 { font-size: 22px; border-bottom: 1px solid var(--rule); padding-bottom: 6px; }
h3 { font-size: 17px; color: var(--accent); }
h4 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }

p { margin: 0.7em 0; }
ul, ol { padding-left: 1.4em; }
li { margin: 0.2em 0; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
a:hover { border-bottom-color: var(--accent); }

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--bg-code);
  padding: 2px 5px;
  border-radius: 3px;
}

pre {
  background: var(--bg-code);
  padding: 14px 16px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid var(--rule);
}
pre code { background: none; padding: 0; }

blockquote {
  border-left: 3px solid var(--accent);
  margin: 1em 0;
  padding: 4px 16px;
  color: var(--ink-soft);
  background: var(--bg-card);
}

/* Header strip on each LDD page */
.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--ink-faint);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.tag.locked   { background: var(--green); color: white; border-color: transparent; }
.tag.draft    { background: var(--yellow); color: white; border-color: transparent; }
.tag.review   { background: var(--accent); color: white; border-color: transparent; }

/* Status pills */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 500;
}

.status.green  { background: var(--green); color: white; }
.status.yellow { background: var(--yellow); color: white; }
.status.red    { background: var(--red); color: white; }

.status::before {
  content: "●";
  font-size: 10px;
}

/* Tables */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  font-size: 14px;
}

th, td {
  border-bottom: 1px solid var(--rule);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--bg-card);
}

tr:hover td { background: var(--bg-card); }

/* Diagrams */
.diagram-wrap {
  margin: 24px 0;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  text-align: center;
}

.diagram-wrap svg {
  max-width: 100%;
  height: auto;
}

.diagram-caption {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 8px;
  text-align: center;
  font-style: italic;
}

/* Section callouts */
.callout {
  margin: 20px 0;
  padding: 16px 20px;
  border-radius: 6px;
  border-left: 4px solid;
}
.callout.concern  { background: rgba(181,59,44,0.07); border-left-color: var(--red); }
.callout.cost     { background: rgba(200,150,28,0.07); border-left-color: var(--yellow); }
.callout.intent   { background: rgba(46,125,79,0.07); border-left-color: var(--green); }
.callout.note     { background: var(--bg-card); border-left-color: var(--ink-faint); }

.callout h4 {
  margin: 0 0 6px 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Scorecard */
.scorecard {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}

.score-row {
  display: grid;
  grid-template-columns: 200px 1fr 80px 50px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 6px;
}

.score-bar {
  height: 8px;
  background: var(--bg-sidebar);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.score-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--red) 0%, var(--yellow) 50%, var(--green) 100%);
  background-size: 1000% 100%;
}

.score-num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
}

.score-weight {
  color: var(--ink-faint);
  font-size: 11px;
  text-align: right;
}

/* Cross-ref boxes */
.crossref {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 16px 0;
}

.crossref > div {
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-size: 13px;
}

.crossref h4 {
  margin: 0 0 4px 0;
  color: var(--ink-faint);
}

/* Big landing scorecard */
.headline-score {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  margin: 24px 0;
}

.headline-score .num {
  font-size: 64px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.headline-score .denom {
  font-size: 24px;
  color: var(--ink-faint);
}

.headline-score .label {
  font-size: 14px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Status board grid */
.status-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.status-board .item {
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-board .item-name {
  font-size: 13px;
  font-weight: 500;
}

.status-board .item-note {
  font-size: 11px;
  color: var(--ink-faint);
}

/* Responsive */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--rule); }
  main { padding: 32px 24px; }
  .score-row { grid-template-columns: 1fr; }
  .crossref { grid-template-columns: 1fr; }
}

footer {
  margin-top: 60px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--ink-faint);
  display: flex;
  justify-content: space-between;
}
