/* =====================================================================
   Yauheni Tarasevich — портфолио full-stack (PHP + JS)
   Палитра и типографика по мотивам SABLE: bone #EFEDE8, ink #101010,
   Archivo 800 для заголовков, мелкие капс-подписи с разрядкой.
   ===================================================================== */

@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-latin-standard-normal.woff2") format("woff2-variations"),
       url("/assets/fonts/archivo-latin-standard-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations"),
       url("/assets/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- Токены: светлая тема «Bone» ---------- */
:root {
  --bg: #efede8;
  --surface: #e4e1dc;
  --surface-2: #dcd9d3;
  --surface-3: #d0ccc5;
  --ink: #101010;
  --ink-2: #4a4741;
  --mid: #8a8781;
  --mid-text: #66635d;
  --line: rgba(16, 16, 16, .14);
  --line-strong: rgba(16, 16, 16, .3);
  --inv-bg: #101010;
  --inv-fg: #efede8;
  --inv-mid: #8a8781;
  --inv-line: rgba(239, 237, 232, .16);
  --header-bg: rgba(239, 237, 232, .9);
  --shadow: 0 40px 80px -36px rgba(16, 16, 16, .45);

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --pad: clamp(16px, 3.05vw, 44px);
  --gap: 24px;
  --hdr-h: 72px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --ease-io: cubic-bezier(.7, 0, .2, 1);
  color-scheme: light;
}

/* ---------- Тёмная тема «Ink» ---------- */
:root[data-theme="dark"] {
  --bg: #101010;
  --surface: #191918;
  --surface-2: #21211f;
  --surface-3: #2b2a28;
  --ink: #efede8;
  --ink-2: #b4b0a8;
  --mid: #8a8781;
  --mid-text: #9d9991;
  --line: rgba(239, 237, 232, .13);
  --line-strong: rgba(239, 237, 232, .3);
  --inv-bg: #efede8;
  --inv-fg: #101010;
  --inv-mid: #66635d;
  --inv-line: rgba(16, 16, 16, .16);
  --header-bg: rgba(16, 16, 16, .86);
  --shadow: 0 40px 80px -36px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

/* Без JS тема берётся из системной настройки */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #101010; --surface: #191918; --surface-2: #21211f; --surface-3: #2b2a28;
    --ink: #efede8; --ink-2: #b4b0a8; --mid-text: #9d9991;
    --line: rgba(239, 237, 232, .13); --line-strong: rgba(239, 237, 232, .3);
    --inv-bg: #efede8; --inv-fg: #101010; --inv-mid: #66635d; --inv-line: rgba(16, 16, 16, .16);
    --header-bg: rgba(16, 16, 16, .86);
    color-scheme: dark;
  }
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--hdr-h) + 12px);
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--display);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

html.is-locked { overflow: hidden; }

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 800; }
ul, ol { margin: 0; padding: 0; }

kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 3px 5px 2px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  font: 500 10px/1 var(--mono);
  text-align: center;
  letter-spacing: 0;
  text-transform: none;
  color: inherit;
}

::selection { background: var(--ink); color: var(--bg); }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.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;
}

.skip {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  padding: 12px 16px;
  background: var(--ink); color: var(--bg);
  font: 600 12px/1 var(--display); letter-spacing: .14em; text-transform: uppercase;
  transition: top .2s;
}
.skip:focus { top: 12px; }

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; flex: none; }

/* ---------- Типографика ---------- */
.label {
  font: 500 11px/1.4 var(--display);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--mid-text);
}
.label--inv { color: var(--inv-mid); }

.title {
  font: 800 clamp(42px, 6.3vw, 96px)/.9 var(--display);
  letter-spacing: -.035em;
  text-transform: uppercase;
}
.title--xl { font-size: clamp(50px, 8.6vw, 136px); }
.title--inv { color: var(--inv-fg); }

.subtitle {
  font: 800 clamp(30px, 3.5vw, 52px)/.94 var(--display);
  letter-spacing: -.025em;
  text-transform: uppercase;
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font: 600 11.5px/1 var(--display);
  letter-spacing: .2em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background .35s var(--ease), color .35s var(--ease), box-shadow .35s var(--ease), gap .35s var(--ease);
}
.btn--solid {
  height: 46px;
  padding: 0 30px;
  background: var(--ink);
  color: var(--bg);
}
.btn--solid:hover { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.btn--line { padding: 6px 0; box-shadow: inset 0 -1px 0 currentColor; }
.btn--line:hover { gap: 18px; }
.btn--inv {
  height: 50px;
  padding: 0 30px;
  background: var(--inv-fg);
  color: var(--inv-bg);
}
.btn--inv:hover { background: transparent; color: var(--inv-fg); box-shadow: inset 0 0 0 1px var(--inv-fg); }

/* ---------- Шапка ---------- */
.hdr {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--hdr-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 var(--pad);
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(1.2) blur(12px);
  backdrop-filter: saturate(1.2) blur(12px);
  border-bottom: 1px solid var(--line);
}
.hdr__nav { display: flex; gap: 30px; }
.hdr__nav a,
.hdr__btn {
  position: relative;
  font: 500 11px/1 var(--display);
  letter-spacing: .2em;
  text-transform: uppercase;
}
.hdr__nav a { padding: 7px 0; }
.hdr__nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .45s var(--ease);
}
.hdr__nav a:hover::after,
.hdr__nav a[aria-current="true"]::after { transform: scaleX(1); transform-origin: left; }

/* Имя и фамилия в одну строку; на ноутбуках размер плавно уменьшается,
   чтобы логотип не упирался в меню и кнопки */
.hdr__mark {
  font: 800 clamp(17px, 1.53vw, 22px)/1 var(--display);
  font-stretch: 112%;
  letter-spacing: .3em;
  padding-left: .3em;
  text-transform: uppercase;
  white-space: nowrap;
}

.hdr__tools { justify-self: end; display: flex; align-items: center; gap: 24px; }
.hdr__btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 0; }
.hdr__search { color: var(--mid-text); transition: color .3s; }
.hdr__search:hover { color: var(--ink); }
.hdr__kbd { display: inline-flex; gap: 1px; }
.ico--shift { width: 13px; height: 13px; stroke-width: 1.3; stroke-linejoin: round; }
.theme-opt { color: var(--mid-text); transition: color .3s; }
.theme-sep { color: var(--mid-text); margin: 0 -2px; }
:root:not([data-theme="dark"]) .theme-opt[data-opt="light"],
:root[data-theme="dark"] .theme-opt[data-opt="dark"] { color: var(--ink); }
.ico--theme { display: none; }
.hdr__menu .ico { width: 18px; height: 18px; }

