/* =============================================================
   НЕ КАК ВСЕ — reset, typography, shared primitives
   ============================================================= */

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

html {
  scroll-behavior: smooth;
  /* Ровно высота шапки: блок рассчитан на 100svh − var(--header-h),
     любой лишний отступ обрезал бы его низ при переходе по якорю. */
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink-0);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-feature-settings: 'ss01', 'cv05';
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/*
 * Короткая страница (реквизиты, черновик документа) не должна
 * подтягивать подвал к середине экрана и не должна растягивать его
 * самого: лишнюю высоту забирает содержимое, подвал остаётся своей
 * натуральной высоты. У админки своя оболочка — её не трогаем.
 */
body:not(.admin) {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
body:not(.admin) > main { flex: 1 0 auto; }
body:not(.admin) > .site-footer { flex: none; }

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

a { color: inherit; text-decoration: none; }

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

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

textarea { resize: vertical; }

ul, ol { margin: 0; padding: 0; }

:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--magenta); color: #fff; }

/* Scrollbars ------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--ink-4) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--ink-4);
  border-radius: var(--r-pill);
  border: 3px solid var(--ink-0);
}
*::-webkit-scrollbar-thumb:hover { background: #3a3a46; }

/* =============================================================
   Layout
   ============================================================= */

/*
 * Макет нарисован на 1920: контент 1460 при полях 230, то есть 76%
 * ширины экрана. На десктопе держим эту долю, чтобы пропорции макета
 * сохранялись на любом мониторе; на узких экранах переходим на поля,
 * иначе колонка станет неприлично узкой.
 */
.container {
  width: min(var(--container), 100% - var(--gutter) * 2);
  margin-inline: auto;
  position: relative;
  z-index: var(--z-content);
}

.container--wide   { width: min(var(--container-wide),   100% - var(--gutter) * 2); }
.container--narrow { width: min(var(--container-narrow), 100% - var(--gutter) * 2); }

@media (min-width: 900px) {
  .container        { width: min(var(--container),        76%); }
  .container--wide  { width: min(var(--container-wide),   83.5%); }
  .container--narrow{ width: min(var(--container-narrow), 76%); }
}

.section { padding-block: var(--section-y); position: relative; }

.stack > * + * { margin-top: var(--sp-4); }

/*
 * Single-column grid stacks. An `auto` track is sized by its content's
 * min-content width, so one long Russian word in the display face can
 * push the whole column past the container. Zero-specificity so any
 * real multi-column rule later still wins.
 */
:where(
  .section-head__main, .section-head__aside, .hero__copy, .hero__stat,
  .manifest-card, .service-card, .media-card__body, .concept-card__mini,
  .detail-card, .stat, .brief__intro,
  .brief-form, .brief-step, .field,
  .site-footer__brand, .footer-col, .list-head, .cta-band,
  .panel, .editor-col, .preview, .pv, .pv__body, .rep__item, .acc__panel,
  .legal, .legal__body, .cookie-bar, .bento__item
) {
  grid-template-columns: minmax(0, 1fr);
}

/* =============================================================
   Typography
   ============================================================= */

.display,
.h1, .h2, .h3 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-head);
  margin: 0;
  text-wrap: balance;
  /* Unbounded is wide and Russian words are long: without this a single
     word sets the min-content width and stretches its grid column. */
  overflow-wrap: break-word;
  hyphens: auto;
}

.display { font-size: var(--fs-display); line-height: var(--lh-display); }
.h1 { font-size: var(--fs-h1); line-height: var(--lh-display); }
.h2 { font-size: var(--fs-h2); }
.h3 { font-size: var(--fs-h3); font-weight: 700; }

.lead {
  font-size: clamp(1.0625rem, 1.25vw, 1.1875rem);
  line-height: 1.58;
  color: var(--text-2);
  margin: 0;
  max-width: 62ch;
}

.body-text { color: var(--text-2); margin: 0; }
.muted     { color: var(--text-3); }

/* Kicker — the small all-caps label above a heading ----------- */
.kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-kicker);
  font-weight: 700;
  letter-spacing: var(--tracking-kicker);
  text-transform: uppercase;
  color: var(--yellow);
  margin: 0;
}

.kicker::before {
  content: '';
  width: 26px;
  height: 3px;
  background: var(--magenta);
  transform: skewX(-20deg);
  flex: none;
}

.kicker--magenta { color: var(--magenta-soft); }
.kicker--magenta::before { background: var(--yellow); }

/* Marker text — the hand-written asides ----------------------- */
.mark {
  font-family: var(--font-mark);
  font-size: clamp(1.25rem, 1.9vw, 1.7rem);
  font-weight: 700;
  line-height: 1.05;
  color: var(--yellow);
  transform: rotate(-3deg);
  display: inline-block;
}

