/* Bisso Industrial — navigator.
   Direction: "index spine" — a persistent left spine, type-led, structural
   rules instead of cards, one solar-yellow mark used as a mark and never as text. */

/* ---------- tokens: light is the base, dark redefines only tokens ---------- */
:root {
  --paper:      #f7f7f4;
  --paper-2:    #efefea;
  --ink:        #14161a;
  --ink-2:      #5c6169;
  --ink-3:      #8b9096;
  --rule:       #e0e0d9;
  --rule-2:     #c8c8bf;
  --mark:       #d99e00;   /* solar — rails, nodes, marks only */
  --mark-soft:  #f7e9bf;   /* highlight behind ink text */
  --focus:      #14161a;

  --f-sans: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --t-hero:  clamp(1.9rem, 5vw, 3.1rem);
  --t-h2:    clamp(1.3rem, 2.4vw, 1.7rem);
  --t-h3:    1.02rem;
  --t-body:  1rem;
  --t-sm:    0.875rem;
  --t-label: 0.7rem;

  --sec-gap: clamp(2.75rem, 6vw, 5rem);
  --spine-w: clamp(196px, 19vw, 252px);
  --main-w:  60rem;
  --gut:     clamp(1rem, 3vw, 2.25rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:     #121316;
    --paper-2:   #1a1c20;
    --ink:       #eef0f2;
    --ink-2:     #9aa0a8;
    --ink-3:     #6e747c;
    --rule:      #26292e;
    --rule-2:    #3a3e45;
    --mark:      #f2b21f;
    --mark-soft: rgba(242, 178, 31, 0.18);
    --focus:     #f2b21f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper:     #121316;
  --paper-2:   #1a1c20;
  --ink:       #eef0f2;
  --ink-2:     #9aa0a8;
  --ink-3:     #6e747c;
  --rule:      #26292e;
  --rule-2:    #3a3e45;
  --mark:      #f2b21f;
  --mark-soft: rgba(242, 178, 31, 0.18);
  --focus:     #f2b21f;
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: var(--t-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: 0.6rem 1rem; font-size: var(--t-sm); text-decoration: none;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- shell ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--spine-w) minmax(0, 1fr);
  align-items: start;
  max-width: 96rem;
  margin: 0 auto;
}

/* ---------- spine ---------- */
.spine {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  padding: var(--gut) 1rem var(--gut) var(--gut);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.brand {
  display: flex; align-items: center; gap: 0.55rem;
  text-decoration: none;
}
.brand-mark {
  width: 0.7rem; height: 0.7rem; border-radius: 50%;
  background: var(--mark);
  flex: none;
}
.brand-name {
  font-weight: 700; letter-spacing: -0.015em; font-size: 1.02rem;
}
.brand-sub {
  margin: 0.35rem 0 0;
  font-family: var(--f-mono);
  font-size: var(--t-label);
  letter-spacing: 0.04em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.lang { display: flex; gap: 0.3rem; margin-top: 0.9rem; }
.lang-btn {
  font-family: var(--f-mono);
  font-size: var(--t-label);
  letter-spacing: 0.06em;
  background: none; border: 1px solid var(--rule-2);
  color: var(--ink-2);
  padding: 0.2rem 0.45rem; cursor: pointer;
}
.lang-btn:hover { color: var(--ink); border-color: var(--ink-2); }
.lang-btn.is-active {
  color: var(--ink); border-color: var(--ink);
  background: var(--mark-soft);
}

.spine-nav { display: flex; flex-direction: column; gap: 0.1rem; }
.spine-nav a {
  display: block;
  text-decoration: none;
  color: var(--ink-2);
  font-size: var(--t-sm);
  padding: 0.28rem 0 0.28rem 0.6rem;
  border-left: 2px solid transparent;
}
.spine-nav a:hover { color: var(--ink); border-left-color: var(--rule-2); }
.spine-nav a.is-current {
  color: var(--ink);
  font-weight: 600;
  border-left-color: var(--mark);
}
.spine-nav .nav-sub {
  margin: 0.1rem 0 0.5rem;
  display: flex; flex-direction: column; gap: 0.05rem;
}
.spine-nav .nav-sub a {
  font-family: var(--f-mono);
  font-size: var(--t-label);
  letter-spacing: 0.02em;
  color: var(--ink-3);
  padding-left: 1.35rem;
  border-left-color: transparent;
}
.spine-nav .nav-sub a:hover { color: var(--ink); }
.spine-nav .nav-sub a.is-current { color: var(--ink); border-left-color: var(--rule-2); }

/* ---------- main column ---------- */
.main { min-width: 0; padding: var(--gut) var(--gut) 6rem; }
.wrap { max-width: var(--main-w); }

/* ---------- section frame ---------- */
.sec { padding-top: var(--sec-gap); scroll-margin-top: 1rem; }
.sec:first-child { padding-top: 0; }

.sec-head {
  display: flex; align-items: baseline; gap: 0.7rem;
  padding-bottom: 0.55rem;
  border-bottom: 2px solid var(--ink);
}
.sec-num {
  font-family: var(--f-mono);
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  color: var(--ink-3);
}
.sec-title {
  margin: 0;
  font-size: var(--t-h2);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.sec-note {
  margin: 0.9rem 0 0;
  color: var(--ink-2);
  max-width: 46rem;
  font-size: var(--t-sm);
}

/* ---------- hero ---------- */
.hero { padding-top: 0.5rem; }
.hero h1 {
  margin: 0;
  font-size: var(--t-hero);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.03em;
  max-width: 26ch;
}
.hero-lede {
  margin: 1.1rem 0 0;
  max-width: 44rem;
  color: var(--ink-2);
}
.hero-facts {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem;
  margin-top: 1.6rem; padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
  list-style: none; padding-left: 0;
}
.hero-facts li {
  font-family: var(--f-mono);
  font-size: var(--t-sm);
  color: var(--ink);
}
.hero-facts b { color: var(--ink-3); font-weight: 400; }

/* ---------- index entries (business lines) ---------- */
.entries { display: flex; flex-direction: column; }
.entry {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 1rem;
}
.entry-top {
  display: flex; align-items: baseline; gap: 0.9rem; flex-wrap: wrap;
}
.entry-num {
  font-family: var(--f-mono);
  font-size: var(--t-label);
  color: var(--mark);
  letter-spacing: 0.06em;
  flex: none;
  padding-top: 0.15rem;
}
.entry-name {
  margin: 0; font-size: 1.22rem; font-weight: 700;
  letter-spacing: -0.015em;
}
.entry-tag {
  font-family: var(--f-mono);
  font-size: var(--t-label);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  border: 1px solid var(--rule-2);
  padding: 0.1rem 0.4rem;
}
.entry-body {
  margin: 0.5rem 0 0 2.1rem;
  max-width: 46rem;
  color: var(--ink-2);
  font-size: var(--t-sm);
}
.entry-stat {
  margin: 0.7rem 0 0 2.1rem;
  font-family: var(--f-mono);
  font-size: var(--t-sm);
  color: var(--ink);
}
.entry-docs {
  margin: 0.75rem 0 0 2.1rem;
  display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem;
  list-style: none; padding: 0;
}
.entry-docs a {
  font-size: var(--t-sm);
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--rule-2);
  text-underline-offset: 0.2em;
}
.entry-docs a:hover {
  color: var(--ink);
  background: var(--mark-soft);
  text-decoration-color: var(--ink);
}

/* ---------- waves ---------- */
.waves { list-style: none; margin: 1.4rem 0 0; padding: 0; }
.wave { position: relative; padding: 0 0 1.9rem 1.9rem; }
.wave::before {
  content: ""; position: absolute; left: 0.28rem; top: 0.5rem;
  width: 0.62rem; height: 0.62rem; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--mark);
}
.wave::after {
  content: ""; position: absolute; left: 0.57rem; top: 1.25rem; bottom: 0;
  width: 1px; background: var(--rule-2);
}
.wave:last-child::after { display: none; }
.wave-head { display: flex; align-items: baseline; gap: 0.8rem; flex-wrap: wrap; }
.wave-name { margin: 0; font-size: var(--t-h3); font-weight: 700; }
.wave-when {
  font-family: var(--f-mono);
  font-size: var(--t-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.wave-desc { margin: 0.3rem 0 0; color: var(--ink-2); font-size: var(--t-sm); max-width: 44rem; }

/* ---------- numbers ---------- */
.nums { width: 100%; border-collapse: collapse; margin-top: 1.3rem; }
.nums th {
  text-align: left;
  font-family: var(--f-mono);
  font-size: var(--t-label);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
  font-weight: 500;
  padding: 0 0.9rem 0.5rem 0;
  border-bottom: 1px solid var(--ink);
}
.nums td {
  padding: 0.62rem 0.9rem 0.62rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: baseline;
  font-size: var(--t-sm);
}
.nums td:first-child { font-weight: 500; }
.nums .v {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
.nums .d { color: var(--ink-2); }

/* ---------- library ---------- */
.lib-bar {
  display: flex; align-items: center; gap: 0.8rem;
  margin-top: 1.2rem; padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}
.lib-input {
  font-family: var(--f-mono);
  font-size: var(--t-sm);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule-2);
  padding: 0.45rem 0.6rem;
  min-width: 15rem;
  flex: 1 1 15rem;
}
.lib-count {
  font-family: var(--f-mono);
  font-size: var(--t-label);
  letter-spacing: 0.05em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.lib-group { padding-top: 1.4rem; }
.lib-group h3 {
  margin: 0 0 0.4rem;
  font-family: var(--f-mono);
  font-size: var(--t-label);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.lib-list { list-style: none; margin: 0; padding: 0; }
.lib-list a {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem;
  padding: 0.34rem 0.4rem 0.34rem 0;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  font-size: var(--t-sm);
}
.lib-list .p {
  font-family: var(--f-mono);
  font-size: var(--t-label);
  color: var(--ink-3);
  white-space: nowrap;
  order: 2;
}
.lib-list a:hover { background: var(--mark-soft); }
.lib-list a:hover .p { color: var(--ink-2); }
.lib-empty { color: var(--ink-2); font-size: var(--t-sm); padding: 1.2rem 0; }
[hidden] { display: none !important; }

/* ---------- footer ---------- */
.foot {
  margin-top: var(--sec-gap);
  padding-top: 1.2rem;
  border-top: 2px solid var(--ink);
  font-family: var(--f-mono);
  font-size: var(--t-label);
  letter-spacing: 0.03em;
  color: var(--ink-3);
  text-transform: uppercase;
}

/* ---------- reader ---------- */
.reader-bar {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: 0.9rem var(--gut);
  border-bottom: 1px solid var(--rule);
}
.reader-bar .brand { text-decoration: none; }
.back {
  font-family: var(--f-mono);
  font-size: var(--t-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-2);
}
.back:hover { color: var(--ink); background: var(--mark-soft); }

.md { max-width: 48rem; margin: 0 auto; padding: 2.4rem var(--gut) 5rem; }
.md h1, .md h2, .md h3, .md h4 {
  line-height: 1.18; letter-spacing: -0.02em;
  margin: 1.9em 0 0.5em; text-wrap: balance;
}
.md h1 { font-size: 1.85rem; margin-top: 0; }
.md h2 { font-size: 1.35rem; padding-bottom: 0.3em; border-bottom: 1px solid var(--rule-2); }
.md h3 { font-size: 1.08rem; }
.md p { margin: 0.75em 0; }
.md a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 0.18em; }
.md a:hover { background: var(--mark-soft); text-decoration-color: var(--ink); }
.md ul, .md ol { padding-left: 1.35rem; margin: 0.6em 0; }
.md li { margin: 0.22em 0; }
.md blockquote {
  margin: 1em 0; padding: 0.2em 0 0.2em 1rem;
  border-left: 3px solid var(--mark);
  color: var(--ink-2);
}
.md code {
  font-family: var(--f-mono); font-size: 0.86em;
  background: var(--paper-2); padding: 0.1em 0.34em;
}
.md pre {
  background: var(--paper-2); border: 1px solid var(--rule);
  padding: 0.9em 1rem; overflow-x: auto; line-height: 1.5;
}
.md pre code { background: none; padding: 0; }
.md .tablewrap { overflow-x: auto; margin: 1em 0; }
.md table { border-collapse: collapse; width: 100%; font-size: var(--t-sm); }
.md th, .md td { border: 1px solid var(--rule); padding: 0.45em 0.65em; text-align: left; vertical-align: top; }
.md th { background: var(--paper-2); font-weight: 600; }
.md hr { border: none; border-top: 1px solid var(--rule-2); margin: 1.6em 0; }
.md .raw {
  white-space: pre-wrap; word-break: break-word;
  background: var(--paper-2); border: 1px solid var(--rule);
  padding: 1rem; overflow-x: auto;
}

/* ---------- narrow: spine becomes a top strip ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .spine {
    position: sticky; top: 0; z-index: 20;
    max-height: none; overflow: visible;
    border-right: none; border-bottom: 1px solid var(--rule);
    background: var(--paper);
    padding: 0.7rem var(--gut);
    gap: 0.6rem;
    flex-direction: row; align-items: center; flex-wrap: wrap;
  }
  .spine-top { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
  .brand-sub { display: none; }
  .lang { margin-top: 0; }
  .spine-nav {
    flex-direction: row; flex-wrap: nowrap; overflow-x: auto;
    gap: 0.9rem; width: 100%;
  }
  .spine-nav a { border-left: none; border-bottom: 2px solid transparent; padding: 0.2rem 0; white-space: nowrap; }
  .spine-nav a.is-current { border-left: none; border-bottom-color: var(--mark); }
  .spine-nav .nav-sub { display: none; }
  .main { padding-top: 1.4rem; }
  .entry-body, .entry-stat, .entry-docs { margin-left: 0; }
  .hero-facts { gap: 0.35rem 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
