/*
 * Design tokens, reset, and base typography.
 *
 * Loaded via `stylesheet_link_tag :app`, which includes every CSS file under
 * app/assets in alphabetical order. That gives us a deliberate cascade:
 *
 *   application.css  -> tokens, reset, base elements, buttons, utilities
 *   components.css   -> header, footer, panels, tables, forms
 *   pages.css        -> hero, sections, and page-specific layout
 *
 * If you add a file, name it so it sorts into the right place.
 */

:root {
  /* Brand. Deep shop green, warm paper, rust accent. */
  --green-900: #123026;
  --green-700: #1f4d3d;
  --green-500: #2f7159;
  --green-100: #dfeae4;
  --rust-600: #a8452a;
  --rust-500: #c25336;
  --rust-100: #f7e3dc;

  --paper: #fbf8f3;
  --paper-sunk: #f2ede4;
  --ink: #1c1b19;
  --ink-soft: #55514b;
  --rule: #ddd6ca;

  --bg: var(--paper);
  --bg-sunk: var(--paper-sunk);
  --bg-raised: #ffffff;
  --text: var(--ink);
  --text-soft: var(--ink-soft);
  --border: var(--rule);
  --brand: var(--green-700);
  --brand-strong: var(--green-900);
  --brand-wash: var(--green-100);
  --accent: var(--rust-600);
  --accent-wash: var(--rust-100);

  --font-sans: "Iowan Old Style", "Palatino Linotype", "Source Serif Pro", Georgia, serif;
  --font-ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --measure: 68ch;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius: 6px;
  --shadow: 0 1px 2px rgb(28 27 25 / 6%), 0 6px 18px rgb(28 27 25 / 6%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181a;
    --bg-sunk: #1c1f21;
    --bg-raised: #212528;
    --text: #ece8e1;
    --text-soft: #a8a49c;
    --border: #34383c;
    --brand: #79c0a3;
    --brand-strong: #a5d8c1;
    --brand-wash: #1c2f28;
    --accent: #e58d6f;
    --accent-wash: #33211b;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 18px rgb(0 0 0 / 25%);
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4 {
  font-family: var(--font-ui);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.2rem; }

p, ul, ol, dl, table, address { margin: 0 0 1.15em; }

address { font-style: normal; }

a {
  color: var(--brand);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover { color: var(--accent); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

img { max-width: 100%; height: auto; display: block; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--bg-sunk);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* --- Layout primitives --------------------------------------------------- */

.wrapper {
  width: min(72rem, 100%);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrapper--narrow { width: min(46rem, 100%); }

.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }

.section--muted {
  background: var(--bg-sunk);
  border-block: 1px solid var(--border);
}

.section__heading { margin-bottom: 1rem; }

.section__intro {
  color: var(--text-soft);
  max-width: var(--measure);
  margin-bottom: 2rem;
}

.section__header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.section__link { font-family: var(--font-ui); font-size: 0.95rem; }

/* Two-column page body with a sidebar that drops below on narrow screens. */
.split {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
  align-items: start;
}

.split__aside { display: grid; gap: 1.25rem; position: sticky; top: 1.5rem; }

.two-up {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
}

@media (max-width: 60rem) {
  .split { grid-template-columns: 1fr; }
  .split__aside { position: static; }
}

/* --- Prose --------------------------------------------------------------- */

.prose { max-width: var(--measure); }
.prose h2 { margin-top: 2.25rem; }
.prose h2:first-child { margin-top: 0; }
.prose li { margin-bottom: 0.4em; }

.lede {
  font-size: clamp(1.15rem, 2.2vw, 1.375rem);
  line-height: 1.5;
  color: var(--text-soft);
  max-width: var(--measure);
}

.eyebrow {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.pull-quote {
  font-size: 1.25rem;
  line-height: 1.45;
  border-left: 4px solid var(--brand);
  padding-left: 1.25rem;
  margin-left: 0;
  color: var(--text);
}

.small { font-size: 0.9rem; color: var(--text-soft); }
.centered { text-align: center; }
.empty { padding: 2rem 0; color: var(--text-soft); }

.list { padding-left: 1.15rem; }
.list li { margin-bottom: 0.4em; }

.steps { padding-left: 1.25rem; }
.steps li { margin-bottom: 0.9em; }

/* --- Buttons ------------------------------------------------------------- */

.button {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.7em 1.15em;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--brand);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.button:hover {
  background: var(--brand-wash);
  color: var(--brand-strong);
  border-color: var(--brand);
}

.button--accent {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.button--accent:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
  color: #fff;
}

.button--ghost { background: transparent; }

.button--small { font-size: 0.85rem; padding: 0.5em 0.85em; }

.button--block { display: block; text-align: center; width: 100%; }

/* --- Accessibility helpers ----------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 100;
  background: var(--brand);
  color: #fff;
  padding: 0.75rem 1rem;
  font-family: var(--font-ui);
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* Unfilled values from config/site.yml, so they cannot quietly ship. */
.placeholder {
  background: var(--accent-wash);
  color: var(--accent);
  border-bottom: 1px dashed currentcolor;
  padding: 0 0.15em;
  font-style: italic;
}

@media print {
  .masthead .nav, .cta, .skip-link { display: none; }
}
