:root {
  /* Cyanotype: the page is the print, text is the exposed paper. */
  --print: #11306b;
  --well: #0a2251;
  --paper: #f1efe6;
  --wash: #a8bde3;
  --line: #2e4f92;
  --unexposed: #234a94;
  /* Server status marks only; the text always names the state too. */
  --healthy: #7ee2b8;
  --behind: #f4c56a;

  --sans: "Funnel Sans", system-ui, sans-serif;
  --display: "Funnel Display", "Funnel Sans", system-ui, sans-serif;
  --mono: "Martian Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --gutter: clamp(1.25rem, 5vw, 4.5rem);
  /* Martian Mono's advance width in em: the key is sized so 11 characters fill the column. */
  --key-advance: 0.7;

  color-scheme: dark;
}

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

html {
  background: var(--print);
  color: var(--paper);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 400 1.125rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--paper);
  color: var(--print);
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

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

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

p {
  margin: 0;
}

code {
  font-family: var(--mono);
  font-size: 0.8em;
  font-stretch: 87.5%;
}

/* Flags and keys in running text never break at their hyphens. */
p code {
  white-space: nowrap;
}

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

/* Masthead */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding: 1.75rem var(--gutter) 0;
}

.wordmark {
  font: 700 1.5rem/1 var(--display);
  letter-spacing: -0.03em;
  text-decoration: none;
}

.wordmark-small {
  font-size: 1.125rem;
}

.brand {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
}

.byline {
  font-size: 0.9375rem;
  color: var(--wash);
}

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

.status {
  font-size: 0.9375rem;
  color: var(--wash);
}

.status strong {
  font-weight: 500;
  color: var(--paper);
}

.status-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--healthy);
  vertical-align: 0.06em;
}

.status[data-state="behind"] .status-dot {
  background: var(--behind);
}

.status[data-state="unknown"] .status-dot {
  background: var(--wash);
}

/* Hero */

main {
  flex: 1;
  padding: 0 var(--gutter);
  container-type: inline-size;
}

.hero {
  display: grid;
  align-items: start;
  gap: clamp(1.75rem, 3.5vw, 2.5rem) clamp(2.5rem, 5vw, 5rem);
  max-width: 84rem;
  padding-block: clamp(2rem, 6vh, 4.5rem) clamp(2.5rem, 6vh, 4rem);
}

/* Wide screens: heading across the top, then the key beside the client configs. */
@media (min-width: 64rem) {
  .hero {
    grid-template-columns: max-content minmax(0, 1fr);
  }

  .hero-head {
    grid-column: 1 / -1;
  }
}

.hero h1 {
  margin: 0 0 0.6rem;
  font: 600 clamp(1.5rem, 1.05rem + 1.5vw, 2.25rem)/1.15 var(--display);
  letter-spacing: -0.015em;
}

.key {
  width: 11ch;
  font-family: var(--mono);
  font-weight: 400;
  /* 11 characters per line, sized to share the first view with the client configs. */
  font-size: min(calc((100vw - 2 * var(--gutter)) / 11 / var(--key-advance)), clamp(2.75rem, 1rem + 3.4vw, 4.5rem), 9vh);
  font-size: min(calc(100cqi / 11 / var(--key-advance)), clamp(2.75rem, 1rem + 3.4vw, 4.5rem), 9svh);
  line-height: 1.02;
  letter-spacing: 0;
  word-break: break-all;
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: no-preference) {
  .key {
    animation: develop 1.6s cubic-bezier(0.2, 0.6, 0.2, 1) 120ms both;
  }

  /* A camera flash over what just changed: the copied key, a newly published snapshot. */
  .key.is-flashing,
  .stat-value.is-flashing {
    animation: flash 420ms ease-out;
  }
}

@keyframes flash {
  from {
    background: var(--paper);
    color: var(--print);
  }
  to {
    background: transparent;
    color: var(--paper);
  }
}

@keyframes develop {
  from {
    color: var(--unexposed);
    filter: blur(0.05em);
  }
  to {
    color: var(--paper);
    filter: blur(0);
  }
}

.hero-key .button {
  margin-top: clamp(1.25rem, 3vh, 2rem);
}

.lede {
  max-width: 60ch;
  color: var(--wash);
}

