/* Second Line — primer pages.
   Extends style.css. Used by map.html.

   Three diagrams live here and all three are built from hairlines, the grid and
   the existing four colours. No SVG, no images: the labels stay real text, so
   they print, they reflow on a phone, and they can be edited without opening a
   drawing program. */

.map { padding: 40px 0 24px; }
.map + .map { padding-top: 8px; }

.map > .wrap > p.lead {
  font-size: 16px;
  max-width: 66ch;
  margin: 18px 0 0;
}

.map > .wrap > p.lead + p.lead { margin-top: 14px; }

/* ---------- The licence chain ----------
   Why any of this reaches a bank at all. Numbered rather than arrowed: the
   checklist already establishes leading-zero numerals as the site's way of
   saying "these run in order". */

.chain {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  border-top: 1px solid var(--ink);
  margin: 24px 0 0;
}

/* Column layout so the citation lines up along the bottom of every card
   regardless of how long the text above it runs. */
.chain-step {
  background: var(--bg);
  padding: 15px 15px 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.chain-step .step-n {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--red);
  margin-bottom: 9px;
}

.chain-step h4 {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 7px;
}

.chain-step p {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--grey);
  margin: 0;
}

.chain-step .cite {
  display: block;
  font-size: 12px;
  color: var(--grey);
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/* ---------- Three lines of defence ----------
   Same geometry as the wordmark: three rules, the second one red. The audit
   firm gets a pale rule and a gap, because it sits outside all three. */

.lines { margin: 24px 0 0; border-top: 1px solid var(--ink); }

.line-row {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 20px;
  padding: 15px 0 16px 15px;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid var(--ink);
}

.line-row.second { border-left-color: var(--red); }

.line-row .who { font-size: 15px; font-weight: 700; line-height: 1.3; }
.line-row .who span { display: block; font-size: 12px; font-weight: 400; color: var(--grey); margin-top: 4px; }
.line-row .what { font-size: 14px; line-height: 1.45; color: var(--grey); }

.line-row.outside {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  border-left-color: var(--line);
}

/* ---------- Reporting timeline ----------
   Buckets, not a linear axis. Drawn to scale, 24 hours next to 14 days would
   put the tightest deadline on the page inside two pixels. */

.timeline { margin: 10px 0 0; border-top: 1px solid var(--ink); }

.tl-head,
.tl-row {
  display: grid;
  grid-template-columns: 132px repeat(4, 1fr);
}

.tl-head span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--grey);
  padding: 11px 12px 10px;
}

.tl-row { border-top: 1px solid var(--line); }

.tl-who { padding: 15px 12px; }
.tl-who strong { display: block; font-size: 15.5px; }
.tl-who span { font-size: 12px; color: var(--grey); }

.tl-cell {
  padding: 15px 12px;
  border-left: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--grey);
}

/* A cell that carries an actual deadline. */
.tl-cell.on {
  border-left: 2px solid var(--red);
  color: var(--ink);
}

/* A duty with no fixed point on the clock runs across the whole width. */
.tl-cell.span {
  grid-column: 2 / -1;
  border-left: 1px solid var(--line);
}

/* ---------- Tiers ---------- */

.tier { margin: 0 0 36px; }

.tier-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 9px;
}

/* The stack is ranked by binding force, so it is numbered like one. */
.tier-n {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--red);
  margin-right: 11px;
  vertical-align: 1px;
}

.tier-head h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.005em;
}

.tier-head .force {
  font-size: 13px;
  color: var(--grey);
  text-align: right;
}

/* Separators are borders on the cards, not a background showing through 1px
   grid gaps. The gap technique paints every empty cell in a partial last row
   as a solid block of --line, which is what the tiers used to do whenever the
   node count was not a multiple of the column count. */

.nodes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
}

.node {
  background: var(--bg);
  padding: 16px 16px 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.node .ref {
  display: block;
  font-size: 12px;
  color: var(--grey);
  margin-bottom: 7px;
}

.node h4 {
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 7px;
}

.node p {
  font-size: 14px;
  line-height: 1.45;
  color: var(--grey);
  margin: 0;
}

.node .flag {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--red);
  margin-top: 10px;
}

/* The one circular most obligations live in. */

.node.spine {
  grid-column: 1 / -1;
  border-left: 3px solid var(--red);
  background: #fff;
  padding-left: 20px;
}

.node.spine h4 { font-size: 18px; }
.node.spine p { font-size: 15px; max-width: 62ch; }

/* ---------- Notes and foot ---------- */

.note {
  font-size: 15px;
  color: var(--grey);
  max-width: 66ch;
  margin: 22px 0 0;
}

.map-foot {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--grey);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 760px) {
  .tl-head { display: none; }
  .tl-row { display: block; padding-bottom: 6px; }
  .tl-who { padding: 14px 0 8px; }
  .tl-cell {
    border-left: none;
    padding: 8px 0 8px 14px;
    border-left: 2px solid var(--line);
    margin-bottom: 6px;
  }
  .tl-cell.on { border-left: 2px solid var(--red); }
  .tl-cell::before {
    content: attr(data-when);
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--grey);
    margin-bottom: 3px;
  }
  .tl-cell:empty { display: none; }
}

@media (max-width: 640px) {
  .nodes { grid-template-columns: 1fr; }
  .tier-head { flex-direction: column; gap: 4px; }
  .tier-head .force { text-align: left; }
  .node.spine { padding-left: 16px; }
  .line-row { grid-template-columns: 1fr; gap: 6px; }
}

/* ---------- Print ----------
   The node grid and the chain draw their separators with a background colour
   showing through 1px gaps. Print drops backgrounds, so on paper those
   separators vanish and the cards run together. Both become single column with
   real borders. */

@media print {

  .map { padding: 0 0 12pt; }
  .map + .map { padding-top: 0; }

  .map > .wrap > p.lead { max-width: none; font-size: 10.5pt; }

  .tier { margin: 0 0 16pt; }

  .tier-head {
    padding-bottom: 5pt;
    page-break-after: avoid;
    break-after: avoid;
  }

  .nodes,
  .chain { display: block; background: none; }

  .node,
  .chain-step {
    padding: 8pt 0;
    border-bottom: 1px solid var(--line);
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .node:last-child,
  .chain-step:last-child { border-bottom: none; }

  .node.spine {
    background: none;
    border-left: 2pt solid var(--red);
    padding: 8pt 0 8pt 10pt;
  }

  .lines,
  .timeline { page-break-inside: auto; }

  .line-row {
    padding: 8pt 0 8pt 10pt;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .tl-head { display: none; }

  .tl-row {
    display: block;
    padding: 8pt 0;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .tl-who { padding: 0 0 5pt; }

  .tl-cell {
    padding: 3pt 0 3pt 10pt;
    border-left: 1px solid var(--line);
  }

  .tl-cell::before {
    content: attr(data-when);
    display: block;
    font-size: 8pt;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--grey);
  }

  .tl-cell:empty { display: none; }

  .note { max-width: none; }

  .map-foot { page-break-inside: avoid; break-inside: avoid; }
}
