/* Reset, type, forms, layout helpers. */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 1rem); }
body {
  min-height: 100vh; min-height: 100dvh;
  background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: var(--t-base); line-height: 1.55;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}
a { color: var(--brand-ink); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--brand); }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
ul[class], ol[class] { list-style: none; }
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--brand-soft); color: var(--ink); }
[hidden] { display: none !important; }

h1, h2, .display { font-family: var(--display); font-weight: 650; letter-spacing: -.03em; line-height: 1.12; }
h1 { font-size: var(--t-2xl); letter-spacing: -.045em; }
h2 { font-size: var(--t-lg); }
h3 { font-size: var(--t-base); font-weight: 600; letter-spacing: -.015em; }
p + p { margin-top: var(--s-2); }
strong, b { font-weight: 600; }
code, pre { font-family: var(--mono); font-size: .85em; }
pre { white-space: pre-wrap; word-break: break-word; background: var(--soft); padding: var(--s-3); border-radius: var(--r-sm); }
code.id { font-size: var(--t-xs); color: var(--ink-3); word-break: break-all; }
small, .small { font-size: var(--t-sm); }
.muted { color: var(--ink-3); }
.lead { font-size: var(--t-md); color: var(--ink-2); }
.eyebrow { font-size: var(--t-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .09em; color: var(--brand); }
.num { font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 100; background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: var(--r-sm); text-decoration: none; }
.skip:focus { top: 1rem; color: #fff; }

/* ---------- Forms ---------- */
label { font-weight: 500; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea {
  display: block; width: 100%; min-height: 2.75rem; padding: .55rem .8rem;
  border: 0; border-radius: var(--r-sm); background: #fff;
  box-shadow: inset 0 0 0 1px var(--edge-strong), 0 1px 2px rgba(28, 27, 25, .05);
  font-size: var(--t-md); line-height: 1.4;
  transition: box-shadow var(--dur);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: .8; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--brand), var(--ring); }
select { appearance: none; padding-right: 2.2rem; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B645B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right .7rem center; }
textarea { resize: vertical; min-height: 5rem; }
input[type=checkbox], input[type=radio] { width: 1.15rem; height: 1.15rem; accent-color: var(--brand); flex: none; }
.field { display: grid; gap: .35rem; align-content: start; }  /* in a grid row next to a taller field: no stretched input */
.field > label, .field__label { font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); }
.field--error input, .field--error select, .field--error textarea { box-shadow: inset 0 0 0 1.5px var(--danger); }
.help { font-size: var(--t-sm); color: var(--ink-3); }
.error { font-size: var(--t-sm); color: var(--danger); font-weight: 500; }
.req { font-weight: 400; color: var(--ink-3); }
.check { display: flex; align-items: center; gap: .55rem; font-weight: 500; min-height: 2.75rem; }
.group { display: grid; gap: var(--s-4); border: 0; padding: var(--s-4); border-radius: var(--r-md); background: var(--well); box-shadow: var(--well-edge); }
.group > legend { float: left; width: 100%; padding: 0; font-size: var(--t-sm); font-weight: 600; color: var(--ink); }
.group > legend + * { clear: both; }
.field-row { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
.row-block { display: grid; gap: var(--s-3); padding: var(--s-3); border-radius: var(--r-sm); background: #fff; box-shadow: inset 0 0 0 1px var(--edge); }
.row-block__title { font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); }
/* desktop: fields as tall as buttons (2.5rem); phones keep 2.75rem and 16px against zoom-in */
@media (min-width: 52.01rem) {
  input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select { min-height: 2.5rem; padding: .45rem .75rem; font-size: var(--t-base); }
  textarea { font-size: var(--t-base); }
  select { padding-right: 2.2rem; }
  .check { min-height: 2.25rem; }
}

/* ---------- Layout helpers ---------- */
.stack { display: grid; gap: var(--s-4); align-content: start; }
.stack--sm { gap: var(--s-2); }
.stack--lg { gap: var(--s-6); }
.cluster, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.actions > form { display: contents; }
.inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.inline > label { font-size: var(--t-sm); color: var(--ink-2); }
.inline select, .inline input:not([type=hidden]) { width: auto; min-width: 9rem; flex: 1 1 9rem; }
.grid, .grid2 { display: grid; gap: var(--s-4); }
@media (min-width: 52rem) { .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.plain { list-style: none; display: grid; gap: var(--s-1); }
ol.plain { list-style: decimal; padding-left: 1.2rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
