/* Spark Business Lending — the journal.
 *
 * The only site here that publishes writing, set like something that does:
 * a contents page in three departments at the head of every page, a front
 * page that opens on the three most recent pieces, and a reading measure
 * because nine of the twenty-one pages are five hundred words long.
 *
 * What it is recognisable by in greyscale: a ruled contents page of
 * twenty-one entries with a note beside each, and articles set in a serif at
 * a reading size with a dated byline above the headline.
 *
 * Merriweather over Lexend. The brand's blue is #20409a and measures 9.15:1
 * on this paper, so it carries text anywhere. The orange is #f1592a at
 * 3.34:1 and never does — it is a rule and a mark, and any text that wanted
 * to be orange takes --orange-deep at 5.44:1 instead. That is the lesson
 * Clear Path and Bloom arrived at the hard way, applied before rather than
 * after.
 */

@font-face {
  font-family: "Merriweather";
  src: url("display.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}
@font-face {
  font-family: "Lexend";
  src: url("text.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --paper: #fffdfb;
  --tint: #f4f3ef;
  --ink: #18181c;
  --text: #2a2b31;
  /* 7.10:1 on paper. */
  --muted: #55575f;
  /* 5.15:1 on paper. The contents page's notes, and nothing smaller. */
  --faint: #6a6c75;
  --rule: #e2e0da;
  --rule-firm: #bfbcb4;
  /* 9.15:1 on paper, and white on it is 9.29:1. */
  --blue: #20409a;
  --blue-deep: #1b3480;
  /* Rules and marks only: 3.34:1 is under AA and this never carries text. */
  --orange: #f1592a;
  /* 5.44:1 on paper, for anything orange that is read. */
  --orange-deep: #c1360d;

  --shell: 1140px;
  --display: "Merriweather", Georgia, "Times New Roman", serif;
  --body: "Lexend", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.66;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 26px;
}

img {
  max-width: 100%;
}

a {
  color: var(--blue);
}

a:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 50;
  background: var(--paper);
  padding: 10px 16px;
  border: 2px solid var(--blue);
}

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.toc li.is-here a {
  color: var(--blue);
}

.toc li.is-here {
  border-left: 3px solid var(--orange);
  padding-left: 8px;
  margin-left: -11px;
}

/* ---------- openers ---------- */

.open {
  padding: 46px 0 8px;
  max-width: 44rem;
}

.open--piece {
  padding-bottom: 18px;
}

.open__h1 {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3rem);
  line-height: 1.14;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin: 0 0 16px;
}

.open__stand {
  margin: 0;
  font-size: 1.04rem;
  color: var(--muted);
}

/* ---------- sections ---------- */

.sec {
  padding: 32px 0;
  border-top: 1px solid var(--rule);
  margin-top: 28px;
}

.sec--writing {
  border-top: 3px solid var(--orange);
}

.h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.3rem, 1.05rem + 1vw, 1.7rem);
  line-height: 1.24;
  color: var(--ink);
  margin: 0 0 10px;
}

.lede {
  margin: 0 0 24px;
  color: var(--muted);
  max-width: 44rem;
}

.aside {
  margin: 20px 0 0;
  font-size: 0.88rem;
  color: var(--faint);
  max-width: 44rem;
}

/* ---------- the pieces ---------- */

.pieces {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 30px 28px;
}

.piece {
  display: flex;
  flex-direction: column;
}

.piece__date {
  margin: 0 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.piece__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.26;
  margin: 0 0 8px;
}

.piece__title a {
  color: var(--ink);
  text-decoration: none;
}

.piece__title a:hover {
  color: var(--blue);
}

.piece__stand {
  margin: 0 0 12px;
  font-size: 0.92rem;
  color: var(--muted);
}

.piece__more {
  margin: auto 0 0;
  font-size: 0.86rem;
}

.piece__more a {
  font-weight: 600;
  text-decoration: none;
}

/* ---------- plates ----------
 *
 * Only ever a piece's own, and only ever with the writing. See photos.mjs. */
.plate {
  margin: 0 0 14px;
}

.plate img {
  display: block;
  width: 100%;
  height: auto;
  border-bottom: 3px solid var(--orange);
}

.plate figcaption {
  margin-top: 7px;
  font-size: 0.76rem;
  color: var(--faint);
}

/* ---------- reading ----------
 *
 * Nine of the twenty-one pages are five hundred words, and a landing-page
 * measure makes five hundred words unreadable. The articles are set in the
 * serif at a reading size on a measure of about 68 characters. */
.read {
  max-width: 40rem;
  padding-bottom: 8px;
}

.read .plate {
  margin-bottom: 26px;
}

.prose {
  font-family: var(--display);
  font-size: 1.02rem;
  line-height: 1.78;
  max-width: 40rem;
  color: var(--text);
}

.prose p {
  margin: 0 0 20px;
}

.prose .h2 {
  font-size: 1.28rem;
  margin: 30px 0 12px;
}

.prose .marks {
  margin-bottom: 20px;
}

/* ---------- marks ---------- */