.mark--magenta { color: var(--magenta-soft); }
.mark--white   { color: var(--text); }

/* Highlighted word inside a display heading -------------------
   Inline (not inline-block) with box-decoration-break so a phrase
   that wraps gets a plate per line instead of one giant rectangle. */
.hl {
  display: inline;
  color: var(--text-on-accent);
  background: var(--yellow);
  padding: .04em .16em;
  border-radius: 4px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  /* Keep the highlighted phrase on one line so the plate stays a plate.
     If it genuinely cannot fit, the clone above still renders it cleanly. */
  white-space: nowrap;
}

@media (max-width: 420px) {
  .hl { white-space: normal; }
}

.hl--magenta { color: #fff; background: var(--magenta); }

/* Underline stroke beneath a heading --------------------------- */
.stroke {
  display: block;
  width: clamp(120px, 20vw, 230px);
  height: 7px;
  margin-top: var(--sp-4);
  background: var(--magenta);
  transform: skewX(-20deg);
  border-radius: 2px;
}

.stroke--yellow { background: var(--yellow); }

/* =============================================================
   Buttons
   ============================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  min-height: 67px;
  padding: .9rem 28px;
  border-radius: var(--r-pill);
  /* В макете подписи кнопок набраны тем же Unbounded, что и заголовок:
     от этого зависят ширины (245 и 295 на первом экране). */
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  /* В макете разрядки нет: с ней ширины кнопок уезжают от 245 и 295. */
  letter-spacing: 0;
  /* иначе кнопка наследует 1.62 от body и её высота плавает */
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: transform var(--t-fast) var(--ease),
              background-color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
}

.btn:hover  { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn[disabled] { opacity: .5; pointer-events: none; }

.btn--primary {
  background: var(--yellow);
  color: var(--text-on-accent);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .35);
}
.btn--primary:hover { background: var(--yellow-soft); box-shadow: var(--glow-yellow), 0 12px 30px rgba(0,0,0,.4); }

.btn--accent {
  background: var(--magenta);
  color: #fff;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .35);
}
.btn--accent:hover { background: var(--magenta-soft); box-shadow: var(--glow-magenta), 0 12px 30px rgba(0,0,0,.4); }

.btn--ghost {
  background: transparent;
  border-width: 2px;              /* обводка по макету */
  border-color: rgba(255, 255, 255, .34);
  color: var(--text);
}
.btn--ghost:hover { background: rgba(255, 255, 255, .06); border-color: var(--text); }

.btn--quiet { padding-inline: var(--sp-4); color: var(--text-2); }
.btn--quiet:hover { color: var(--text); background: rgba(255,255,255,.05); }

.btn--sm { min-height: 46px; padding: .55rem 1.3rem; font-size: var(--fs-sm); }
.btn--block { width: 100%; }

/* Text link with an arrow ------------------------------------- */
.link-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--yellow);
  transition: gap var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.link-cta:hover { gap: var(--sp-4); color: var(--yellow-soft); }

/* =============================================================
   Chips, tags, pills
   ============================================================= */

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: .45rem .7rem;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-2);
}

.tag--magenta { border-color: var(--line-accent); color: var(--magenta-soft); }
.tag--yellow  { border-color: var(--line-warm);   color: var(--yellow); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: .35rem .6rem;
  border-radius: var(--r-sm);
  font-size: .625rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.badge--draft     { background: rgba(255,176,32,.14);  color: var(--warn);    border: 1px solid rgba(255,176,32,.3); }
.badge--published { background: rgba(55,214,122,.14);  color: var(--ok);      border: 1px solid rgba(55,214,122,.3); }
.badge--demo      { background: rgba(10,10,12,.86);    color: var(--yellow);  border: 1px solid var(--line-warm); }

/* =============================================================
   Cards
   ============================================================= */

.card {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: border-color var(--t-med) var(--ease),
              transform var(--t-med) var(--ease),
              background-color var(--t-med) var(--ease);
}

.card--pad { padding: clamp(1.25rem, 2.2vw, 1.85rem); }

a.card:hover, .card--interactive:hover {
  transform: translateY(-4px);
  border-color: var(--line-accent);
  background: var(--ink-3);
}

/* =============================================================
   Reveal on scroll
   ============================================================= */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--t-slow) var(--ease-out),
              transform var(--t-slow) var(--ease-out);
}
.reveal--left  { transform: translateX(-22px); }
.reveal--right { transform: translateX(22px); }
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* =============================================================
   Utilities
   ============================================================= */

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

[hidden] { display: none !important; }

.flow-tight > * + * { margin-top: var(--sp-3); }
.row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }

/* Утилиты вместо инлайновых style= в разметке: с ними в CSP
   не нужен 'unsafe-inline' для стилей. */
.section-pad-b { padding-bottom: var(--section-y); }
.noscript-note { padding: 2rem; text-align: center; }
