/* NaviBus case study. Loaded after styles.css. Page-only pieces:
   1. Survey stats and charts   2. User flow   3. Competitor marks   4. Colour sheet
   Phone rows, small pull quotes and frame labels now come from styles.css. */

:root {
  --nb-primary: #00b4bc;   /* her primary (non-text on paper) */
  --nb-secondary: #5b5fcd; /* her secondary */
  --nb-bar: var(--navibus-bg); /* the plain bars of the charts: her navy by day, a pale cream in the evening */
}

/* 1. Survey: stat strip, bar charts, stacked bar */
.nb-stats {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
}
.nb-stats > div { padding: 0.5rem 1rem 1rem 0; display: grid; gap: 0.55rem; align-content: start; }
.nb-stats dt { order: 2; font-size: var(--text-sm); line-height: 1.4; color: var(--ink-2); }
.nb-stats dd {
  order: 1; font-family: var(--font-sans); font-weight: var(--w-bold);
  font-size: clamp(2.25rem, 1.5rem + 2.3vw, 3.25rem); line-height: 0.85; letter-spacing: var(--track-display); white-space: nowrap;
}
@media (min-width: 720px) {
  .nb-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--gap); }
}

.nb-chart { display: grid; gap: 1rem; }
.nb-chart__head { display: grid; gap: 0.2rem; }
.nb-chart__title { font-family: var(--font-sans); font-weight: var(--w-bold); font-size: 1.0625rem; line-height: 1.2; letter-spacing: -0.02em; }
.nb-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.nb-bars li {
  display: grid; align-items: center; column-gap: 0.75rem; row-gap: 0.3rem;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "label val" "bar bar";
  font-size: 0.9375rem; line-height: 1.3;
}
.nb-bars__label { grid-area: label; }
.nb-bars__val { grid-area: val; font-variant-numeric: tabular-nums; font-size: var(--text-sm); white-space: nowrap; color: var(--ink-2); }
.nb-bars__val b { color: var(--ink); font-weight: 500; }
.nb-bars__bar { grid-area: bar; height: 0.75rem; background: rgb(0 0 0 / 0.07); border-radius: 2px; position: relative; }
.nb-bars__bar::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--v) * 1%);
  background: var(--nb-bar); border-radius: 2px;
}
.nb-bars .is-top .nb-bars__bar::after { background: var(--nb-primary); }
.nb-bars .is-top .nb-bars__label { font-weight: 600; }

.nb-stack { list-style: none; margin: 0; padding: 0; display: flex; gap: 3px; }
.nb-stack li { flex: 0 0 calc(var(--v) * 1% - 3px); min-width: 0; display: grid; gap: 0.45rem; align-content: start; font-size: 0.9375rem; line-height: 1.3; }
.nb-stack li::before { content: ""; height: 2.25rem; background: var(--c); border-radius: 2px; }
.nb-stack b { display: block; font-variant-numeric: tabular-nums; font-weight: 500; font-size: var(--text-sm); }

