/* =====================================================================
   Reset, typography and small utilities.
   ===================================================================== */

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

* { margin: 0; }

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

body {
  font-family: var(--font);
  font-size: var(--t-base);
  line-height: 1.55;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-wrap: break-word;
}

body.no-scroll { overflow: hidden; }

img, svg, video, canvas { display: block; max-width: 100%; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; background: none; border: 0; padding: 0; }

a {
  color: var(--brand-strong);
  text-decoration: none;
  transition: color var(--fast);
}
a:hover { color: var(--brand-deep); }

h1, h2, h3, h4, h5 {
  font-weight: 750;
  line-height: 1.22;
  letter-spacing: -0.017em;
  color: var(--ink);
}

h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }
h4 { font-size: var(--t-md); }
h5 { font-size: var(--t-base); }

p { color: var(--ink-soft); }

ul, ol { padding-left: 1.15rem; }
ul.plain, ol.plain { list-style: none; padding: 0; }

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1rem 0;
}

code, kbd, pre {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 0.86em;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::selection {
  background: var(--brand-muted);
  color: var(--brand-deep);
}

/* Thin scrollbars on desktop */
@media (min-width: 900px) {
  * { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
  *::-webkit-scrollbar { width: 9px; height: 9px; }
  *::-webkit-scrollbar-track { background: transparent; }
  *::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: var(--r-pill);
    border: 2px solid var(--page);
  }
}

/* ---------------------------------------------------------------- icons */

.icon { flex: 0 0 auto; }

/* ---------------------------------------------------------- utilities */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.shell-wide { max-width: var(--shell-wide); }
.shell-slim { max-width: var(--shell-slim); }

.stack      { display: flex; flex-direction: column; }
.stack-1    { gap: 4px; }
.stack-2    { gap: 8px; }
.stack-3    { gap: 12px; }
.stack-4    { gap: 16px; }
.stack-5    { gap: 22px; }
.stack-6    { gap: 30px; }

.row        { display: flex; align-items: center; gap: 10px; }
.row-tight  { gap: 6px; }
.row-loose  { gap: 18px; }
.row-top    { align-items: flex-start; }
.row-base   { align-items: baseline; }
.row-wrap   { flex-wrap: wrap; }
.row-between{ justify-content: space-between; }
.row-center { justify-content: center; }
.row-end    { justify-content: flex-end; }
.grow       { flex: 1 1 auto; min-width: 0; }
.shrink-0   { flex: 0 0 auto; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto    { grid-template-columns: 1fr; }
.grid-auto-sm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-auto-lg { grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .grid-auto    { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-auto-sm { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-auto-lg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .grid-auto    { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-auto-sm { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-auto-lg { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.t-xs { font-size: var(--t-xs); }
.t-sm { font-size: var(--t-sm); }
.t-md { font-size: var(--t-md); }
.t-lg { font-size: var(--t-lg); }
.t-xl { font-size: var(--t-xl); }
.t-2xl{ font-size: var(--t-2xl); }

.w-400 { font-weight: 400; }
.w-500 { font-weight: 500; }
.w-600 { font-weight: 600; }
.w-700 { font-weight: 700; }
.w-800 { font-weight: 800; }

.muted   { color: var(--ink-muted); }
.soft    { color: var(--ink-soft); }
.faint   { color: var(--ink-faint); }
.ink     { color: var(--ink); }
.brand   { color: var(--brand-strong); }
.pos     { color: var(--ok-700); }
.neg     { color: var(--bad-700); }
.warn    { color: var(--warn-700); }

.block   { display: block; }
.center  { text-align: center; }
.right   { text-align: right; }
.left    { text-align: left; }
.nowrap  { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.upper   { text-transform: uppercase; letter-spacing: 0.06em; }

.clamp-1, .clamp-2, .clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.clamp-1 { -webkit-line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; }

.mt-0 { margin-top: 0; }   .mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; }
.mt-4 { margin-top: 26px; } .mt-5 { margin-top: 36px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.mb-4 { margin-bottom: 26px; } .mb-5 { margin-bottom: 36px; }

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

/* Hide by breakpoint without declaring a display value for the visible state,
   so each element keeps whatever display its own rule sets. */
@media (max-width: 859px) { .desktop-only { display: none !important; } }
@media (min-width: 860px) { .mobile-only  { display: none !important; } }

.scroll-x {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x > * { scroll-snap-align: start; flex: 0 0 auto; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 2000;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: var(--t-sm);
}
.skip-link:focus { top: 10px; color: #fff; }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  font-size: var(--t-xs);
  color: var(--ink-muted);
}
.crumbs li { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.crumbs li:not(:last-child)::after {
  content: "/";
  color: var(--ink-faint);
}
.crumbs a { color: var(--ink-muted); }
.crumbs a:hover { color: var(--brand-strong); }
.crumbs [aria-current="page"] {
  color: var(--ink-soft);
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 42ch;
}

@media (max-width: 720px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: var(--t-xl); }
}
@media (max-width: 560px) {
  .grid-3 { grid-template-columns: 1fr; }
}