.hdr__progress {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  pointer-events: none;
}
.hdr__progress span {
  display: block;
  height: 100%;
  background: var(--ink);
  transform-origin: left;
  transform: scaleX(var(--progress, 0));
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: max(600px, calc(100svh - var(--hdr-h)));
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: auto minmax(300px, 1fr) auto;
  column-gap: var(--gap);
  padding: clamp(26px, 3.6vw, 52px) var(--pad) clamp(26px, 3vw, 40px);
  overflow: hidden;
  isolation: isolate;
}

.hero__cap {
  grid-row: 1;
  position: relative;
  z-index: 3;
  font: 600 12px/1.95 var(--display);
  letter-spacing: .22em;
  text-transform: uppercase;
}
.hero__cap--left { grid-column: 1 / span 4; }
.hero__cap--right { grid-column: 9 / -1; text-align: right; color: var(--mid-text); }
.hero__rule { display: block; width: 52px; height: 1px; margin-top: 16px; background: var(--ink); }

.hero__title {
  grid-area: 2 / 1 / 3 / -1;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--tower-gap) minmax(0, 1fr);
  align-items: center;
  pointer-events: none;
  --word: min(19.6vw, 38svh, 300px);
  --tower-gap: calc(var(--word) * .74);
}
.hero__word {
  font: 800 var(--word)/.76 var(--display);
  letter-spacing: -.05em;
  text-transform: uppercase;
  user-select: none;
  pointer-events: auto;
  transition: color .5s var(--ease), -webkit-text-stroke-color .5s;
  cursor: default;
}
.hero__word--php { grid-column: 1; justify-self: end; margin-right: -.04em; }
.hero__word--js { grid-column: 3; justify-self: start; }
.hero.is-dim .hero__word:not(.is-hot) { color: transparent; -webkit-text-stroke: 1px var(--line-strong); }

.hero__stage {
  grid-area: 2 / 1 / 3 / -1;
  position: relative;
  z-index: 2;
  min-height: 300px;
  pointer-events: none;
}
.hero__canvas {
  position: absolute;
  inset: -6% 0;
  width: 100%;
  height: 112%;
  opacity: 0;
  transition: opacity 1s var(--ease);
}
.hero.has-3d .hero__canvas { opacity: 1; }
.hero.has-3d .hero__fallback { opacity: 0; }
.hero__fallback {
  position: absolute;
  left: 50%;
  top: 50%;
  height: 96%;
  width: auto;
  max-width: none;
  transform: translate(-50%, -50%);
  transition: opacity .6s;
}
.hero__fallback .tw-t { fill: var(--surface); stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; }
.hero__fallback .tw-l { fill: var(--surface-2); }
.hero__fallback .tw-r { fill: var(--surface-3); }
.hero__fallback .tw-i { fill: none; stroke: var(--mid); stroke-width: .7; }
.hero__fallback .tw-e { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; }
.hero__fallback .tw-axis { fill: none; stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 5; opacity: .6; }
.hero__fallback .tw-dot { fill: var(--ink); }
.hero__fallback g { transition: transform .5s var(--ease); }
.hero__fallback g.is-hot .tw-t, .hero__fallback g.is-hot .tw-l, .hero__fallback g.is-hot .tw-r { fill: var(--ink); }

.hero__intro {
  grid-row: 3;
  grid-column: 1 / span 5;
  align-self: end;
  position: relative;
  z-index: 3;
}
.hero__lead { max-width: 46ch; margin-bottom: 26px; color: var(--ink-2); font-size: 15.5px; line-height: 1.6; }
.hero__lead strong { color: var(--ink); font-weight: 600; }
.hero__cta { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 30px; }
.hero__hint { margin-top: 22px; font: 400 11px/1 var(--mono); color: var(--mid-text); }
.hero__hint kbd { margin: 0 2px; }

.hero__scroll {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 10px;
  transform: translateX(-50%);
  font: 500 9.5px/1 var(--display);
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--mid-text);
}
.hero__scroll::after {
  content: "";
  width: 1px;
  height: 34px;
  background: linear-gradient(var(--ink), transparent);
  animation: scrollcue 2.4s var(--ease-io) infinite;
  transform-origin: top;
}
@keyframes scrollcue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* Трассировка запроса — как таймлайн профайлера */
.trace {
  grid-row: 3;
  grid-column: 9 / -1;
  align-self: end;
  position: relative;
  z-index: 3;
  font: 400 11px/1.5 var(--mono);
}
.trace__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-strong);
  font: 600 10px/1 var(--display);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--mid-text);
}
.trace__project { color: var(--ink); }
.trace__req { margin: 10px 0 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.trace__method { font-weight: 700; }
.trace__rows { list-style: none; min-height: calc(7 * 21px); }
.trace__row {
  display: grid;
  grid-template-columns: 24px 74px minmax(0, 1fr) 44px;
  gap: 8px;
  margin: 0 -6px;
  padding: 2px 6px;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity .35s var(--ease), transform .35s var(--ease), background .2s, color .2s;
}
.trace__row > span:nth-child(3) { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--mid-text); }
.trace__row > span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.trace__row.is-on { opacity: 1; transform: none; }
.trace__row.is-active { background: var(--ink); color: var(--bg); }
.trace__row.is-active > span:nth-child(3) { color: inherit; opacity: .75; }
.trace__status {
  display: flex;
  justify-content: space-between;
  min-height: 2.1em;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line-strong);
  font-weight: 700;
  opacity: 0;
  transition: opacity .4s;
}
.trace__status.is-on { opacity: 1; }

/* ---------- Полоса дисциплин ---------- */
.band {
  padding: clamp(46px, 6vw, 86px) var(--pad);
  background: var(--inv-bg);
  color: var(--inv-fg);
}
.band__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(28px, 4vw, 64px);
  list-style: none;
}
.band__item { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 22px; align-items: start; }
.band__ico {
  width: 72px;
  height: 72px;
  padding: 10px;
  border: 1px solid var(--inv-line);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.band__k { margin: 4px 0 12px; font: 700 12px/1 var(--display); letter-spacing: .2em; text-transform: uppercase; }
.band__t { max-width: 42ch; margin-bottom: 18px; font-size: 13.5px; line-height: 1.65; color: color-mix(in oklab, var(--inv-fg) 68%, var(--inv-bg)); }
.band__a { font: 700 11px/1 var(--display); letter-spacing: .2em; text-transform: uppercase; display: inline-flex; gap: 10px; transition: gap .35s var(--ease); }
.band__a:hover { gap: 16px; }

/* ---------- Заголовки секций ---------- */
.sec-head {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  row-gap: 22px;
  margin-bottom: clamp(40px, 5vw, 76px);
}
.sec-head > .label { grid-column: 1 / -1; }
.sec-head > .title,
.sec-head > .subtitle { grid-column: 1 / span 7; outline: none; }
.sec-head__side { grid-column: 9 / -1; align-self: end; font-size: 14.5px; line-height: 1.65; color: var(--ink-2); }
.sec-head--sub { margin-bottom: clamp(28px, 3.4vw, 48px); }

/* ---------- Работы ---------- */
.work, .stack, .process { padding: clamp(84px, 10vw, 150px) var(--pad); }
.work { position: relative; }

.work__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line-strong);
}
.seg { display: inline-flex; border: 1px solid var(--line-strong); }
.seg__btn {
  padding: 9px 14px;
  font: 600 10.5px/1 var(--display);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--mid-text);
  transition: background .3s, color .3s;
}
.seg__btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.work__views[data-view="grid"] .index,
.work__views[data-view="index"] .grid { display: none; }

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(36px, 4vw, 64px) var(--gap);
  list-style: none;
}
.card { grid-column: span 4; min-width: 0; }
.card--wide { grid-column: span 7; }
.grid > .card:nth-child(2) { grid-column: span 5; margin-top: clamp(56px, 9vw, 150px); }
.grid > .card:nth-child(4) { margin-top: clamp(28px, 4vw, 64px); }

