/* ==========================================================================
   IMINERA Avatar / K3 «Размерная система»
   styles.css (шаг 1): токены, reset, типографика, контейнер, сетка 12 колонок,
   кнопки, поля формы, .stub, .img-stub, шапка, hero, секции pains и modules.
   Стили секций шага 2 живут в sections.css, эффекты шага 3 в effects.css.
   Mobile-first: базовые стили для 360 px, расширения через min-width.
   ========================================================================== */

/* ---------- Токены ---------- */
:root {
  --white: #FFFFFF;
  --pastel: #F8F3F3;
  --border: #E8E0E0;
  --border-2: #D8CCCC;
  --dark: #333333;
  --grey: #666666;
  --ink: #1F1F1F;

  /* Белый текст только на --accent-dark. --accent только для крупных цифр, линий и заливок */
  --accent: #E91E63;
  --accent-dark: #C2185B;
  --accent-deep: #A3134D;            /* hover кнопки */
  --accent-tint: rgba(194, 24, 91, 0.07);

  --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;

  --gutter: 20px;
  --gap: 24px;
  --radius: 2px;
  --header-h: 64px;
  --container: 1240px;
}

@media (min-width: 768px) {
  :root { --gutter: 32px; }
}
@media (min-width: 1280px) {
  :root { --header-h: 72px; }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 8px);
}

body {
  margin: 0;
  background: var(--white);
  color: var(--dark);
  font: 400 1rem/1.65 var(--font);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; }

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

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

a { color: var(--accent-dark); text-underline-offset: 0.2em; }

:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
}

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

.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--white);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-110%);
}
.skip-link:focus-visible {
  transform: translateY(0);
  outline-color: var(--white);
  outline-offset: -4px;
}

/* ---------- Типографика ---------- */
h1 {
  font-weight: 800;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}

h2 {
  font-weight: 700;
  font-size: clamp(1.7rem, 3.4vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}

h3 {
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.25;
  letter-spacing: -0.005em;
  color: var(--ink);
}

/* Метка капсом: 600, 11-12 px, tracking .1em */
.label,
.kicker {
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.label { display: block; font-size: 0.6875rem; color: var(--dark); }
.kicker { margin-bottom: 16px; color: var(--accent-dark); }

/* Крупный номер модуля или причины: 01 02 03 04 */
.num {
  display: block;
  font-weight: 800;
  font-size: clamp(3rem, 5vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* Подпись моно-стилем */
.caption {
  margin-top: 12px;
  padding-left: 12px;
  border-left: 2px solid var(--accent);
  font: 400 0.75rem/1.5 var(--font-mono);
  letter-spacing: 0.02em;
  color: var(--grey);
}

/* ---------- Контейнер и сетка 12 колонок ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Мобильный вариант: все потомки на всю ширину; помощники .md-* и .lg-* задают span.
   У каждого потомка колонки заданы явно, лишних неявных колонок нет. */
.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  row-gap: var(--gap);
}
.grid-12 > * { grid-column: 1 / -1; min-width: 0; }

@media (min-width: 768px) {
  .grid-12 > .md-4 { grid-column: span 4; }
  .grid-12 > .md-6 { grid-column: span 6; }
  .grid-12 > .md-8 { grid-column: span 8; }
}
@media (min-width: 1024px) {
  .grid-12 > .lg-3 { grid-column: span 3; }
  .grid-12 > .lg-4 { grid-column: span 4; }
  .grid-12 > .lg-5 { grid-column: span 5; }
  .grid-12 > .lg-6 { grid-column: span 6; }
  .grid-12 > .lg-7 { grid-column: span 7; }
  .grid-12 > .lg-8 { grid-column: span 8; }
  .grid-12 > .lg-9 { grid-column: span 9; }
}

/* ---------- Секции (общее) ---------- */
.section {
  padding-block: 64px;
  border-top: 1px solid var(--border);
}
.section-alt { background: var(--pastel); }

@media (min-width: 768px) {
  .section { padding-block: 96px; }
}

.section-head { margin-bottom: 40px; row-gap: 16px; }
@media (min-width: 768px) {
  .section-head { margin-bottom: 56px; }
}
@media (min-width: 1024px) {
  .section-head { align-items: end; }
}

.section-title::after {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  margin-top: 20px;
  background: var(--accent);
}

.section-lead {
  color: var(--grey);
  font-size: 1.0625rem;
  line-height: 1.6;
  max-width: 52ch;
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: 600 0.875rem/1.2 var(--font);
  letter-spacing: 0.02em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--accent-dark); color: var(--white); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-sm { min-height: 44px; padding: 0 18px; font-size: 0.8125rem; }
.btn-block { width: 100%; }

.btn:disabled,
.btn[disabled] {
  background: var(--pastel);
  border-color: var(--border-2);
  color: var(--grey);
  cursor: not-allowed;
}
.btn:disabled:active { transform: none; }

@media (hover: hover) {
  .btn-primary:hover { background: var(--accent-deep); }
  .btn-secondary:hover { border-color: var(--accent-dark); color: var(--accent-dark); }
}

/* ---------- Поля формы (общие; разметка как в a-etalon) ---------- */
.request-form { display: grid; gap: 20px; }

.form-row { display: grid; gap: 6px; }
.form-row-split { grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 640px) {
  .form-row-split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.form-row-split > div { display: grid; gap: 6px; }

.form-row label,
.form-row-split label {
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dark);
}

.form-row input,
.form-row textarea,
.form-row select,
.form-row-split input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.4;
  transition: border-color 0.18s ease;
}
.form-row textarea { min-height: 112px; resize: vertical; }
.form-row input:focus-visible,
.form-row textarea:focus-visible,
.form-row select:focus-visible,
.form-row-split input:focus-visible {
  border-color: var(--accent-dark);
  outline: 2px solid var(--accent-dark);
  outline-offset: 1px;
}

.form-status {
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: var(--accent-tint);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.9375rem;
}
.form-status[hidden] { display: none; }

/* Широкие таблицы: контейнер со своим горизонтальным скроллом */
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Заглушки ---------- */
.stub {
  padding: 0 3px;
  background: var(--accent-tint);
  border-bottom: 1px dashed var(--accent-dark);
  cursor: help;
}

.img-stub {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 16px;
  background: var(--pastel);
  border: 1px dashed var(--border-2);
  color: var(--grey);
  font: 500 0.75rem/1.4 var(--font-mono);
  letter-spacing: 0.02em;
  text-align: center;
}

/* Метка «по запросу» и подобные */
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--accent-dark);
  border-radius: var(--radius);
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 0.6875rem;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Плашка «временно» (стили в shared-assets/tmp-borrowed.css): картинка внутри плашки заполняет рамку */
.tmp-borrowed img { display: block; }

/* Изображение, заполняющее рамку с заданной пропорцией */
.media-fill {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================================
   Шапка
   Мобильный вариант: меню прячется под бургер (без JS показывается списком, см. noscript в head).
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 16px;
  min-height: var(--header-h);
}

.logo {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.logo img { width: 112px; height: auto; }

/* Бургер */
.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Панель меню: навигация, переключатель, телефон, CTA */
.header-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: calc(100vh - var(--header-h));
  max-height: calc(100dvh - var(--header-h));
  padding: 8px var(--gutter) 24px;
  overflow-y: auto;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}
.header-menu.is-open {
  display: block;
  animation: menu-in 0.18s ease-out;
}
@keyframes menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.main-nav ul { list-style: none; }
.main-nav a {
  display: flex;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
}

.header-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  padding-top: 20px;
}