.marks {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 40rem;
  font-family: var(--body);
  font-size: 0.96rem;
  line-height: 1.6;
}

.marks li {
  padding: 8px 0 8px 22px;
  border-bottom: 1px solid var(--rule);
  position: relative;
  color: var(--text);
}

.marks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.95em;
  width: 9px;
  height: 9px;
  background: var(--orange);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
}

/* ---------- the six ---------- */

.tbl__wrap {
  overflow-x: auto;
}

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.tbl th,
.tbl td {
  text-align: left;
  padding: 13px 16px 13px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: baseline;
}

.tbl thead th {
  font-weight: 600;
  font-size: 0.66rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1px solid var(--rule-firm);
  padding-top: 0;
}

.tbl tbody th {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--ink);
  white-space: nowrap;
}

.tbl tbody th a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--orange);
}

.tbl tbody th a:hover {
  color: var(--blue);
}

.tbl td {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tbl tr.is-here {
  background: var(--tint);
}

/* ---------- a programme's figures ---------- */

.figs {
  margin: 0 0 26px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 3px solid var(--blue);
  border-bottom: 1px solid var(--rule-firm);
}

.figs dt {
  grid-row: 1;
  font-size: 0.66rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 14px 16px 4px 0;
}

.figs dd {
  grid-row: 2;
  margin: 0;
  padding: 0 16px 16px 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ---------- steps, questions, statistics, voices ---------- */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
  border-top: 1px solid var(--rule-firm);
}

.steps li {
  counter-increment: step;
  padding: 20px 0 20px 2.8rem;
  border-bottom: 1px solid var(--rule);
  position: relative;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 22px;
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.3rem;
  color: var(--orange-deep);
}

.steps h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.14rem;
  color: var(--ink);
  margin: 0 0 6px;
}

.steps p {
  margin: 0;
  color: var(--muted);
  max-width: 42rem;
}

.qa {
  margin: 0;
  border-top: 1px solid var(--rule-firm);
}

.qa dt {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.04rem;
  color: var(--ink);
  padding: 16px 0 4px;
}

.qa dd {
  margin: 0;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  max-width: 42rem;
}

.stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 3px solid var(--blue);
}

.stats li {
  padding: 18px 20px 18px 0;
  border-bottom: 1px solid var(--rule);
}

.stats strong {
  display: block;
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.7rem;
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stats span {
  display: block;
  font-size: 0.84rem;
  color: var(--muted);
  margin-top: 3px;
}

.voices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.voices blockquote {
  margin: 0;
  padding: 20px 0 0;
  border-top: 3px solid var(--orange);
}

.voices p {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
}

.voices cite {
  font-style: normal;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
}

.voices cite span {
  display: block;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--faint);
}

/* ---------- the application ---------- */

.sec--apply {
  background: var(--tint);
  border-top: 3px solid var(--blue);
  margin-top: 34px;
  padding: 32px 26px;
}

.frame {
  margin-top: 20px;
  background: var(--paper);
  border: 1px solid var(--rule-firm);
}

.frame iframe {
  display: block;
  width: 100%;
  border: 0;
}

/* ---------- narrower ---------- */

@media (max-width: 980px) {
  .toc {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 28px;
  }

  .toc__dept + .toc__dept {
    border-left: 0;
    padding-left: 0;
  }

  /* The writing is the longest department and gets the full width under the
   * other two rather than a half column of its own. */
  .toc__dept:nth-child(3) {
    grid-column: 1 / -1;
    border-top: 1px solid var(--rule);
    padding-top: 14px;
  }

  .pieces,
  .voices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .toc {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc__dept:nth-child(3) {
    grid-column: auto;
  }

  .toc__dept + .toc__dept {
    border-top: 1px solid var(--rule);
    padding-top: 14px;
  }

  .pieces,
  .voices {
    grid-template-columns: minmax(0, 1fr);
  }

  .stats {
    grid-template-columns: minmax(0, 1fr);
  }

  .figs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .figs dt:nth-of-type(3),
  .figs dt:nth-of-type(4) {
    grid-row: 3;
  }

  .figs dd:nth-of-type(3),
  .figs dd:nth-of-type(4) {
    grid-row: 4;
  }

  .sec--apply {
    padding: 28px 16px;
    margin-left: -26px;
    margin-right: -26px;
  }
}

/* ---- the shared chrome, painted in this brand's colours ---- */
/* Chosen by measurement, not by name -- see tools/sitegen/chrome.css for what
 * each token does. Every pair below clears WCAG AA. Override freely. */
:root {
  --nav-bg: #fffdfb;
  --nav-ink: #18181c;
  --nav-ink-soft: #6a6c75;
  --nav-rule: #d5d4d3;
  --nav-hover: #c1360d;
  --nav-panel: #fffefd;
  --nav-cta-bg: #c1360d;
  --nav-cta-ink: #ffffff;
  --nav-font: var(--display);

  --foot-bg: #301c1a;
  --foot-ink: #aca4a3;
  --foot-head: #e3e0e0;
  --foot-rule: #594a48;
  --foot-link: #f1efef;
}