.card__link { display: block; outline-offset: 6px; }
.card__media {
  position: relative;
  overflow: hidden;
  background: var(--surface);
}
.card__media .cv { transition: transform 1.1s var(--ease); }
.card__link:hover .card__media .cv { transform: scale(1.035); }
.card__no,
.card__live {
  position: absolute;
  top: 14px;
  z-index: 1;
  font: 500 10.5px/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.card__no { left: 16px; }
.card__live { right: 16px; display: inline-flex; align-items: center; gap: 7px; }
.card__live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: live 2.2s ease-in-out infinite; }
@keyframes live { 50% { opacity: .25; } }
.card__media--inv { background: var(--ink); }
.card__media--inv .card__no,
.card__media--inv .card__live { color: var(--bg); }
.card__open {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--ink);
  color: var(--bg);
  font: 600 11px/1 var(--display);
  letter-spacing: .2em;
  text-transform: uppercase;
  transform: translateY(101%);
  transition: transform .55s var(--ease);
}
.card__media--inv .card__open { background: var(--bg); color: var(--ink); }
.card__link:hover .card__open,
.card__link:focus-visible .card__open { transform: none; }

.card__meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 16px;
  padding-top: 16px;
}
.card__name { font: 600 18px/1.25 var(--display); letter-spacing: -.005em; }
.card__kind { justify-self: end; align-self: center; font: 500 10.5px/1.4 var(--display); letter-spacing: .18em; text-transform: uppercase; color: var(--mid-text); }
.card__desc { grid-column: 1 / -1; max-width: 54ch; margin-top: 2px; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.card__stack { grid-column: 1 / -1; margin-top: 8px; font: 400 11.5px/1.5 var(--mono); color: var(--mid-text); }

/* Индекс-вид */
.index { list-style: none; border-top: 1px solid var(--line-strong); }
.index__row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1.6fr) minmax(0, .75fr) minmax(0, 1.3fr) minmax(0, .85fr);
  gap: var(--gap);
  align-items: baseline;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
  transition: padding .45s var(--ease), color .3s;
}
.index__row:hover { padding-left: 18px; }
.index__no, .index__stack, .index__url { font: 400 12px/1.45 var(--mono); color: var(--mid-text); }
.index__name { font: 800 clamp(24px, 2.65vw, 40px)/1 var(--display); letter-spacing: -.025em; text-transform: uppercase; }
.index__kind { font: 500 11px/1.4 var(--display); letter-spacing: .18em; text-transform: uppercase; }
.index__url { text-align: right; }
.index__url::after { content: " ↗"; }
.work__views[data-view="index"] .index:hover .index__row:not(:hover) { color: var(--mid); }

.preview {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 40;
  width: clamp(240px, 25vw, 380px);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  pointer-events: none;
  opacity: 0;
  transform: translate3d(var(--x, 0), var(--y, 0), 0) rotate(var(--r, 0deg)) scale(var(--s, .92));
  transition: opacity .3s var(--ease);
  will-change: transform;
}
.preview.is-on { opacity: 1; }
.preview .cv { width: 100%; height: 100%; }
.preview .card__media--inv,
.preview.is-inv { background: var(--ink); }

/* ---------- Обложки (inline SVG) ---------- */
.cv {
  width: 100%;
  height: auto;
  --cv-bg: var(--surface);
  --cv-fg: var(--ink);
  --cv-mid: var(--mid);
  --cv-line: var(--line-strong);
  --cv-s2: var(--surface-2);
  --cv-card: var(--bg);
}
.cv--inv {
  --cv-bg: var(--ink);
  --cv-fg: var(--bg);
  --cv-mid: color-mix(in oklab, var(--bg) 52%, var(--ink));
  --cv-line: color-mix(in oklab, var(--bg) 24%, transparent);
  --cv-s2: color-mix(in oklab, var(--bg) 9%, var(--ink));
  --cv-card: color-mix(in oklab, var(--bg) 6%, var(--ink));
}
.cv text { font-family: var(--mono); }
.cv .tx-d { font-family: var(--display); font-weight: 800; }
.cv .bg, .cv .bg-t { fill: var(--cv-bg); }
.cv .fg { fill: var(--cv-fg); }
.cv .md { fill: var(--cv-mid); }
.cv .s2 { fill: var(--cv-s2); }
.cv .cd { fill: var(--cv-card); }
.cv .sf { stroke: var(--cv-fg); }
.cv .sm { stroke: var(--cv-mid); }
.cv .sl { stroke: var(--cv-line); }
.cv .sb { stroke: var(--cv-bg); }
.cv .no { fill: none; }
.cv .cv-land { opacity: .4; }
.pat-ink { stroke: var(--ink); }
.pat-bg { stroke: var(--bg); }