/* Переключатель вариантов: цвета через переменные shared-assets/proto-switch-k.css */
.proto-switch {
  --sw-bg: var(--pastel);
  --sw-line: var(--border);
  --sw-fg: var(--grey);
  --sw-fg-hover: var(--ink);
  --sw-active-bg: var(--accent-dark);
  --sw-active-fg: #fff;
  --sw-font: 'Montserrat', system-ui, sans-serif;
  align-self: flex-start;
}
.proto-switch__btn { min-width: 44px; height: 44px; font-size: 0.875rem; }

.header-phone {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--ink);
  font-weight: 700;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  white-space: nowrap;
}
.header-phone .icon { width: 18px; height: 18px; color: var(--accent-dark); }

.header-cta { width: 100%; }

@media (hover: hover) {
  .main-nav a:hover { color: var(--accent-dark); }
  .header-phone:hover { color: var(--accent-dark); }
}

/* Десктоп: меню в одну строку, бургера нет */
@media (min-width: 1280px) {
  .header-inner { flex-wrap: nowrap; gap: 32px; }
  .logo img { width: 124px; }

  .nav-toggle { display: none; }

  .header-menu,
  .header-menu.is-open {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    position: static;
    max-height: none;
    padding: 0;
    overflow: visible;
    background: transparent;
    border-bottom: 0;
    animation: none;
  }

  .main-nav { margin-inline: auto; }
  .main-nav ul { display: flex; gap: 4px 20px; }
  .main-nav a {
    min-height: 44px;
    border-bottom: 0;
    font-size: 0.8125rem;
    white-space: nowrap;
  }

  .header-actions {
    flex-direction: row;
    align-items: center;
    gap: 20px;
    padding-top: 0;
  }
  .proto-switch { align-self: auto; }
  .proto-switch__btn { min-width: 32px; height: 32px; font-size: 0.75rem; }
  .header-phone { font-size: 0.875rem; }
  .header-cta { width: auto; }
}

/* ==========================================================================
   Hero (#hero)
   ========================================================================== */
.hero {
  padding-block: 40px 56px;
  background: var(--white);
}
.hero .tag { margin-bottom: 24px; white-space: normal; }
.hero__top { row-gap: 32px; }
.hero__text { min-width: 0; }

