/* =========================================================================
   Лаборатория №40 — Landing v6
   Foundation: tokens, type, layout primitives, dot-population motif
   ========================================================================= */

/* ---- Tokens ---- */
:root {
  /* surfaces */
  --bg-page: #1F2430;
  --bg-section: #242A38;
  --bg-card: #262C3D;
  --bg-deep: #1A1F2A;
  --bg-card-2: #2B3243;

  /* text */
  --text-heading: #F2EFE8;
  --text-body: #E8E4DC;
  --text-muted: #A8ADB8;
  --text-mono: #8E94A2;

  /* accent (bordo) — overridable via Tweaks */
  --accent: #A8413E;
  --accent-hover: #B85249;
  --accent-glow: rgba(168, 65, 62, 0.25);
  --accent-soft: rgba(168, 65, 62, 0.12);

  /* status */
  --ok: #6FAE6A;
  --warn: #C9A24B;
  --error: #D4615A;

  /* lines */
  --border: rgba(242, 239, 232, 0.09);
  --border-strong: rgba(242, 239, 232, 0.16);
  --hair: rgba(242, 239, 232, 0.06);

  /* radii */
  --r-sm: 6px;
  --r: 8px;
  --r-md: 12px;
  --r-lg: 16px;

  /* shadow */
  --shadow-card: 0 1px 0 rgba(242,239,232,0.03) inset, 0 18px 40px -24px rgba(0,0,0,0.6);
  --shadow-pop: 0 30px 70px -30px rgba(0,0,0,0.75), 0 2px 0 rgba(242,239,232,0.04) inset;

  /* type */
  --font-sans: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;

  /* layout */
  --maxw: 1180px;
  --gutter: clamp(20px, 5vw, 64px);
  --nav-h: 72px;
  --section-min-h: 100vh;

  /* motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --reveal-y: 18px;
}

@supports (height: 100svh) {
  :root { --section-min-h: 100svh; }
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv05";
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent); color: #fff; }

/* ---- Type ---- */
h1, h2, h3, h4 {
  color: var(--text-heading);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.018em;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(2.35rem, 1.4rem + 3.7vw, 3.7rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.9rem, 1.3rem + 2.3vw, 2.75rem); }
h3 { font-size: clamp(1.15rem, 1rem + 0.6vw, 1.4rem); letter-spacing: -0.01em; }
p { margin: 0; }
strong { color: var(--text-heading); font-weight: 600; }

.lede {
  font-size: clamp(1.05rem, 1rem + 0.35vw, 1.22rem);
  line-height: 1.6;
  color: var(--text-body);
  max-width: 54ch;
  text-wrap: pretty;
}
.muted { color: var(--text-muted); }

/* mono eyebrow / labels */
.mono {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mono);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mono);
}
.eyebrow::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  flex: none;
}

/* ---- Layout ---- */
.section {
  position: relative;
  padding-block: clamp(72px, 9vw, 132px);
  scroll-margin-top: var(--nav-h);
}
.section--tight { padding-block: clamp(40px, 5vw, 64px); }
.section--page { background: var(--bg-page); }
.section--alt { background: var(--bg-section); }
.section--deep { background: var(--bg-deep); }
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide { max-width: 1320px; }

.section-head { max-width: 60ch; margin-bottom: clamp(34px, 4vw, 56px); }
.section-head .eyebrow { margin-bottom: 18px; }
.section-head h2 + p { margin-top: 18px; }

/* ---- Buttons ---- */
.btn {
  --pad-y: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: var(--pad-y) 26px;
  border-radius: var(--r);
  font-weight: 550;
  font-size: 1rem;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
  transition: background .2s var(--ease), border-color .2s var(--ease),
              transform .15s var(--ease), box-shadow .25s var(--ease), color .2s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: #FBF4EE;
  box-shadow: 0 0 0 0 var(--accent-glow), 0 10px 26px -14px var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 0 5px var(--accent-glow), 0 14px 30px -14px var(--accent);
}
.btn-ghost {
  background: transparent;
  color: var(--text-body);
  border-color: var(--border-strong);
}
.btn-ghost:hover { border-color: var(--text-muted); background: rgba(242,239,232,0.04); }
.btn-sm { --pad-y: 10px; padding: 10px 18px; font-size: 0.92rem; }
.btn-lg { --pad-y: 16px; padding: 17px 32px; font-size: 1.05rem; }
.arrow { transition: transform .2s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

/* link with arrow */
.link-arrow {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--text-heading); font-weight: 500;
  border-bottom: 1px solid var(--border-strong);
  padding-bottom: 2px;
  transition: border-color .2s, color .2s;
}
.link-arrow:hover { border-color: var(--accent); color: #fff; }
.link-arrow .arrow { transition: transform .2s var(--ease); }
.link-arrow:hover .arrow { transform: translateX(3px); }

/* ---- Card ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
}

/* ---- Chips / badges ---- */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  background: rgba(242,239,232,0.02);
  white-space: nowrap;
}
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-mono); flex: none; }
.chip--verdict { color: var(--text-heading); border-color: var(--accent); background: var(--accent-soft); }
.chip--verdict .chip-dot { background: var(--accent); }
.chip--ok { color: #cfe8cc; border-color: rgba(111,174,106,0.4); background: rgba(111,174,106,0.10); }
.chip--ok .chip-dot { background: var(--ok); }
.chip--warn { color: #ecdcb0; border-color: rgba(201,162,75,0.4); background: rgba(201,162,75,0.10); }
.chip--warn .chip-dot { background: var(--warn); }

/* ---- Dot-population motif ---- */
/* A reusable "calibrated cohort" cloud. Dots are absolutely positioned by JS
   inside a square .dotcloud; a few carry .is-hot (accent). */
.dotcloud { position: relative; }
.dotcloud .dot {
  position: absolute;
  width: var(--d, 6px); height: var(--d, 6px);
  margin: calc(var(--d, 6px) / -2);
  border-radius: 50%;
  background: var(--text-mono);
  opacity: 0;
  transform: scale(0.2);
  transition: opacity .6s var(--ease), transform .7s var(--ease);
  transition-delay: var(--delay, 0ms);
}
.dotcloud .dot.is-hot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dotcloud.settled .dot { opacity: var(--o, 0.9); transform: scale(1); }
.dotcloud .ring {
  position: absolute; inset: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  opacity: 0;
  transition: opacity .8s var(--ease);
}
.dotcloud.settled .ring { opacity: 1; }

/* ---- Reveal on scroll ---- */
.reveal {
  opacity: 0;
  transform: translateY(var(--reveal-y));
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: var(--rd, 0ms);
}
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}
:root.no-motion .reveal { opacity: 1; transform: none; transition: none; }
:root.no-motion .dotcloud .dot { opacity: var(--o, 0.9); transform: scale(1); transition: none; }
:root.no-motion .dotcloud .ring { opacity: 1; transition: none; }

/* ---- Utility ---- */
.stack > * + * { margin-top: var(--s, 16px); }
.grid { display: grid; gap: clamp(16px, 2vw, 24px); }
.flex { display: flex; }
.center { align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.gap-sm { gap: 10px; }
.gap { gap: 16px; }
.gap-lg { gap: 28px; }
.nowrap { white-space: nowrap; }
.accent { color: var(--accent-hover); }
.tnum { font-variant-numeric: tabular-nums; }
