/* Agave Tequilana */

:root {
  --paper: #f2f5f3;   /* agave bloom */
  --ink: #1e2b2a;     /* leaf shadow */
  --agave: #3f7370;   /* glaucous blue-green */
  --muted: #5f6f6c;
  --line: #cfd9d5;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --serif: Charter, "Bitstream Charter", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;

  --measure: 36rem;
  --wide: 60rem;
  --gutter: clamp(1rem, 5vw, 3rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #18211f;
    --ink: #e4ebe8;
    --agave: #8fbdb8;
    --muted: #9aaba7;
    --line: #2f3d3a;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

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

.skip {
  position: absolute;
  left: var(--gutter);
  top: -3rem;
  font-family: var(--sans);
  font-size: 0.9rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 0.75rem;
}
.skip:focus { top: 1rem; }

/* Header and footer */

.site-header,
.site-footer,
main {
  max-width: var(--wide);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.site-header {
  padding-top: 1.75rem;
  padding-bottom: 1.75rem;
}

.wordmark {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.wordmark:hover { color: var(--agave); }

.site-footer {
  margin-top: 6rem;
  padding-bottom: 3rem;
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
}
.site-footer .inner { padding-top: 1.5rem; border-top: 1px solid var(--line); }
.site-footer p { max-width: var(--measure); margin: 0; }
.site-footer .sources { margin-top: 0.5rem; }
.site-footer a { text-decoration-color: var(--line); text-underline-offset: 0.15em; }
.site-footer a:hover { color: var(--agave); }

/* Shared type */

h1, h2, h3 {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-wrap: balance;
}

.lede {
  font-size: 1.375rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: var(--measure);
  text-wrap: pretty;
}

/* Home */

.intro { padding: clamp(2rem, 8vw, 5rem) 0 clamp(2rem, 5vw, 3.5rem); }

.intro h1 {
  font-size: clamp(2.5rem, 6.5vw, 4.75rem);
  letter-spacing: -0.035em;
  line-height: 1.02;
  max-width: 13ch;
  margin: 0 0 1.5rem;
}
.intro .lede { margin: 0; }

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
}

.steps a {
  display: grid;
  grid-template-columns: 3.5rem 1fr minmax(0, 22rem);
  gap: 0 1.5rem;
  align-items: baseline;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
}

.steps .n {
  font-family: var(--sans);
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  color: var(--agave);
  line-height: 1;
}

.steps .t {
  font-family: var(--sans);
  font-size: clamp(1.5rem, 3.5vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.steps .s {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--muted);
}

.steps a:hover .t {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.15em;
  text-decoration-color: var(--agave);
}

.basics {
  max-width: var(--measure);
  margin-top: clamp(3rem, 8vw, 5rem);
}
.basics h2 { font-size: 1.5rem; margin: 0 0 1rem; }

.ref {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 1rem;
}
.ref a {
  display: block;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--ink);
  text-decoration-color: var(--agave);
  text-underline-offset: 0.15em;
  margin-bottom: 0.25rem;
}

/* Topic pages */

.topic { padding-top: clamp(2rem, 6vw, 4rem); }

.step-of {
  font-family: var(--sans);
  font-size: 0.9375rem;
  color: var(--agave);
  margin: 0 0 0.75rem;
}

.topic h1 {
  font-size: clamp(2.25rem, 5.5vw, 3.75rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
  max-width: 16ch;
  margin: 0 0 1.25rem;
}
.topic .lede { margin: 0 0 3rem; }

.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1.25em; text-wrap: pretty; }
.prose h2 { font-size: 1.625rem; margin: 2.75rem 0 0.75rem; }
.prose h3 { font-size: 1.1875rem; margin: 2rem 0 0.5rem; }
.prose ul { padding-left: 1.25em; margin: 0 0 1.5em; }
.prose li { margin-bottom: 0.4em; }
.prose li::marker { color: var(--agave); }

.prose dl { margin: 0 0 1.5em; }
.prose dt {
  font-family: var(--sans);
  font-weight: 600;
  margin-top: 1.25em;
}
.prose dd { margin: 0.25em 0 0; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  max-width: var(--wide);
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.pager a {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.125rem;
  text-decoration: none;
  line-height: 1.3;
}
.pager a span {
  display: block;
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.pager .next { margin-left: auto; text-align: right; }
.pager a:hover { color: var(--agave); }

/* Small screens */

@media (max-width: 40rem) {
  body { font-size: 1.0625rem; }
  .lede { font-size: 1.1875rem; }
  .steps a {
    grid-template-columns: 2.5rem 1fr;
    gap: 0.4rem 1rem;
    padding: 1.25rem 0;
  }
  .steps .s { grid-column: 2; }
}