/* Живые элементы обложек: запускаются при наведении, в превью и в кейсе */
.cv-sweep { transform-origin: 590px 235px; animation: spin 7s linear infinite; animation-play-state: paused; }
.cv-ping { transform-box: fill-box; transform-origin: center; animation: ping 2.6s var(--ease) infinite; animation-play-state: paused; }
.cv-arcs path, .cv-links path, .cv-line { stroke-dasharray: 1; stroke-dashoffset: 0; }
.cv-spark path { stroke-dasharray: .05 .95; stroke-dashoffset: 1; opacity: 0; transition: opacity .4s; animation: spark 2.8s linear infinite; animation-play-state: paused; }
.cv-spark path + path { animation-delay: -1.4s; }
.cv-pop { opacity: 0; transform: translateY(10px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.cv-pop--2 { transition-delay: .18s; }
.cv-blank { transition: opacity .3s; }
.cv-bars rect { transform-box: fill-box; transform-origin: bottom; }
.cv-ykey { transition: fill .4s; }
.cv-timer { transition: d .9s var(--ease); }

.is-live .cv-sweep, .is-live .cv-ping, .is-live .cv-spark path,
.card__link:hover .cv-sweep, .card__link:hover .cv-ping, .card__link:hover .cv-spark path { animation-play-state: running; }
.is-live .cv-spark path, .card__link:hover .cv-spark path { opacity: 1; }
.card__link:hover .cv-arcs path, .is-live .cv-arcs path { animation: draw 1.5s var(--ease) both; }
.card__link:hover .cv-arcs path:nth-child(2), .is-live .cv-arcs path:nth-child(2) { animation-delay: .12s; }
.card__link:hover .cv-arcs path:nth-child(3), .is-live .cv-arcs path:nth-child(3) { animation-delay: .24s; }
.card__link:hover .cv-arcs path:nth-child(4), .is-live .cv-arcs path:nth-child(4) { animation-delay: .36s; }
.card__link:hover .cv-arcs path:nth-child(5), .is-live .cv-arcs path:nth-child(5) { animation-delay: .48s; }
.card__link:hover .cv-links path, .is-live .cv-links path { animation: draw 1.2s var(--ease) both; }
.card__link:hover .cv-line, .is-live .cv-line { animation: draw 1.6s var(--ease) both; }
.card__link:hover .cv-bars rect, .is-live .cv-bars rect { animation: grow .9s var(--ease) both; }
.card__link:hover .cv-pop, .is-live .cv-pop { opacity: 1; transform: none; }
.card__link:hover .cv-blank, .is-live .cv-blank { opacity: 0; }
.card__link:hover .cv-ykey, .is-live .cv-ykey { fill: var(--cv-fg); }
.card__link:hover .cv-ytxt, .is-live .cv-ytxt { fill: var(--cv-bg); }
.card__link:hover .cv-donut, .is-live .cv-donut { animation: donut 1.2s var(--ease) both; transform-origin: 676px 316px; }
.card__link:hover .cv-timer, .is-live .cv-timer { d: path("M140 472H220"); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ping { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(2.2); opacity: 0; } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes spark { to { stroke-dashoffset: 0; } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes donut { from { transform: rotate(-90deg) scale(.86); opacity: .4; } to { transform: rotate(-90deg) scale(1); opacity: 1; } }

/* ---------- Кейс проекта ---------- */
.case {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}
.case::backdrop { background: rgba(16, 16, 16, .35); }
.case[open] { animation: case-in .7s var(--ease) both; }
.case.is-closing { animation: case-out .45s var(--ease-io) both; }
@keyframes case-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes case-out { to { transform: translateY(30px); opacity: 0; } }

.case__bar {
  position: relative;
  z-index: 2;
  height: 60px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
}
.case__back, .case__close, .case__arrow {
  font: 600 11px/1 var(--display);
  letter-spacing: .2em;
  text-transform: uppercase;
}
.case__back { justify-self: start; display: inline-flex; align-items: center; gap: 10px; transition: gap .3s var(--ease); }
/* Стрелка в 1.5 раза крупнее прежнего глифа и по центру строки */
.ico--back { width: 17px; height: 17px; stroke-width: 1.5; stroke-linejoin: round; }
.case__back:hover { gap: 16px; }
.case__pos { font: 500 12px/1 var(--mono); color: var(--mid-text); }
.case__pos span { color: var(--ink); }
.case__nav { justify-self: end; display: flex; align-items: center; gap: 6px; }
.case__arrow { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line-strong); font-size: 14px; letter-spacing: 0; transition: background .3s, color .3s; }
.case__arrow:hover { background: var(--ink); color: var(--bg); }
.case__close { display: inline-flex; align-items: center; gap: 10px; margin-left: 18px; }
.case__scroll { height: calc(100% - 60px); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.case__body { padding: clamp(32px, 5vw, 72px) var(--pad) clamp(70px, 9vw, 130px); }
.case__body.is-swapping { animation: swap .5s var(--ease) both; }
@keyframes swap { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.cs-hero {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap);
  align-items: end;
  padding-bottom: clamp(36px, 5vw, 64px);
  border-bottom: 1px solid var(--line-strong);
}
.cs-hero__text { grid-column: 1 / span 5; }
.cs-hero__media { grid-column: 6 / -1; background: var(--surface); }
.cs-hero__media.is-inv { background: var(--ink); }
.cs-title {
  margin: 18px 0 18px;
  font: 800 clamp(48px, 7vw, 112px)/.86 var(--display);
  letter-spacing: -.04em;
  text-transform: uppercase;
  outline: none;
}
.cs-tag { font: 600 18px/1.35 var(--display); margin-bottom: 14px; }
.cs-sum { color: var(--ink-2); max-width: 50ch; margin-bottom: 30px; }
.cs-links { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; }

.cs-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
  margin: 0;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}
.cs-facts dt { font: 500 10.5px/1.4 var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--mid-text); margin-bottom: 8px; }
.cs-facts dd { margin: 0; font-size: 14px; line-height: 1.5; }

.cs-sec {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap);
  padding: clamp(36px, 4.6vw, 64px) 0;
  border-bottom: 1px solid var(--line);
}
.cs-sec > .label { grid-column: 1 / span 3; }
.cs-sec > :not(.label) { grid-column: 4 / -1; min-width: 0; }

.cs-spec { width: 100%; border-collapse: collapse; }
.cs-spec th, .cs-spec td { padding: 13px 0; border-bottom: 1px solid var(--line); vertical-align: baseline; text-align: left; }
.cs-spec tr:first-child th, .cs-spec tr:first-child td { border-top: 1px solid var(--line); }
.cs-spec th { width: 30%; padding-right: 24px; font: 600 13.5px/1.4 var(--display); }
.cs-spec td { font: 400 12.5px/1.6 var(--mono); color: var(--ink-2); text-align: right; }

.cs-hl { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px var(--gap); counter-reset: hl; }
.cs-hl li { counter-increment: hl; padding-top: 16px; border-top: 1px solid var(--ink); font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }
.cs-hl li::before { content: "0" counter(hl); display: block; margin-bottom: 12px; font: 500 11px/1 var(--mono); color: var(--ink); }
.cs-hl code, .cs-sum code { font: 500 .88em/1 var(--mono); color: var(--ink); background: var(--surface); padding: 2px 5px; }

.cs-arch { margin: 0; }
.cs-arch svg { width: 100%; height: auto; }
.cs-arch figcaption { margin-top: 14px; font: 400 11.5px/1.6 var(--mono); color: var(--mid-text); }

.cs-next {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  padding-top: clamp(40px, 6vw, 80px);
}
.cs-next small { display: block; margin-bottom: 14px; font: 500 11px/1 var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--mid-text); }
.cs-next strong { font: 800 clamp(40px, 6vw, 96px)/.88 var(--display); letter-spacing: -.035em; text-transform: uppercase; }
.cs-next span { font: 800 clamp(40px, 6vw, 96px)/.88 var(--display); transition: transform .5s var(--ease); }
.cs-next:hover span { transform: translateX(14px); }