.mark {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 0.07em;
  text-underline-offset: 0.12em;
  text-decoration-skip-ink: none;
}

.hero__lede {
  max-width: 60ch;
  margin-top: 24px;
  font-size: 1.0625rem;
  color: var(--dark);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}
.hero__actions .btn { width: 100%; }

.hero__note {
  max-width: 60ch;
  margin-top: 24px;
  font: 400 0.75rem/1.6 var(--font-mono);
  letter-spacing: 0.02em;
  color: var(--grey);
}

/* Подтверждённые цифры: 2×2 на мобильном, ряд на планшете, вертикальная колонка на десктопе */
.hero__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-self: start;
}
.stat {
  padding: 16px 12px 16px 0;
  border-top: 1px solid var(--border-2);
}
.stat__num {
  display: inline;
  font-weight: 800;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.stat__unit {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}
.stat__desc {
  margin-top: 6px;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--grey);
}

@media (min-width: 640px) {
  .hero__actions .btn { width: auto; }
  .hero__stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .hero { padding-block: 64px 80px; }
  .hero__stats { grid-template-columns: minmax(0, 1fr); }
  .stat { padding-block: 20px; }
  .stat:last-child { border-bottom: 1px solid var(--border-2); }
}

/* Фото размерного ряда: 3:2 на мобильном, на десктопе обрезка до 21:9 */
.hero__visual { margin-top: 40px; }
.hero__photo {
  position: relative;
  aspect-ratio: 3 / 2;
  background: var(--pastel);
  border: 1px solid var(--border);
}
.hero__photo .media-fill { object-position: 50% 40%; }

@media (min-width: 1024px) {
  .hero__visual { margin-top: 56px; }
  .hero__photo { aspect-ratio: 21 / 9; }
}

/* ==========================================================================
   Секция «Проблема» (#pains)
   Три колонки с большими номерами и тонкими разделителями, не карточки.
   ========================================================================== */
.pains__list {
  list-style: none;
  row-gap: 0;
  column-gap: 0;
}

.pain {
  display: grid;
  gap: 16px;
  padding-block: 28px 32px;
  border-top: 1px solid var(--border-2);
}
.pain:last-child { border-bottom: 1px solid var(--border-2); }

.pain__body { display: grid; gap: 12px; align-content: start; }
.pain__title { font-size: 1.375rem; }
.pain__text { color: var(--dark); max-width: 60ch; }
.pain__link {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-2);
  font: 400 0.75rem/1.5 var(--font-mono);
  letter-spacing: 0.02em;
  color: var(--grey);
}

@media (min-width: 640px) {
  .pain {
    grid-template-columns: 112px minmax(0, 1fr);
    column-gap: 24px;
  }
}

@media (min-width: 1024px) {
  .pain {
    display: block;
    padding: 32px 32px 40px;
    border-bottom: 1px solid var(--border-2);
  }
  .pain:first-child { padding-left: 0; }
  .pain:last-child { padding-right: 0; }
  .pain + .pain { border-left: 1px solid var(--border-2); }
  .pain .num { margin-bottom: 24px; }
}

/* ==========================================================================
   Секция «Модули» (#modules)
   Сетка 2×2 на десктопе, видимые линии сетки без теней.
   ========================================================================== */
.modules__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  list-style: none;
  border-top: 1px solid var(--border-2);
  border-left: 1px solid var(--border-2);
}

.module {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
  padding: 24px;
  border-right: 1px solid var(--border-2);
  border-bottom: 1px solid var(--border-2);
}

.module__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--white);
  border: 1px solid var(--border);
}
.module__media .media-fill { object-position: 50% 38%; }
.module__media--contain .media-fill { object-fit: contain; object-position: 50% 50%; }

.module__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}
.module__head .num { font-size: clamp(2.5rem, 4vw, 3.5rem); }
.module__title { font-size: 1.5rem; }
.module__head .tag { margin-left: auto; }

.module__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 16px;
}
.module__text { color: var(--dark); }
.module__out {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--grey);
}
.module__out .label { margin-bottom: 4px; }

/* Мини-таблица размеров (inline SVG модуля 03): цвета из токенов */
.svg-table { background: var(--white); }
.svg-head {
  fill: var(--grey);
  font-family: var(--font);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.1em;
}
.svg-cap {
  fill: var(--grey);
  font-family: var(--font);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.1em;
}
.svg-line { stroke: var(--border-2); stroke-width: 1; }
.svg-line-strong { stroke: var(--ink); stroke-width: 1.5; }
.svg-bar { fill: var(--border-2); }
.svg-bar-hl { fill: var(--accent-dark); }
.svg-row-hl { fill: var(--accent-tint); stroke: var(--accent); stroke-width: 1.5; }

@media (min-width: 768px) {
  .modules__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .module { padding: 32px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
  }
}
