/*
 * Colours are the Mukaase design tokens from pantry-app/docs/DESIGN.md.
 * Type is a system stack: these pages are read on a phone, usually from inside
 * the app, where -apple-system is the real SF Pro. No webfonts are loaded.
 * DESIGN.md sets Newsreader for display type; ui-serif is the closest honest
 * match available without a network request.
 */

:root {
  --surface: #efece6;
  --surface-bright: #ffffff;
  --surface-container: #e4e0d8;
  --on-surface: #23262a;
  --on-surface-variant: #5f656a;
  --primary: #1f4d3a;
  --outline: #d3cec5;
  --outline-variant: #e3dfd8;
  --warning: #9e4a2c;

  --measure: 40rem;
  --radius: 12px;
  --gutter: 20px;

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: ui-serif, "Newsreader", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #1a1f1c;
    --surface-bright: #242a26;
    --surface-container: #2e3531;
    --on-surface: #f2eee6;
    --on-surface-variant: #a7aca8;
    --primary: #a8cdb5;
    --outline: #3a403b;
    --outline-variant: #3a403b;
    --warning: #e0a58a;
  }
}

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

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

body {
  margin: 0;
  padding: 0 var(--gutter) 4rem;
  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  overflow-wrap: break-word;
}

.masthead,
main,
footer {
  max-width: var(--measure);
  margin-inline: auto;
}

/* ------------------------------------------------------------- masthead */

.masthead {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: baseline;
  justify-content: space-between;
  padding: 1.75rem 0 1.25rem;
  border-bottom: 1px solid var(--outline-variant);
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--on-surface);
  text-decoration: none;
}

.masthead nav {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
}

.masthead nav [aria-current="page"] {
  color: var(--on-surface-variant);
}

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

h1 {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.25rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 2rem 0 0.5rem;
}

h2 {
  font-size: 1.3rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 2.75rem 0 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--outline-variant);
}

h3 {
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.3;
  margin: 2rem 0 0.5rem;
}

h4 {
  font-size: 1rem;
  font-weight: 650;
  margin: 1.5rem 0 0.5rem;
}

p,
ul,
ol {
  margin: 0 0 1.1rem;
}

li {
  margin-bottom: 0.4rem;
}

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

a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

strong {
  font-weight: 650;
}

hr {
  height: 1px;
  border: 0;
  background: var(--outline-variant);
  margin: 2rem 0;
}

code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--surface-container);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

blockquote {
  margin: 0 0 1.1rem;
  padding-left: 1rem;
  border-left: 2px solid var(--outline);
  color: var(--on-surface-variant);
}

/* ---------------------------------------------------------------- pages */

.updated {
  font-size: 0.875rem;
  color: var(--on-surface-variant);
  margin-bottom: 0.25rem;
}

.meta {
  font-size: 0.875rem;
  color: var(--on-surface-variant);
  margin-bottom: 0.25rem;
}

/* The first rule under the document header is structural, not a section break. */
.doc > hr:first-of-type {
  margin-top: 1.5rem;
}

.doc > h2:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.lede {
  font-size: 1.125rem;
}

.doclist {
  list-style: none;
  padding: 0;
}

.doclist li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--outline-variant);
}

.pending {
  font-size: 0.8125rem;
  color: var(--warning);
  margin-left: 0.5rem;
}

.holding p {
  max-width: 32rem;
}

/* --------------------------------------------------------------- tables */

.table-wrap {
  overflow-x: auto;
  margin: 0 0 1.25rem;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  background: var(--surface-bright);
}

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

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--outline-variant);
}

th {
  font-weight: 650;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

/* --------------------------------------------------------------- footer */

footer {
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--outline-variant);
  font-size: 0.8125rem;
  color: var(--on-surface-variant);
}

footer p {
  margin: 0;
}