/* Схема архитектуры */
.ar-lane { font: 600 10px/1 var(--display); letter-spacing: .2em; text-transform: uppercase; fill: var(--mid-text); }
.ar-lane-line { stroke: var(--line); stroke-dasharray: 2 5; }
.ar-node rect { fill: var(--bg); stroke: var(--ink); stroke-width: 1.2; }
.ar-node.is-ext rect { stroke-dasharray: 4 4; fill: none; }
.ar-node.is-key rect { fill: var(--ink); }
.ar-node.is-key text { fill: var(--bg); }
.ar-node .t1 { font: 600 12.5px/1 var(--mono); fill: var(--ink); }
.ar-node .t2 { font: 400 10.5px/1 var(--mono); fill: var(--mid-text); }
.ar-node.is-key .t2 { fill: var(--bg); opacity: .7; }
.ar-edge { fill: none; stroke: var(--ink); stroke-width: 1.1; opacity: .55; }
.ar-edge-label { font: 400 9.5px/1 var(--mono); fill: var(--mid-text); }
.ar-label-bg { fill: var(--bg); }
.ar-arrow { fill: var(--ink); opacity: .55; }
.ar-pulse { fill: var(--ink); }

/* ---------- Контракт PHP ↔ TypeScript ---------- */
.contract { position: relative; border-top: 1px solid var(--line-strong); }
.contract__tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.contract__tabs::-webkit-scrollbar { display: none; }
.contract__tab {
  flex: none;
  margin-bottom: -1px;
  padding: 18px 22px 16px 0;
  margin-right: 22px;
  border-bottom: 2px solid transparent;
  font: 600 11px/1 var(--display);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--mid-text);
  white-space: nowrap;
  transition: color .3s, border-color .3s;
}
.contract__tab span { margin-right: 8px; font: 500 11px/1 var(--mono); letter-spacing: 0; }
.contract__tab em { margin-left: 8px; font: 400 11px/1 var(--mono); font-style: normal; letter-spacing: 0; text-transform: none; color: var(--mid-text); }
.contract__tab[aria-selected="true"] { color: var(--ink); border-color: var(--ink); }

.contract__body {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(56px, 7vw, 104px) minmax(0, 1fr);
  align-items: start;
  padding-top: 28px;
}
.contract__body .code--php { grid-column: 1; }
.contract__body .code--ts { grid-column: 3; }
.contract__body.is-swapping .code { animation: swap .5s var(--ease) both; }
.contract__body.is-swapping .code--ts { animation-delay: .06s; }
.contract__links { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; pointer-events: none; overflow: visible; z-index: 0; }

.code { position: relative; z-index: 1; min-width: 0; margin: 0; background: var(--surface); }
.code__cap {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font: 400 11px/1 var(--mono);
  color: var(--mid-text);
}
.code__lang { font: 700 10.5px/1 var(--display); letter-spacing: .18em; text-transform: uppercase; color: var(--ink); }
.code__file { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.code__pre { margin: 0; padding: 16px 0 18px; overflow-x: auto; font: 400 12.4px/1.78 var(--mono); tab-size: 4; }
.code__pre code { display: block; min-width: max-content; }
.code .ln {
  position: relative;
  display: block;
  min-height: 1.78em;
  padding: 0 18px 0 50px;
  white-space: pre;
}
.code .ln::before {
  content: attr(data-n);
  position: absolute;
  left: 0;
  width: 34px;
  text-align: right;
  color: var(--mid);
  opacity: .8;
}
/* Монохромная подсветка: вес, тон и контраст вместо цвета */
.t-kw { font-weight: 700; }
.t-ty { font-weight: 600; }
.t-fn { font-weight: 500; }
.t-va { color: var(--ink); }
.t-st { color: color-mix(in oklab, var(--ink) 70%, var(--surface)); }
.t-nu { font-weight: 600; }
.t-co { color: var(--mid); }
.t-at { color: color-mix(in oklab, var(--ink) 78%, var(--surface)); font-weight: 600; }
.t-pu { color: color-mix(in oklab, var(--ink) 55%, var(--surface)); }

.lk {
  position: relative;
  border-radius: 2px;
  box-shadow: inset 0 -1px 0 var(--ink);
  cursor: pointer;
  transition: background .25s, color .25s, box-shadow .25s;
  outline: none;
}
.lk:focus-visible { box-shadow: 0 0 0 2px var(--ink); }
.lk.is-on { background: var(--ink); color: var(--bg); box-shadow: 0 0 0 2px var(--ink); }
.lk.is-on * { color: inherit !important; }
.contract.has-active .lk:not(.is-on) { box-shadow: inset 0 -1px 0 var(--line-strong); }

.cl-path { fill: none; stroke: var(--line-strong); stroke-width: 1; transition: stroke .3s, opacity .3s; }
.cl-path.is-on { stroke: var(--ink); stroke-width: 1.6; }
.cl-lead { fill: none; stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 1 4; transition: stroke .3s; }
.cl-lead.is-on { stroke: var(--ink); }
.cl-pin { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1; transition: fill .3s, stroke .3s; }
.cl-pin.is-on { fill: var(--ink); stroke: var(--ink); }
.cl-badge { font: 600 10px/1 var(--mono); fill: var(--bg); }
.cl-num { opacity: 0; transition: opacity .3s; }
.cl.is-on .cl-num { opacity: 1; }
.cl-badge-bg { fill: var(--ink); }

.contract__note {
  display: grid;
  grid-template-columns: clamp(56px, 7vw, 104px) minmax(0, 1fr);
  gap: 0;
  min-height: 4.6em;
  margin-top: 26px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-2);
}
.contract__note b { font: 600 11px/1.9 var(--mono); color: var(--ink); }
.contract__note strong { color: var(--ink); font-weight: 600; }
.contract__note code { font: 500 .88em/1 var(--mono); color: var(--ink); background: var(--surface); padding: 2px 5px; }
.contract__foot { margin-top: 10px; font: 400 11px/1.5 var(--mono); color: var(--mid-text); }

/* ---------- Матрица технологий ---------- */
.matrix-wrap { margin-top: clamp(90px, 11vw, 160px); }
.matrix { overflow-x: auto; border-top: 1px solid var(--line-strong); }
.mx { width: 100%; min-width: 760px; border-collapse: collapse; }
.mx th, .mx td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: center; transition: background .2s, color .2s; }
.mx thead th {
  padding: 18px 10px 14px;
  vertical-align: bottom;
  font: 600 10.5px/1.3 var(--display);
  letter-spacing: .16em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-strong);
  cursor: default;
}
.mx thead th small { display: block; margin-bottom: 6px; font: 400 10.5px/1 var(--mono); letter-spacing: 0; color: var(--mid-text); }
.mx thead th:first-child { text-align: left; padding-left: 0; }
.mx tbody th { text-align: left; padding-left: 0; font: 500 13.5px/1.3 var(--display); white-space: nowrap; }
.mx tbody th small { margin-left: 8px; font: 400 11px/1 var(--mono); color: var(--mid-text); }
.mx td { font: 500 12px/1 var(--mono); width: 13%; }
.mx .grp th {
  padding: 30px 0 10px;
  font: 700 10.5px/1 var(--display);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--mid-text);
  border-bottom: 1px solid var(--line-strong);
}
.mx .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); vertical-align: middle; }
.mx .nil { color: var(--line-strong); }
.mx .is-hl { background: var(--surface); }
.mx .is-x { background: var(--ink); color: var(--bg); }
.mx .is-x .dot { background: var(--bg); }

