/* The site's foundation: reset, type, layout and the masthead. The tokens
   (colour, type sizes, radii, curves) are tokens.css, which loads first. */

/* ---------------------------------------------------------------- reset --- */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--masthead) + 32px);
  /* Nothing may make a page scroll sideways. clip on the root, not hidden on
     body: it does not make a scroll container, so the masthead stays fixed. */
  overflow-x: clip;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--base);
  color: var(--label-2);
  font-family: var(--font);
  font-size: var(--body);
  font-weight: 400;
  font-optical-sizing: auto;
  line-height: 1.53;
  letter-spacing: var(--track-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--tint);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

/* A link inside running text is marked as one at rest, not only on hover,
   wherever the text is: prose, answers, captions, table cells. */
main :is(p, li, td) a:not(.button) {
  text-decoration: underline;
  text-decoration-color: var(--tint-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

main :is(p, li, td) a:not(.button):hover {
  text-decoration-color: currentColor;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

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

::selection {
  background: rgba(46, 155, 255, 0.32);
}

.skip {
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 200;
  padding: 10px 18px;
  border-radius: var(--r-button);
  background: var(--accent-fill);
  color: var(--on-accent);
  font-size: var(--callout);
  font-weight: 600;
  transform: translate(-50%, -160%);
}

.skip:focus {
  transform: translate(-50%, 0);
  text-decoration: none;
}

/* ------------------------------------------------------------ typography --- */

h1,
h2,
h3,
h4 {
  color: var(--label);
  font-weight: 600;
  text-wrap: balance;
}

h1 {
  font-size: var(--display);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: var(--track-display);
}

h2 {
  font-size: var(--title-1);
  line-height: 1.1;
  letter-spacing: var(--track-title);
}

h3 {
  font-size: var(--title-3);
  line-height: 1.27;
  letter-spacing: var(--track-title-3);
}

h4 {
  font-size: var(--headline);
  line-height: 1.41;
  letter-spacing: var(--track-body);
}

p {
  text-wrap: pretty;
}

strong {
  color: var(--label);
  font-weight: 600;
}

/* What was a caps label above a heading is now a quiet line of its own,
   kept only where a script still builds one (the operator's dashboard). */
.eyebrow {
  display: block;
  margin-bottom: 10px;
  color: var(--label-2);
  font-size: var(--footnote);
  font-weight: 510;
  letter-spacing: var(--track-footnote);
}

.lede {
  max-width: 34em;
  color: var(--label-2);
  font-size: var(--lede);
  line-height: 1.45;
  letter-spacing: -0.016em;
}

h1 + .lede,
h2 + .lede {
  margin-top: 18px;
}

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

.caption {
  color: var(--label-2);
  font-size: var(--footnote);
  line-height: 1.45;
  letter-spacing: var(--track-footnote);
}

code {
  padding: 0.12em 0.38em;
  border-radius: var(--r-control);
  background: var(--fill-2);
  color: var(--label);
  font-family: var(--mono);
  font-size: 0.86em;
  letter-spacing: 0;
}

/* --------------------------------------------------------------- layout --- */

.shell {
  width: 100%;
  max-width: calc(var(--shell) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  padding-block: clamp(80px, 10vw, 136px);
}

/* A band changes the room's tone rather than drawing a line round it. */
.section.tone {
  background: var(--well);
}

.grid {
  display: grid;
  gap: clamp(16px, 2vw, 24px);
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.split {
  display: grid;
  gap: clamp(36px, 5vw, 80px);
  align-items: center;
}

@media (min-width: 940px) {
  .split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .split-wide-left {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  }
}

.section-head {
  max-width: 720px;
  margin-bottom: clamp(36px, 4.4vw, 60px);
}

.section-head.center {
  margin-inline: auto;
  text-align: center;
}

.section-head.center .lede {
  margin-inline: auto;
}

/* ---------------------------------------------------------------- header --- */

/* Frosted from the first frame, so it reads with no script; site.js adds the
   hairline once something has scrolled under it. */
.masthead {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 100;
  height: var(--masthead);
  background: var(--material);
  -webkit-backdrop-filter: var(--material-blur);
  backdrop-filter: var(--material-blur);
  box-shadow: 0 0.5px 0 transparent;
  transition: box-shadow var(--slow) var(--ease-out-soft);
}

.masthead[data-scrolled] {
  box-shadow: 0 0.5px 0 var(--hairline-strong);
}

.masthead-inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--label);
  font-size: var(--callout);
  font-weight: 600;
  letter-spacing: var(--track-callout);
  white-space: nowrap;
}

.brand:hover {
  color: var(--label);
  text-decoration: none;
}

.brand-mark {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 6px;
  box-shadow: 0 0 0 0.5px var(--hairline-strong);
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

/* Scoped away from the CTA: it is an <a> and a .button, and a bare `.nav a`
   would outrank .button and repaint its label. */
.nav a:not(.nav-cta) {
  padding: 6px 10px;
  border-radius: var(--r-control);
  color: var(--label-2);
  font-size: var(--footnote);
  font-weight: 510;
  letter-spacing: var(--track-footnote);
  transition: color var(--fast) var(--ease-out-soft);
}

.nav a:not(.nav-cta):hover {
  color: var(--label);
  text-decoration: none;
}

.nav a[aria-current="page"] {
  color: var(--label);
}

.nav-cta {
  margin-left: 10px;
}

/* The mobile disclosure: two bars that cross. A real button, so it is
   reachable without a pointer. */
.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  margin: 0 -8px 0 auto;
  padding: 0;
  border: 0;
  border-radius: var(--r-button);
  background: transparent;
  color: var(--label);
}

.nav-toggle span {
  position: relative;
  display: block;
  width: 18px;
  height: 12px;
}

.nav-toggle span::before,
.nav-toggle span::after {
  position: absolute;
  left: 0;
  width: 18px;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
  content: "";
  transition: transform var(--spring-snappy-ms) var(--spring-snappy);
}

.nav-toggle span::before {
  top: 2px;
}

.nav-toggle span::after {
  bottom: 2px;
}

.masthead[data-open] .nav-toggle span::before {
  transform: translateY(3.25px) rotate(45deg);
}

.masthead[data-open] .nav-toggle span::after {
  transform: translateY(-3.25px) rotate(-45deg);
}

@media (max-width: 719px) {
  .nav-toggle {
    display: grid;
    place-items: center;
  }

  .masthead[data-open] {
    background: var(--material-thick);
  }

  /* The sheet: frosted, under the bar, its links set large for a thumb. */
  .nav {
    position: absolute;
    top: var(--masthead);
    right: 0;
    left: 0;
    display: grid;
    gap: 0;
    margin-left: 0;
    padding: 8px var(--gutter) 24px;
    background: var(--material-thick);
    -webkit-backdrop-filter: var(--material-blur);
    backdrop-filter: var(--material-blur);
    box-shadow: 0 0.5px 0 var(--hairline-strong), 0 24px 48px -24px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 240ms var(--ease-out-soft), transform var(--spring-gentle-ms) var(--spring-gentle),
      visibility 240ms;
  }

  .masthead[data-open] .nav {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .nav a:not(.nav-cta) {
    padding: 14px 0;
    border-radius: 0;
    box-shadow: 0 0.5px 0 var(--hairline);
    color: var(--label);
    font-size: var(--title-3);
    font-weight: 600;
    letter-spacing: var(--track-title-3);
  }

  /* In the sheet the CTA is a full-size button, a thumb's height. */
  .nav-cta {
    min-height: 44px;
    margin: 20px 0 0;
    font-size: var(--callout);
  }
}
