/* ============================================================
   VIKO CHEAT — Base
   Reset, document typography, containers, utilities.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
  color-scheme: dark;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface-0);
  color: var(--tx);
  font-family: var(--font-body);
  font-stretch: var(--stretch-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
p { margin: 0 0 var(--space-4); }
p:last-child { margin-bottom: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-6) 0; }
table { border-collapse: collapse; }

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-3);
  font-family: var(--font-display);
  font-stretch: var(--stretch-head);
  color: var(--tx-strong);
  font-weight: 700;
  line-height: var(--lh-head);
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); font-weight: 800; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); letter-spacing: -0.01em; }
h4 { font-size: 1.0625rem; }
h5 { font-size: var(--fs-small); }

strong, b { color: var(--tx-strong); font-weight: 650; }
small { font-size: var(--fs-caption); }

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}
code {
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: rgba(200, 210, 222, 0.06);
  border: 1px solid var(--line);
  color: var(--tx-strong);
  word-break: break-all;
}

::selection { background: var(--c-blue); color: var(--tx-on-blue); }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--c-cyan);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

/* Thin themed scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--surface-4) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-4); border: 3px solid var(--surface-0); border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

[hidden] { display: none !important; }

/* ── Containers ──────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: calc(var(--container-max) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.container-wide { max-width: calc(var(--container-wide) + var(--gutter) * 2); }
.container-narrow { max-width: calc(860px + var(--gutter) * 2); }

.section { position: relative; padding: var(--space-9) 0; }
.section-tight { padding: var(--space-7) 0; }

/* ── Skip link ───────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: calc(var(--z-toast) + 1);
  padding: var(--space-2) var(--space-4);
  background: var(--c-paper);
  color: var(--tx-on-paper);
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: top var(--dur-2) var(--ease-out);
}
.skip-link:focus { top: var(--space-3); }

/* ── Grids ───────────────────────────────────────────────── */
.grid-2, .grid-3, .grid-4 { display: grid; gap: var(--space-5); }
.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)); }
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px)  { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ── Utilities ───────────────────────────────────────────── */
.visually-hidden, .sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--tx-muted); }
.text-strong { color: var(--tx-strong); }
.text-electric, .text-accent { color: var(--c-blue); }
.text-danger { color: var(--c-red); }
.text-success { color: var(--c-green); }
.mono { font-family: var(--font-mono); }
.mb-0 { margin-bottom: 0 !important; }
.mt-auto { margin-top: auto; }
.gap-2 { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.hide-mobile { }
@media (max-width: 720px) { .hide-mobile { display: none !important; } }
.show-mobile { display: none !important; }
@media (max-width: 720px) { .show-mobile { display: revert !important; } }

/* Icons rendered by icon() */
.i {
  width: 1.15em;
  height: 1.15em;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  display: inline-block;
  vertical-align: -0.2em;
}
.i-fill { fill: currentColor; stroke: none; }