/* ---------- Цифры ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  padding: clamp(84px, 10vw, 150px) var(--pad);
  background: var(--inv-bg);
  color: var(--inv-fg);
}
.stats__head { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 22px; }
.stats__head .label { grid-column: 1 / -1; }
.stats__head .title { grid-column: 1 / span 7; }
.stats__text { grid-column: 9 / -1; align-self: end; font-size: 14.5px; line-height: 1.65; color: color-mix(in oklab, var(--inv-fg) 66%, var(--inv-bg)); }
.stats__list {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
  margin: clamp(48px, 6vw, 88px) 0 0;
  padding-top: 32px;
  border-top: 1px solid var(--inv-line);
}
.stats__item dt { font: 800 clamp(52px, 6.6vw, 100px)/.9 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stats__item dd { max-width: 22ch; margin: 16px 0 0; font: 500 10.5px/1.6 var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--inv-mid); }

/* ---------- Процесс ---------- */
.proc {
  --p: 0;
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  list-style: none;
  border-top: 1px solid var(--line-strong);
}
.proc::before {
  content: "";
  position: absolute;
  left: 0;
  top: -1px;
  height: 2px;
  width: calc(var(--p) * 100%);
  background: var(--ink);
}
.proc::after {
  content: "";
  position: absolute;
  top: -6px;
  left: calc(var(--p) * 100%);
  width: 11px;
  height: 11px;
  background: var(--ink);
  transform: translateX(-50%);
}
.proc__step { padding: 34px 28px 0 0; transition: opacity .5s; }
.proc__ev { margin-bottom: 30px; font: 500 11.5px/1 var(--mono); color: var(--mid-text); transition: color .4s; }
.proc__step.is-passed .proc__ev { color: var(--ink); }
.proc__t { margin-bottom: 14px; font: 800 clamp(26px, 2.6vw, 40px)/1 var(--display); letter-spacing: -.02em; text-transform: uppercase; }
.proc__d { max-width: 30ch; font-size: 14px; line-height: 1.6; color: var(--ink-2); }

/* ---------- Контакт ---------- */
.contact {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  row-gap: 56px;
  align-items: end;
  padding: clamp(90px, 11vw, 170px) var(--pad);
  background: var(--inv-bg);
  color: var(--inv-fg);
}
.contact__main { grid-column: 1 / span 7; }
.contact__main .title { margin-top: 22px; outline: none; }
.contact__text { max-width: 46ch; margin: 28px 0 38px; font-size: 15px; line-height: 1.65; color: color-mix(in oklab, var(--inv-fg) 66%, var(--inv-bg)); }

.term { grid-column: 9 / -1; border: 1px solid var(--inv-line); font: 400 12px/1.7 var(--mono); }
.term__bar { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-bottom: 1px solid var(--inv-line); font-size: 11px; color: var(--inv-mid); }
.term__dots { display: inline-flex; gap: 6px; }
.term__dots i { width: 9px; height: 9px; border: 1px solid currentColor; border-radius: 50%; }
.term__pre { margin: 0; padding: 16px; white-space: pre-wrap; word-break: break-word; min-height: 9.5em; }
.term__pre code { display: block; }
.term__ps { color: var(--inv-mid); }
.term__out { margin-top: 12px; color: var(--inv-fg); }
.term__out .dim { color: var(--inv-mid); }
.term__out a { text-decoration: underline; text-underline-offset: 3px; }
.term__run {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 16px 16px;
  padding: 9px 14px;
  border: 1px solid var(--inv-line);
  font: 600 10.5px/1 var(--display);
  letter-spacing: .18em;
  text-transform: uppercase;
  transition: background .3s, color .3s;
}
.term__run:hover { background: var(--inv-fg); color: var(--inv-bg); }
.term__run kbd { border-color: currentColor; }

/* ---------- Подвал ---------- */
.ftr { padding: clamp(64px, 8vw, 110px) var(--pad) 26px; overflow: hidden; container-type: inline-size; }
.ftr__cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px var(--gap); }
.ftr ul { display: grid; gap: 10px; margin-top: 16px; list-style: none; font-size: 13.5px; }
.ftr ul a { transition: opacity .3s; }
.ftr ul a:hover { opacity: .55; }
.ftr__keys li { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; color: var(--ink-2); font-size: 12.5px; }
/* Фамилия и имя — две строки; кегль от ширины подвала (cqi),
   чтобы «TARASEVICH» занимал строку целиком и не обрезался на узких экранах */
.ftr__mark {
  margin: clamp(56px, 8vw, 110px) 0 18px;
  font: 800 14.4vw/.84 var(--display);
  font-size: 15.3cqi;
  letter-spacing: -.045em;
  text-transform: uppercase;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1px var(--line-strong);
  user-select: none;
}
.ftr__mark span { display: block; }
.ftr__base {
  display: flex;
  justify-content: space-between;
  gap: 8px 24px;
  flex-wrap: wrap;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font: 400 11px/1.5 var(--mono);
  color: var(--mid-text);
}

