/* Proof of Done docs. The colours and typefaces are those of abhyu.in, where the app's
   case study lives, so the two sites read as one. */

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/bricolage-grotesque.woff2") format("woff2");
}

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/geist.woff2") format("woff2");
}

@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/geist-mono.woff2") format("woff2");
}

:root {
  color-scheme: light dark;
  --blue: #1b34e0;
  --lime: #c9f26b;
  --ink: #0d1433;
  --paper: #f4f5f0;
  --white: #ffffff;

  --bg: var(--paper);
  --surface: var(--white);
  --text: var(--ink);
  --muted: #4d5370;
  --line: #d3d6cc;
  --link: var(--blue);
  --code-inline: #e4e7fb;
  --focus: var(--blue);

  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --body: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --pad: clamp(20px, 5vw, 64px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--ink);
    --surface: #151d45;
    --text: #e9ebf3;
    --muted: #a8aec8;
    --line: #2b3466;
    --link: #b3bdff;
    --code-inline: #222b5c;
    --focus: var(--lime);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 1.5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.62 var(--body);
  font-synthesis: none;
  /* A long word, such as an email address, breaks before it can widen the page. */
  overflow-wrap: break-word;
}

.wrap {
  max-width: 78rem;
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

.skip {
  position: absolute;
  left: -999rem;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  padding: 0.5rem 0.9rem;
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

/* The blue band: site bar, page title and, on the home page, the way to proven. */

.band {
  background: var(--blue);
  color: var(--paper);
}

.band a {
  color: var(--paper);
}

.band :focus-visible {
  outline-color: var(--lime);
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  font: 700 1.2rem/1 var(--display);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand img {
  display: block;
  border-radius: 7px;
  box-shadow: 0 0 0 1.5px rgba(244, 245, 240, 0.55);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.6rem;
  font-size: 0.95rem;
  font-weight: 500;
}

.site-nav a {
  padding: 0.55rem 0;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  border-bottom-color: rgba(244, 245, 240, 0.6);
}

.site-nav a[aria-current="page"] {
  border-bottom-color: var(--lime);
}

.pill {
  display: inline-block;
  padding: 0.7rem 1.35rem;
  border: 1.5px solid var(--paper);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}

.band .pill {
  color: var(--ink);
}

.band .pill-line,
.pill-line {
  background: transparent;
  color: var(--paper);
  border-color: rgba(244, 245, 240, 0.7);
}

.pill:hover {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
}

.site-nav .pill {
  padding: 0.5rem 1rem;
  border-bottom-width: 1.5px;
}

.site-nav .pill:hover {
  border-color: var(--paper);
}

.page-head {
  padding-top: clamp(2rem, 6vw, 4.5rem);
  padding-bottom: clamp(2.5rem, 6vw, 4.5rem);
}

.page-head h1 {
  max-width: 17ch;
  margin: 0;
  font: 700 clamp(2.5rem, 6.2vw, 4.75rem)/0.98 var(--display);
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.page-head .lead {
  max-width: 36rem;
  margin: 1.5rem 0 0;
  font-size: clamp(1.1rem, 1.6vw, 1.3rem);
  line-height: 1.5;
  color: rgba(244, 245, 240, 0.92);
}

.page-head .updated {
  margin: 1.2rem 0 0;
  font-size: 0.95rem;
  color: rgba(244, 245, 240, 0.78);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 2rem 0 0;
}

/* Six steps from a written criterion to a proven work item. Each step's top edge joins the
   next into one line, and the line turns lime where the work item is proven. */

.flow {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0 1.25rem;
  margin: clamp(3rem, 7vw, 5rem) 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.flow li {
  position: relative;
  margin: 0;
  padding: 1.1rem 0 0;
  border-top: 3px solid rgba(244, 245, 240, 0.45);
  font-size: 0.95rem;
  line-height: 1.45;
  color: rgba(244, 245, 240, 0.85);
  counter-increment: step;
}

.flow li::before {
  content: counter(step);
  display: block;
  margin-bottom: 0.6rem;
  font: 600 0.9rem/1 var(--display);
  color: rgba(244, 245, 240, 0.7);
}

.flow-step {
  display: block;
  margin-bottom: 0.35rem;
  font: 700 1.3rem/1.1 var(--display);
  letter-spacing: -0.01em;
  color: var(--paper);
}

.flow .flow-end {
  border-top-color: var(--lime);
}

.flow .flow-end::before,
.flow .flow-end .flow-step {
  color: var(--lime);
}

/* The reading area. */

main.wrap {
  padding-top: clamp(2rem, 5vw, 3.5rem);
  padding-bottom: 5rem;
}

main > * {
  max-width: 46rem;
}

h2,
h3,
dt {
  font-family: var(--display);
  text-wrap: balance;
}

h2 {
  margin: 3.5rem 0 1rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

h3 {
  margin: 1.9rem 0 0.5rem;
  font-size: 1.3rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

p,
ul,
ol,
dl,
table,
pre,
figure {
  margin: 0 0 1.1rem;
}

ul,
ol {
  padding-left: 1.3rem;
}

li {
  margin-bottom: 0.55rem;
  padding-left: 0.2rem;
}

li::marker {
  color: var(--link);
}

li > p {
  margin-bottom: 0.5rem;
}

li > ul,
li > ol {
  margin-top: 0.5rem;
}

strong {
  font-weight: 650;
}

dl {
  border-top: 1px solid var(--line);
}

dt {
  margin-top: 0.9rem;
  font-size: 1.1rem;
  font-weight: 650;
}

dd {
  margin: 0.2rem 0 0;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}

code {
  padding: 0.12em 0.35em;
  background: var(--code-inline);
  border-radius: 5px;
  font: 0.86em/1.4 var(--mono);
  overflow-wrap: anywhere;
}

/* A long command wraps on screen. A copied command stays one line. */
pre {
  padding: 1rem 1.2rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (prefers-color-scheme: dark) {
  pre {
    background: #070b20;
    box-shadow: inset 0 0 0 1px var(--line);
  }
}

pre code {
  padding: 0;
  background: none;
  color: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

figure img {
  display: block;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(13, 20, 51, 0.14);
}

figcaption {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

li > figure {
  margin-top: 0.9rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 0.95rem;
  line-height: 1.5;
}

th,
td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  border-bottom: 2px solid var(--text);
  font-weight: 650;
}

/* The contents list. On a narrow screen it is a box above the text. */

.toc {
  margin: 0 0 2rem;
  padding: 1rem 1.2rem;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 0 0 1px var(--line);
  font-size: 0.95rem;
}

.toc p,
.toc summary {
  margin: 0;
  font: 650 1rem/1.3 var(--display);
}

.toc ul {
  margin-top: 0.5rem !important;
}

/* The script turns the list into one that opens on a narrow screen. On a wide screen it
   stays open, and its title is a plain label. */
.toc summary {
  list-style-position: outside;
}

.toc summary::marker {
  color: var(--link);
}

.toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.toc a {
  display: block;
  padding: 0.3rem 0;
  color: var(--muted);
  text-decoration: none;
}

.toc a:hover {
  color: var(--text);
  text-decoration: underline;
}

.toc a[aria-current] {
  color: var(--text);
  font-weight: 600;
}

/* On a wide screen the contents list stands beside the text and stays in view. */
@media (min-width: 64rem) {
  main.wrap {
    display: grid;
    grid-template-columns: 14.5rem minmax(0, 46rem);
    column-gap: clamp(3rem, 6vw, 6rem);
    align-content: start;
  }

  main > * {
    grid-column: 2;
  }

  main > .toc {
    grid-column: 1;
    grid-row: 1 / span 500;
    align-self: start;
    position: sticky;
    top: 1.5rem;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    margin: 0;
    padding: 0.1rem 0 0;
    background: none;
    border-radius: 0;
    box-shadow: none;
    font-size: 0.92rem;
  }

  .toc summary {
    list-style: none;
    pointer-events: none;
  }

  .toc summary::-webkit-details-marker {
    display: none;
  }

  .toc li a {
    padding: 0.32rem 0 0.32rem 0.9rem;
    border-left: 2px solid var(--line);
  }

  .toc li a[aria-current] {
    border-left-color: var(--link);
  }

  /* Grid items keep both margins, so a heading that opens the text column needs no space of
     its own. */
  main > .toc:first-child + h2 {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  main > p:first-child {
    margin-top: 0;
  }

  /* A page without a contents list keeps its text in one column. */
  main.wrap:not(:has(> .toc)) {
    display: block;
  }
}

/* A page other than the home page puts its summary beside its title. */
@media (min-width: 64rem) {
  body:not(.home) .page-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 30rem);
    column-gap: 4rem;
    align-items: end;
    padding-top: 2.5rem;
    padding-bottom: 3.5rem;
  }

  body:not(.home) .page-head h1 {
    font-size: clamp(2.75rem, 5.2vw, 4.25rem);
  }

  body:not(.home) .page-head .lead {
    margin-top: 0;
  }
}

@media (max-width: 64rem) {
  .flow {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem 1.25rem;
  }
}

@media (max-width: 40rem) {
  body {
    font-size: 1rem;
  }

  .bar {
    padding-top: 1rem;
    padding-bottom: 0.5rem;
  }

  .site-nav {
    gap: 0.1rem 1rem;
    font-size: 0.9rem;
  }

  .toc summary {
    cursor: pointer;
  }

  .site-nav .pill {
    display: none;
  }

  /* On a phone the steps run down the page along one line. */
  .flow {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .flow li {
    padding: 0 0 1.2rem 1.6rem;
    border-top: 0;
    border-left: 3px solid rgba(244, 245, 240, 0.45);
  }

  .flow .flow-end {
    border-left-color: var(--lime);
    padding-bottom: 0.2rem;
  }

  .flow li::before {
    display: none;
  }
}

/* Paper cannot show the bands or follow a link. */
@media print {
  :root {
    --bg: #ffffff;
    --surface: #ffffff;
    --text: #000000;
    --muted: #333333;
    --line: #999999;
    --link: #000000;
  }

  body {
    font-size: 11pt;
  }

  .band {
    background: none;
    color: #000000;
  }

  .band a,
  .page-head .lead,
  .page-head .updated {
    color: #000000;
  }

  .wrap {
    max-width: none;
    padding: 0;
  }

  .skip,
  .site-nav,
  .foot nav,
  .toc,
  .actions,
  .flow {
    display: none;
  }

  main.wrap {
    display: block;
    padding-top: 1rem;
  }

  main > * {
    max-width: none;
  }

  pre {
    background: #f1f2f4;
    color: #000000;
  }

  main a[href^="http"]::after {
    content: " <" attr(href) ">";
    font-size: 0.9em;
  }

  h2,
  h3 {
    break-after: avoid;
  }

  pre,
  figure,
  dt,
  li {
    break-inside: avoid;
  }
}

/* The footer. */

.foot {
  background: var(--ink);
  color: rgba(244, 245, 240, 0.8);
  font-size: 0.92rem;
}

.foot .wrap {
  padding-top: 2.5rem;
  padding-bottom: 3rem;
}

.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.6rem;
  margin-bottom: 1.2rem;
}

.foot a {
  color: var(--paper);
}

.foot nav a {
  padding: 0.4rem 0;
  text-decoration: none;
}

.foot nav a:hover,
.foot nav a[aria-current="page"] {
  text-decoration: underline;
}

.foot p {
  max-width: 46rem;
  margin: 0;
}

.foot :focus-visible {
  outline-color: var(--lime);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@media print {
  .foot {
    background: none;
    color: #000000;
  }

  .foot a {
    color: #000000;
  }
}