/* 2. User flow: white outlined nodes on navy, like her original */
.nb-flow { color: #fff; font-size: 0.9375rem; line-height: 1.3; }
.nb-flow ul, .nb-flow ol { list-style: none; margin: 0; padding: 0; }
.nb-node {
  display: inline-block; border: 1.5px solid rgb(255 255 255 / 0.8); border-radius: 6px;
  padding: 0.4rem 0.75rem; background: var(--navibus-bg);
}
.nb-node--root { font-weight: 600; }
.nb-node--tab { border-color: var(--navibus-ink); color: var(--navibus-ink); font-weight: 600; }
/* Phones: an indented tree with one spine per level.
   720px and up: Start app and Home centred, the four tabs as columns under one bar. */
.nb-flow { --line: 1.5px solid rgb(255 255 255 / 0.5); }
.nb-flow__root { display: grid; justify-items: start; gap: 1.1rem; }
.nb-flow__root > li { justify-self: stretch; }
.nb-flow__root > .nb-node { position: relative; }
.nb-flow__root > .nb-node::after { /* down connector */
  content: ""; position: absolute; left: 0.9rem; top: 100%; height: 1.1rem; border-left: var(--line);
}
.nb-flow__tabs, .nb-flow__kids {
  display: grid; gap: 0.5rem;
  margin-left: 0.9rem !important; padding-left: 0.9rem !important; border-left: var(--line);
}
.nb-flow__tabs { gap: 1rem; }
.nb-flow__tabs > li, .nb-flow__kids > li { display: grid; justify-items: start; gap: 0.5rem; align-content: start; position: relative; }
.nb-flow__tabs > li::before, .nb-flow__kids > li::before {
  content: ""; position: absolute; left: -0.9rem; top: 1.05rem; width: 0.9rem; border-top: var(--line);
}
/* Complaint: Private and Public join into one Confirmation, as in her diagram */
.nb-flow__joinrow { display: flex; align-items: center; }
.nb-flow__kids--join { position: relative; grid-template-columns: max-content; padding-right: 1.4rem !important; }
.nb-flow__kids--join > li { justify-items: stretch; }
.nb-flow__kids--join .nb-node { text-align: center; }
.nb-flow__kids--join::after { /* bracket joining the two branches */
  content: ""; position: absolute; right: 0.5rem; top: 1.05rem; bottom: 1.05rem; width: 0.9rem;
  border: var(--line); border-left: 0;
}
.nb-flow__join { position: relative; margin: 0 0 0 0.5rem; }
.nb-flow__join::before { content: ""; position: absolute; right: 100%; top: 50%; width: 1rem; border-top: var(--line); }
@media (min-width: 720px) {
  .nb-flow__root { justify-items: center; }
  .nb-flow__root > .nb-node::after { left: 50%; }
  .nb-flow__tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--gap); justify-self: stretch;
    margin-left: 0 !important; padding-left: 0 !important; border-left: 0;
    padding-top: 1.1rem !important; position: relative;
  }
  .nb-flow__tabs::before { /* bar joining the four tabs */
    content: ""; position: absolute; top: 0; left: 1.5rem;
    right: calc((100% - 3 * var(--gap)) / 4 - 1.5rem); border-top: var(--line);
  }
  .nb-flow__tabs > li::before { left: 1.5rem; top: -1.1rem; width: 0; height: 1.1rem; border-top: 0; border-left: var(--line); }
}

/* 3. Competitor table marks */
.nb-compare th[scope="col"]:not(:first-child), .nb-compare td { text-align: center; padding-right: 0.5rem; padding-left: 0.5rem; }
.nb-compare td { white-space: nowrap; }
.nb-mark { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.9375rem; }
.nb-mark::before {
  content: ""; width: 0.7rem; height: 0.7rem; border-radius: 50%; flex: none;
  border: 2px solid var(--ink);
}
.nb-mark--yes::before { background: var(--ink); }
.nb-mark--part::before { background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); }
.nb-mark--no { color: var(--ink-3); }
.nb-mark--no::before { border-color: var(--ink-3); }
.nb-compare .is-us { background: rgb(0 0 0 / 0.04); }
.nb-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; margin-top: 0.75rem; font-size: var(--text-xs); text-transform: none; letter-spacing: 0; }
.nb-legend .nb-mark { font-size: inherit; }

/* 4. Colour sheet (the type specimens are a crop of her board, so no fourth font is loaded) */
.nb-swatches { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.nb-swatches li { display: grid; gap: 0.4rem; font-size: 0.9375rem; line-height: 1.3; }
.nb-swatches li::before { content: ""; aspect-ratio: 16 / 9; border-radius: 3px; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12); }
.nb-swatches b { font-weight: 600; }
.nb-swatches span { font-variant-numeric: tabular-nums; font-size: var(--text-sm); color: var(--ink-2); }
@media (min-width: 720px) {
  .nb-swatches { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
  .nb-swatches { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .nb-swatches li::before { aspect-ratio: 1 / 1; }
}

/* Phones: the competitor table keeps only its marks; the legend below names them */
@media (max-width: 719px) {
  .nb-compare .nb-mark { font-size: 0; gap: 0; }
  .nb-compare th[scope="col"] { font-size: 0.6875rem; letter-spacing: 0.03em; }
  .nb-compare th[scope="col"]:not(:first-child), .nb-compare td { padding-left: 0.25rem; padding-right: 0.25rem; }
  .nb-swatches li::before { aspect-ratio: 3 / 1; }
}

/* Evening. The charts, the table and the swatches are drawn here, not her images, so they follow
   the light: navy bars would vanish on the dark well. Teal and violet (her colours) stay. */
html[data-room="evening"] { --nb-bar: #d6ccbc; }   /* v9.1: paler, so "Daily" reads apart from the grey "Rarely" (#9e9e9e) */
html[data-room="evening"] .nb-bars__bar { background: var(--hover); }
html[data-room="evening"] .nb-compare .is-us { background: rgb(243 236 223 / 0.06); }
html[data-room="evening"] .nb-swatches li::before { box-shadow: inset 0 0 0 1px rgb(255 236 210 / 0.2); }
html[data-room="evening"] .nb-node { background: var(--frame-bg); }   /* the node sits on the board, which is dimmed with the screens */