/* ---------- Search Everywhere ---------- */
.palette {
  width: min(680px, calc(100vw - 24px));
  max-height: none;
  margin: min(12vh, 110px) auto auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.palette::backdrop { background: rgba(16, 16, 16, .32); }
.palette[open] { animation: pal-in .35s var(--ease) both; }
@keyframes pal-in { from { opacity: 0; transform: translateY(-10px) scale(.985); } to { opacity: 1; transform: none; } }
.palette__tabs { display: flex; align-items: center; gap: 2px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.palette__tabs [role="tab"] { padding: 9px 10px 8px; font: 600 10.5px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--mid-text); }
.palette__tabs [aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
.palette__hint { margin-left: auto; display: flex; gap: 6px; color: var(--mid-text); }
.palette__field { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.palette__field .ico { width: 18px; height: 18px; color: var(--mid-text); }
.palette__field input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font: 400 18px/1.2 var(--display); color: var(--ink); }
.palette__field input::placeholder { color: var(--mid-text); }
.palette__list { max-height: min(52vh, 430px); overflow-y: auto; padding: 6px 0; list-style: none; overscroll-behavior: contain; }
.pl-group { padding: 14px 18px 6px; font: 600 10px/1 var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--mid-text); }
.pl-item { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 18px; cursor: pointer; }
.pl-item .pl-ico { font: 500 12px/1 var(--mono); color: var(--mid-text); text-align: center; }
.pl-item .pl-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14.5px; }
.pl-item .pl-sub { color: var(--mid-text); margin-left: 8px; font-size: 13px; }
.pl-item .pl-meta { font: 400 11px/1 var(--mono); color: var(--mid-text); white-space: nowrap; }
.pl-item mark { background: none; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.pl-item[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.pl-item[aria-selected="true"] .pl-ico,
.pl-item[aria-selected="true"] .pl-sub,
.pl-item[aria-selected="true"] .pl-meta { color: inherit; opacity: .7; }
.pl-empty { padding: 26px 18px; font: 400 13px/1.5 var(--mono); color: var(--mid-text); }
.palette__foot { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 11px 18px; border-top: 1px solid var(--line); font: 400 11px/1 var(--mono); color: var(--mid-text); }
.palette__foot kbd { margin-right: 3px; }
.palette__count { margin-left: auto; }

/* ---------- Меню debug:router ---------- */
.routes {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--inv-bg);
  color: var(--inv-fg);
}
.routes::backdrop { background: transparent; }
.routes[open] { animation: routes-in .55s var(--ease-io) both; }
@keyframes routes-in { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.routes__inner { min-height: 100%; display: flex; flex-direction: column; padding: clamp(18px, 2.6vw, 36px) var(--pad) clamp(22px, 3vw, 40px); }
.routes__top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--inv-line); }
.routes__prompt { font: 400 13.5px/1.2 var(--mono); }
.routes__ps { color: var(--inv-mid); margin-right: 4px; }
.caret { display: inline-block; width: .55em; height: 1.05em; margin-left: 3px; vertical-align: -.18em; background: currentColor; animation: blink 1.05s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.routes__close { display: inline-flex; align-items: center; gap: 10px; font: 600 11px/1 var(--display); letter-spacing: .2em; text-transform: uppercase; }
.routes__close kbd, .routes__foot kbd { border-color: var(--inv-line); }
.routes__table { width: 100%; margin-top: auto; padding-top: 40px; border-collapse: collapse; }
.routes__table th {
  padding: 0 16px 14px 0;
  text-align: left;
  font: 500 10.5px/1 var(--display);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--inv-mid);
  border-bottom: 1px solid var(--inv-line);
}
.routes__table td {
  padding: 16px 16px 16px 0;
  vertical-align: baseline;
  border-bottom: 1px solid var(--inv-line);
  font: 400 12px/1.4 var(--mono);
  color: var(--inv-mid);
  transition: color .3s;
}
.routes__table td:nth-child(3) { width: 58%; }
.routes__table td:nth-child(3) > a,
.routes__param {
  display: inline-block;
  font: 800 clamp(30px, 5.2vw, 76px)/.95 var(--display);
  letter-spacing: -.035em;
  text-transform: uppercase;
  color: var(--inv-fg);
  transition: transform .45s var(--ease);
}
.routes__table tr:hover td { color: var(--inv-fg); }
.routes__table tr.is-current td { color: var(--inv-fg); }
.routes__table tr.is-current td:first-child::before { content: "▸ "; }
.routes__table tr:hover td:nth-child(3) > a,
.routes__table tr:hover .routes__param { transform: translateX(14px); }
.routes__param { color: color-mix(in oklab, var(--inv-fg) 45%, var(--inv-bg)); }
.routes__slugs { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; }
.routes__slugs a { font: 400 13px/1.3 var(--mono); color: var(--inv-fg); box-shadow: inset 0 -1px 0 var(--inv-line); transition: box-shadow .3s; }
.routes__slugs a:hover { box-shadow: inset 0 -1px 0 currentColor; }
.routes__sec { text-align: right; text-transform: uppercase; letter-spacing: .14em; font-size: 10.5px !important; font-family: var(--display) !important; font-weight: 600 !important; }
.routes__table th.routes__sec { text-align: right; }
.routes__foot { margin-top: 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font: 400 11px/1.4 var(--mono); color: var(--inv-mid); }
.routes[open] tbody tr { animation: row-in .7s var(--ease) both; }
.routes[open] tbody tr:nth-child(2) { animation-delay: .05s; }
.routes[open] tbody tr:nth-child(3) { animation-delay: .1s; }
.routes[open] tbody tr:nth-child(4) { animation-delay: .15s; }
.routes[open] tbody tr:nth-child(5) { animation-delay: .2s; }
.routes[open] tbody tr:nth-child(6) { animation-delay: .25s; }
@keyframes row-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* ---------- Лог маршрутизатора и подсказка ---------- */
.log {
  position: fixed;
  left: var(--pad);
  bottom: 18px;
  z-index: 60;
  display: flex;
  gap: 14px;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--bg);
  font: 400 11.5px/1 var(--mono);
  pointer-events: none;
  transform: translateY(calc(100% + 24px));
  transition: transform .5s var(--ease);
}
.log.is-on { transform: none; }
.log b { font-weight: 700; }
.log i { font-style: normal; opacity: .6; }

.tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 70;
  max-width: 280px;
  margin: 0;
  padding: 8px 10px;
  background: var(--ink);
  color: var(--bg);
  font: 400 11px/1.45 var(--mono);
  pointer-events: none;
  transform: translate3d(var(--x, 0), var(--y, 0), 0);
}
.tip b { font-weight: 700; }

/* ---------- Появление при прокрутке ---------- */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
  transition-delay: var(--d, 0s);
}
html.js [data-reveal].is-in { opacity: 1; transform: none; }

/* Переход темы через View Transitions: круговое раскрытие из кнопки */
::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* =====================================================================
   Адаптив
   ===================================================================== */
@media (max-width: 1180px) {
  .hdr__nav { gap: 22px; }
  .hdr__search .hdr__label { display: none; }
  .trace { grid-column: 8 / -1; }
  .hero__intro { grid-column: 1 / span 6; }
}

