/* ===========================================================
   STANIMAL — Base CSS v2
   Reset, body, typography, layout helpers, buttons, inputs.
   Ported from design/styles.css (Editorial-Industrial 2026).
   =========================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-900);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "kern", "cv11";
  font-optical-sizing: auto;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; padding: 0; color: inherit; }
img, svg { display: block; max-width: 100%; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--ink-900); color: var(--bg); }

/* ---------- Containers ---------- */
.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.container-narrow { max-width: var(--container-narrow); margin: 0 auto; padding: 0 var(--gutter); }
.container-wide { max-width: 100%; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Layout helpers ---------- */
.page-content { padding-top: var(--space-10); padding-bottom: var(--space-16); }
.row { display: flex; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: var(--space-1); } .gap-2 { gap: var(--space-2); } .gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); } .gap-6 { gap: var(--space-6); } .gap-8 { gap: var(--space-8); }
.center { align-items: center; } .between { justify-content: space-between; }
.grow { flex: 1; }

/* ---------- Typography ---------- */
.eyebrow,
.mono-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink-500);
}
.mono-label.hot { color: var(--hot); }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-feature-settings: "ss01","ss02"; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 0.95;
  font-variation-settings: "wdth" 90;
  text-wrap: balance;
}
h1 {
  font-size: clamp(56px, 9.2vw, 168px);
  font-weight: 600;
  letter-spacing: -0.04em;
  font-variation-settings: "wdth" 85;
  line-height: 0.9;
}
h2 {
  font-size: clamp(34px, 5.4vw, 84px);
  letter-spacing: -0.035em;
  font-variation-settings: "wdth" 88;
}
h3 { font-size: clamp(22px, 1.8vw, 28px); letter-spacing: -0.02em; }
h4 { font-size: 17px; letter-spacing: -0.01em; line-height: 1.1; font-family: var(--font); font-weight: 600; }

p { margin: 0; }
.lede {
  font-size: clamp(17px, 1.35vw, 22px);
  color: var(--ink-700);
  max-width: 50ch;
  line-height: 1.4;
  text-wrap: pretty;
  font-weight: 400;
}
.muted { color: var(--ink-500); }

/* Index numerals / stamps */
.idx {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-500);
  text-transform: uppercase;
}
.section-stamp {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-700);
}
.section-stamp::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--hot);
  display: inline-block;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 10px;
  padding: 14px 22px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background .18s ease, color .18s ease, transform .12s ease, border-color .18s ease;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 0;
  white-space: nowrap;
  position: relative;
}
.btn::after {
  content: "↗";
  font-family: var(--font-mono);
  font-size: 13px;
  margin-left: 4px;
  transition: transform .2s ease;
}
.btn.no-arrow::after { display: none; }
.btn:hover::after { transform: translate(2px,-2px); }

.btn-primary { background: var(--ink-900); color: var(--bg); border-color: var(--ink-900); }
.btn-primary:hover { background: var(--hot); border-color: var(--hot); color: #fff; }
.btn-primary:active { transform: scale(.98); }

.btn-outline { border-color: var(--line-strong); color: var(--ink-900); background: transparent; }
.btn-outline:hover { background: var(--ink-900); color: var(--bg); }

.btn-hot { background: var(--hot); color: #fff; border-color: var(--hot); }
.btn-hot:hover { background: var(--ink-900); border-color: var(--ink-900); }

.btn-ghost { color: var(--ink-900); padding: 0; min-height: auto; }
.btn-ghost::after { display: none; }
.btn-ghost:hover { color: var(--hot); }

.btn-block { width: 100%; }
.btn-lg { padding: 18px 28px; font-size: 12px; min-height: 56px; }
.btn-sm { padding: 8px 14px; min-height: 32px; font-size: 11px; }

/* ---------- Inputs ---------- */
.input, .select, .textarea {
  width: 100%;
  padding: 14px 16px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-900);
  letter-spacing: 0.01em;
  transition: border-color .18s ease;
  border-radius: 0;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-400); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-bottom-color: var(--ink-900);
}
.input.boxed {
  border: 1px solid var(--line);
  padding: 14px 16px;
}
.input.boxed:focus { border-color: var(--ink-900); }
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-900) 50%), linear-gradient(135deg, var(--ink-900) 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 12px) center;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}
.label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
  color: var(--ink-500);
}
.label .req { color: var(--hot); }
.field { display: flex; flex-direction: column; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }

/* ---------- Cards (hairline cells, no border-radius) ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
}

/* ---------- Misc ---------- */
.icon { width: 18px; height: 18px; stroke-width: 1.6; }
.icon-lg { width: 22px; height: 22px; }
.divider { height: 1px; background: var(--line); margin: var(--space-10) 0; }
.divider-strong { height: 1px; background: var(--line-strong); margin: var(--space-10) 0; }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---------- Breadcrumbs ---------- */
.crumbs {
  display: flex; flex-wrap: wrap; gap: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin: var(--space-6) 0 var(--space-8);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--line);
}
.crumbs a:hover { color: var(--hot); }
.crumbs span.sep { color: var(--ink-300); }
.crumbs .current { color: var(--ink-900); }

/* ---------- Section scaffold ---------- */
.section { padding: var(--space-20) 0; position: relative; }
.section.pt-0 { padding-top: 0; }

.section-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: var(--space-6);
  margin-bottom: var(--space-12);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--line-strong);
}
.section-head .stamp {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-500);
  display: inline-flex;
  gap: 10px;
  align-items: center;
}
.section-head .stamp .dot { width: 6px; height: 6px; background: var(--hot); display: inline-block; }
.section-head h2 { letter-spacing: -0.035em; margin: 0; text-align: right; }
.section-head .link {
  justify-self: start;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-700);
  white-space: nowrap;
  border-bottom: 1px solid var(--ink-700);
  padding-bottom: 2px;
}
.section-head .link:hover { color: var(--hot); border-color: var(--hot); }

/* ---------- Empty state ---------- */
.empty {
  padding: var(--space-20) var(--space-6);
  text-align: center;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-500);
}

/* ---------- Accessibility: Focus ---------- */
:focus { outline: none; }
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
.btn:focus-visible,
.icon-btn:focus-visible {
  outline: 2px solid var(--hot);
  outline-offset: 3px;
}

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

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
  .section-head { grid-template-columns: 1fr; }
  .section-head h2 { text-align: left; }
  .section-head .link { justify-self: end; }
}
