/* ── Fonts (self-hosted) ───────────────────────────────────────────────────── */
@font-face {
  font-family: 'Bricolage';
  src: url('/fonts/bricolage.woff2') format('woff2');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson';
  src: url('/fonts/atkinson-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson';
  src: url('/fonts/atkinson-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

/* ── Tokens ───────────────────────────────────────────────────────────────── */
:root {
  --plate: #e7ebef;      /* build-plate grey: page */
  --paper: #f9fafb;      /* surfaces */
  --ink: #16203d;        /* text and dark panels */
  --ink-2: #39445f;
  --ink-3: #5d6882;
  --line: #c3ccd8;
  --line-2: #dbe1e9;
  --heat: #ff5b1f;       /* nozzle orange */
  --heat-text: #c43400;  /* orange that passes contrast on light surfaces */
  --blue: #2f6bff; --violet: #6a4cff; --teal: #0b8f82; --amber: #b87900;
  --orange: #d9480f; --green: #1a8f52; --red: #cf2f2f; --gray: #6b7489;
  --radius: 12px;
  --display: 'Bricolage', 'Arial Narrow', system-ui, sans-serif;
  --body: 'Atkinson', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--plate);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.04; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }

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

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

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 26px;
  border: 1.5px solid var(--ink); border-radius: 10px;
  background: transparent; color: var(--ink);
  font-weight: 700; font-size: 1.0625rem; text-decoration: none; white-space: nowrap;
  transition: background-color 0.2s, color 0.2s, transform 0.15s var(--ease), opacity 0.2s;
  overflow: hidden; isolation: isolate;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled='true'] { opacity: 0.45; cursor: not-allowed; }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--heat);
  transform: scaleX(0); transform-origin: left; transition: transform 0.35s var(--ease);
}
.btn--primary:not([disabled]):hover::after, .btn--primary:focus-visible::after { transform: scaleX(1); }
.btn--ghost { border-color: transparent; padding: 0 14px; }
.btn--ghost:hover { background: rgba(22, 32, 61, 0.07); }
.btn--quiet { min-height: 40px; padding: 0 14px; font-size: 0.9375rem; border-color: var(--line); background: var(--paper); }
.btn--quiet:hover { border-color: var(--ink); }
.btn.is-loading { pointer-events: none; }
.btn.is-loading .btn__label { opacity: 0.5; }
.btn__spin {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.3); border-top-color: #fff; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Fields ───────────────────────────────────────────────────────────────── */
.field { display: grid; gap: 6px; }
.field__label { font-weight: 700; font-size: 0.9688rem; }
.field__hint { color: var(--ink-3); font-size: 0.875rem; }
.input {
  width: 100%; min-height: 52px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { padding: 12px 14px; min-height: 110px; resize: vertical; line-height: 1.45; }
.input::placeholder { color: #8791a8; }
.input:hover { border-color: #9aa6ba; }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255, 91, 31, 0.35); }
.field.has-error .input { border-color: var(--red); }
.field__error {
  display: none; align-items: flex-start; gap: 8px; color: var(--red); font-size: 0.9375rem; font-weight: 700;
}
.field.has-error .field__error { display: flex; animation: errIn 0.25s var(--ease); }
.field__error::before {
  content: '!'; flex: none; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: 12px; line-height: 18px; text-align: center;
}
@keyframes errIn { from { opacity: 0; transform: translateY(-4px); } }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toasts { position: fixed; z-index: 50; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
.toast {
  display: flex; gap: 12px; align-items: center; padding: 13px 16px; border-radius: 10px;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 0.9688rem;
  box-shadow: 0 10px 30px rgba(22, 32, 61, 0.3); pointer-events: auto;
  animation: toastIn 0.35s var(--ease);
}
.toast.is-error { background: #7a1616; }
.toast.is-out { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

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