/* Foliant. Paper, ink, one registration red. */


:root {
  --paper: #f3efe6;
  --sheet: #fffdf8;
  --ink: #1a1917;
  --ink-2: #6a6459;
  --rule: #d7d1c3;
  --red: #b8341c;
  --red-ink: #8f2814;

  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --shadow-sheet:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 0 0 1px rgba(26, 25, 23, 0.06),
    0 2px 3px -1px rgba(26, 25, 23, 0.12),
    0 14px 28px -18px rgba(26, 25, 23, 0.4);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.6' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0.25 0 0 0 0 0.2 0 0 0 0 0.1 0 0 0 0 0 0 0 0.035 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  --measure: 66ch;
  --gutter: clamp(20px, 4vw, 56px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  background-color: var(--paper);
  background-image: var(--grain);
  background-size: 240px 240px;
  background-blend-mode: multiply;
  color: var(--ink);
  font: 400 17px/1.55 var(--serif);
  font-optical-sizing: auto;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

body {
  margin: 0;
  min-height: 100dvh;
}

::selection {
  background: var(--red);
  color: var(--sheet);
}

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

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

a:hover {
  text-decoration-color: var(--red);
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.4rem, 5.2vw, 4.4rem);
  font-weight: 600;
}

h2 {
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
}

p {
  margin: 0;
  max-width: var(--measure);
}

p + p {
  margin-top: 1em;
}

code,
pre,
kbd {
  font-family: var(--mono);
  font-size: 0.86em;
}

code {
  background: rgba(26, 25, 23, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

/* Code is set on a sheet, like everything else you send or receive. */
pre {
  margin: 0;
  padding: 18px 22px;
  overflow-x: auto;
  background: var(--sheet);
  color: var(--ink);
  line-height: 1.55;
  tab-size: 2;
  box-shadow: var(--shadow-sheet);
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.82rem;
}

pre .c {
  color: var(--ink-2);
  font-style: italic;
}
pre .k {
  color: var(--red-ink);
}
pre .s {
  font-weight: 500;
}

/* Any sheet: white stock with a soft, offset shadow. */
.sheet {
  background: var(--sheet);
  box-shadow: var(--shadow-sheet);
}

/* A sheet never lies on another sheet: inside one, code is just ruled off. */
.sheet pre,
.new-key pre,
.note pre,
.result pre {
  box-shadow: none;
  border: 1px solid var(--rule);
  background: var(--paper);
}

.num {
  font-variant-numeric: tabular-nums;
}

/* Layout ------------------------------------------------------------ */

.wrap {
  width: min(1200px, 100% - 2 * var(--gutter));
  margin-inline: auto;
}

header.site {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
}

.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand svg {
  width: 20px;
  height: 20px;
}

header.site nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  font-family: var(--display);
  font-size: 0.95rem;
}

header.site nav a {
  text-decoration: none;
}

header.site nav a:hover {
  text-decoration: underline;
  text-decoration-color: var(--red);
}

header.site nav .nav-cta {
  padding: 9px 14px;
  font-size: 0.9rem;
  margin-left: 6px;
}

header.site nav .nav-cta:hover {
  text-decoration: none;
}

/* Buttons ---------------------------------------------------------- */

.btn {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1;
  padding: 13px 18px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--sheet);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition:
    background-color 160ms var(--ease),
    color 160ms var(--ease),
    transform 160ms var(--ease);
}

.btn:hover {
  background: var(--red);
  border-color: var(--red);
}

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 0 0 1px rgba(26, 25, 23, 0.2) inset;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
}

.btn.ghost:hover {
  background: var(--ink);
  color: var(--sheet);
  border-color: var(--ink);
}

.btn:disabled,
.btn[aria-busy="true"] {
  opacity: 0.55;
  cursor: progress;
  transform: none;
}

/* Forms ------------------------------------------------------------ */

input[type="email"],
input[type="text"],
input[type="number"],
textarea,
select {
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--rule);
  box-shadow: 0 1px 2px rgba(26, 25, 23, 0.06) inset;
  padding: 12px 14px;
  width: 100%;
  caret-color: var(--red);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 0;
  border-color: var(--red);
}

textarea {
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.5;
  resize: vertical;
}

label {
  font-family: var(--display);
  font-size: 0.9rem;
  font-weight: 500;
  display: block;
  margin-bottom: 6px;
}

.field + .field {
  margin-top: 16px;
}

.hint {
  color: var(--ink-2);
  font-size: 0.92rem;
}

.err {
  color: var(--red-ink);
}

/* Rules + tables --------------------------------------------------- */

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
}

th,
td {
  text-align: left;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

th {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.9rem;
}

td.num,
th.num {
  text-align: right;
}

/* Footer ----------------------------------------------------------- */

footer.site {
  border-top: 1px solid var(--rule);
  padding: 32px 0 48px;
  color: var(--ink-2);
  font-size: 0.92rem;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  justify-content: space-between;
}

footer.site a {
  text-decoration-color: var(--rule);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