/* Buttons */

.button {
  min-width: 9.5rem;
  padding: 0.95rem 1.5rem;
  border: 0;
  border-radius: 3px;
  background: var(--paper);
  color: var(--print);
  font: 600 1rem/1 var(--sans);
  cursor: pointer;
}

.button:hover {
  background: #fff;
}

.button:active {
  transform: translateY(1px);
}

.copy {
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--well);
  color: var(--wash);
  font: 500 0.875rem/1 var(--sans);
  cursor: pointer;
}

.copy:hover {
  border-color: var(--wash);
  color: var(--paper);
}

/* Live panel */

.live {
  max-width: 76rem;
  padding-block: clamp(1.75rem, 4vw, 2.5rem);
  border-top: 1px solid var(--line);
}

.live-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem clamp(1.5rem, 4vw, 3rem);
  margin: 0;
}

@media (min-width: 52rem) {
  .live-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.stat dt {
  font-size: 0.9375rem;
  color: var(--wash);
}

.stat dd {
  margin: 0.4rem 0 0;
}

.stat-value {
  display: inline-block;
  font: 400 clamp(1.25rem, 0.95rem + 1vw, 1.75rem)/1.2 var(--mono);
  font-stretch: 87.5%;
}

.stat-note {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.9375rem;
  color: var(--wash);
}

/* Sections */

.section {
  max-width: 62rem;
  padding-block: clamp(2rem, 4vw, 3rem);
  border-top: 1px solid var(--line);
}

.section h2 {
  margin: 0 0 0.75rem;
  font: 600 1.5rem/1.2 var(--display);
  letter-spacing: -0.01em;
}

.section > p {
  max-width: 38rem;
}

.section > p + p,
.section > .snippet + p,
.section > p + .snippet {
  margin-top: 1rem;
}

.pair {
  display: grid;
  gap: 0 clamp(2rem, 5vw, 4.5rem);
  max-width: 76rem;
}

@media (min-width: 64rem) {
  .pair {
    grid-template-columns: 1fr 1fr;
  }
}

/* Client configs: tabs once app.js runs, stacked panels without it. */

.hero-config {
  min-width: 0;
  max-width: 44rem;
}

.tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.tab {
  margin-bottom: -1px;
  padding: 0.55rem 0 0.75rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--wash);
  font: 500 1rem/1 var(--sans);
  cursor: pointer;
}

.tab:hover {
  color: var(--paper);
}

.tab[aria-selected="true"] {
  border-bottom-color: var(--paper);
  color: var(--paper);
}

.panel-title {
  margin: 0 0 0.6rem;
  font: 600 1.125rem/1.3 var(--sans);
}

.panel + .panel {
  margin-top: 1.5rem;
}

.tabs-ready .panel + .panel {
  margin-top: 0;
}

/* The tab names the panel once tabs exist. */
.tabs-ready .panel-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.snippet {
  position: relative;
  padding: 3rem 1rem 0.85rem;
  background: var(--well);
}

@media (min-width: 46rem) {
  .snippet {
    padding: 0.85rem 4.75rem 0.85rem 1rem;
  }
}

.snippet pre {
  margin: 0;
  font: 400 0.875rem/1.65 var(--mono);
  font-stretch: 87.5%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.snippet code {
  font-size: inherit;
  font-stretch: inherit;
}

.snippet .copy {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
}

.dim {
  color: var(--wash);
}

.note {
  margin-top: 0.6rem;
  font-size: 1rem;
  color: var(--wash);
}

.note code {
  color: var(--paper);
}

/* Footer */

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding: 1.75rem var(--gutter) 2.25rem;
  border-top: 1px solid var(--line);
  color: var(--wash);
  font-size: 0.9375rem;
}

.footer .wordmark {
  color: var(--paper);
}

.credits {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 0.875rem;
}

.credits .wordmark {
  margin-right: 0.375rem;
}

/* "by" and "and" stay on the line of the logo they introduce. */
.credit {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  white-space: nowrap;
}

.credits img {
  display: block;
  width: auto;
  height: 1.5rem;
}

@media (min-width: 46rem) {
  .credits img {
    height: 1.75rem;
  }
}

.credits a:hover img {
  opacity: 0.85;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
}