@media (max-width: 1024px) {
  :root { --hdr-h: 64px; }
  .hdr { grid-template-columns: auto 1fr auto; }
  .hdr__nav { display: none; }
  .hdr__mark { grid-column: 1; font-size: 19px; padding-left: 0; }
  .hdr__tools { grid-column: 3; gap: 20px; }
  .hero__cap--right { display: none; }
  .hero__intro { grid-column: 1 / span 7; }
  .trace { grid-column: 8 / -1; }
  .band__list { grid-template-columns: 1fr; gap: 34px; }
  .band__item { grid-template-columns: 72px minmax(0, 1fr); }
  .sec-head > .title, .sec-head > .subtitle { grid-column: 1 / -1; }
  .sec-head__side { grid-column: 1 / span 9; }
  .card, .card--wide, .grid > .card:nth-child(2) { grid-column: span 6; }
  .card--wide { grid-column: 1 / -1; }
  .grid > .card:nth-child(2) { margin-top: 0; }
  .grid > .card:nth-child(4) { margin-top: 0; }
  .grid > .card:nth-child(5) { grid-column: 1 / -1; }
  .index__row { grid-template-columns: 44px minmax(0, 1fr) minmax(0, .8fr) auto; }
  .index__stack { display: none; }
  .stats__head .title { grid-column: 1 / -1; }
  .stats__text { grid-column: 1 / span 9; }
  .stats__list { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 40px; }
  .proc { grid-template-columns: 1fr; border-top: 0; border-left: 1px solid var(--line-strong); margin-left: 6px; }
  .proc::before { top: 0; left: -1px; width: 2px; height: calc(var(--p) * 100%); }
  .proc::after { top: calc(var(--p) * 100%); left: -1px; transform: translate(-50%, -50%); }
  .proc__step { padding: 0 0 40px 30px; display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 4px 24px; }
  .proc__ev { grid-column: 1 / -1; margin-bottom: 10px; }
  .proc__t { margin: 0; }
  .contact__main { grid-column: 1 / -1; }
  .term { grid-column: 1 / span 9; }
  .cs-hero__text { grid-column: 1 / -1; }
  .cs-hero__media { grid-column: 1 / -1; order: -1; }
  .cs-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-sec > .label, .cs-sec > :not(.label) { grid-column: 1 / -1; }
  .ftr__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  :root { --hdr-h: 58px; --gap: 16px; }
  body { font-size: 14.5px; }
  .hdr__mark { font-size: 16px; letter-spacing: .24em; }
  .hdr__tools { gap: 16px; }
  .hdr__label, .hdr__kbd, .theme-opt, .theme-sep { display: none; }
  .ico--theme { display: block; width: 18px; height: 18px; }
  .hdr__search .ico { width: 18px; height: 18px; }

  .hero {
    min-height: auto;
    grid-template-rows: auto auto auto auto;
    padding-top: 26px;
  }
  .hero__cap--left { grid-column: 1 / -1; font-size: 11px; }
  .hero__title {
    grid-area: 2 / 1 / 3 / -1;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 18px 0 8px;
    --word: 35vw;
  }
  .hero__word--php { grid-column: 1; justify-self: start; margin: 0; }
  .hero__word--js { grid-column: 1; justify-self: end; margin-top: 54vw; }
  .hero__stage { grid-area: 2 / 1 / 3 / -1; min-height: 0; }
  .hero__fallback { height: 58%; top: 50%; }
  .hero__intro { grid-row: 3; grid-column: 1 / -1; margin-top: 26px; }
  .hero__hint { display: none; }
  .trace { grid-row: 4; grid-column: 1 / -1; margin-top: 34px; }
  .trace__rows { min-height: calc(7 * 21px); }
  .hero__scroll { display: none; }

  .band__item { grid-template-columns: 56px minmax(0, 1fr); gap: 16px; }
  .band__ico { width: 56px; height: 56px; padding: 8px; }
  .sec-head__side { grid-column: 1 / -1; }
  .work__bar { flex-wrap: wrap; }
  .card, .card--wide, .grid > .card:nth-child(2), .grid > .card:nth-child(5) { grid-column: 1 / -1; }
  .card__open { transform: none; height: 42px; }
  .index__row { grid-template-columns: 32px minmax(0, 1fr); gap: 6px 12px; padding: 20px 0; }
  .index__kind, .index__url { grid-column: 2; text-align: left; }
  .index__no { grid-row: 1 / span 3; }

  .contract__tab { padding-right: 0; margin-right: 18px; }
  .contract__tab em { display: none; }
  .contract__body { grid-template-columns: minmax(0, 1fr); row-gap: 16px; }
  .contract__body .code--php, .contract__body .code--ts { grid-column: 1; }
  .contract__links { display: none; }
  .contract__note { grid-template-columns: 54px minmax(0, 1fr); }
  .code__pre { font-size: 11.5px; }
  .code .ln { padding-left: 40px; padding-right: 14px; }
  .code .ln::before { width: 26px; }

  .stats__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats__text { grid-column: 1 / -1; }
  .proc__step { grid-template-columns: 1fr; padding-left: 22px; }
  .proc__t { margin-bottom: 10px; }
  .term { grid-column: 1 / -1; }

  .case__bar { grid-template-columns: auto 1fr auto; height: 54px; }
  .case__scroll { height: calc(100% - 54px); }
  .case__pos { justify-self: center; }
  .case__close { margin-left: 8px; }
  .case__close kbd, .case__back { font-size: 0; gap: 0; }
  .case__back .ico--back { width: 24px; height: 24px; }
  .case__close { font-size: 0; gap: 0; width: 36px; height: 36px; border: 1px solid var(--line-strong); justify-content: center; }
  .case__close::before { content: "✕"; font-size: 13px; letter-spacing: 0; }
  .case__close kbd { display: none; }
  .cs-facts { grid-template-columns: 1fr 1fr; }
  .cs-hl { grid-template-columns: 1fr; }
  .cs-spec th { width: auto; display: block; padding-bottom: 2px; border: 0 !important; }
  .cs-spec td { display: block; text-align: left; padding-top: 0; }
  .cs-spec tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .cs-spec tr:first-child { border-top: 1px solid var(--line); }

  .routes__table thead { display: none; }
  .routes__table tr { display: grid; grid-template-columns: auto 1fr; padding: 14px 0; border-bottom: 1px solid var(--inv-line); }
  .routes__table td { border: 0; padding: 0; }
  .routes__table td:nth-child(1) { grid-column: 1; font-size: 10.5px; }
  .routes__table td:nth-child(2) { grid-column: 2; text-align: right; font-size: 10.5px; }
  .routes__table td:nth-child(3) { grid-column: 1 / -1; width: auto; margin-top: 8px; }
  .routes__table td.routes__sec { display: none; }
  .routes__table td:nth-child(3) > a, .routes__param { font-size: 38px; }

  .palette { margin-top: 10px; }
  .palette__hint { display: none; }
  .palette__foot span:not(.palette__count) { display: none; }
  .palette__count { margin-left: 0; }

  .ftr__cols { grid-template-columns: 1fr 1fr; }
  .ftr__keys { display: none !important; }
  .ftr__cols > div:last-child { display: none; }
  .log { left: 12px; right: 12px; bottom: 12px; }
}

/* Телефоны в портрете: «TARASEVICH YAUHENI» в строку не помещается рядом с иконками,
   поэтому логотип складывается в две строки */
@media (max-width: 480px) {
  .hdr__mark { display: grid; gap: 4px; font-size: 14px; line-height: .9; letter-spacing: .26em; }
}

@media (hover: none) {
  .preview { display: none; }
  .card__open { transform: none; }
}

/* Уважение к системной настройке «уменьшить движение» */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  html.js [data-reveal] { opacity: 1; transform: none; }
}
