/* ==========================================================================
   САРМАТ — стартовая страница.
   Вёрстка по макету home.psd (1920 × 7400). Контентная колонка 1526 px,
   мозаики — сетка 5 × 3 с гаттером 6 px.

   Масштабирование: 1rem = 16 px макета, html { font-size: 100vw / 120 },
   поэтому страница пропорционально повторяет макет при любой ширине окна.
   Все значения в файле — это px макета, делённые на 16.

   Брейкпоинт 1140 px: макет перестаёт масштабироваться, включается
   перестроенная раскладка (одна колонка, фиксированный кегль).
   ========================================================================== */

/* --- Шрифт: Montserrat (variable 100–900), кириллица + латиница ---------- */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../assets/fonts/montserrat-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../assets/fonts/montserrat-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- Токены -------------------------------------------------------------- */
:root {
  --bg: #020202;
  --blue: #2e3dbe;
  --pink: #f816a8;
  --panel: #fefefe;
  --dim: #808080;

  --content: 95.375rem;  /* 1526 */
  --gutter: 0.375rem;    /* 6 */
  --header-h: 5.75rem;   /* 92 */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: clamp(6px, calc(100vw / 120), 22px);
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: #fff;
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

:focus-visible { outline: 0.125rem solid #fff; outline-offset: 0.1875rem; }

/* ==========================================================================
   Шапка — плавающая полоса во всю ширину, чёрная (в тон странице);
   содержимое выровнено по контентной колонке: МЕНЮ слева (204 px до логотипа),
   логотип по центру, иконка и телефон справа (195 px от логотипа).
   ========================================================================== */
.header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 1.125rem; /* 18 — высота полосы 110 = 18 + 92 */
  background: var(--bg);
}

.header__bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: var(--content);
  height: var(--header-h);
}

.menu-btn {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.625rem;       /* 10 */
  margin-right: 12.75rem; /* 204 */
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.menu-btn__icon { width: 1.3125rem; height: 1rem; }
.menu-btn__label { font-size: 1.0417rem; line-height: 1; letter-spacing: 0.02em; }

.header__logo { grid-column: 2; }
.header__logo img { height: 5.3125rem; width: auto; }

.header__contact {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 0.875rem;         /* 14 */
  margin-left: 12.1875rem; /* 195 */
}
.header__contact-icon { width: 1.75rem; height: 1.625rem; }
.header__phone { font-size: 1.0417rem; line-height: 1; }

/* ==========================================================================
   Меню — панель 584 × 1301 из макета, выезжает слева.
   ========================================================================== */
.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease), visibility 0.35s var(--ease);
}
body.menu-open .menu-backdrop { opacity: 1; visibility: visible; }
body.menu-open { overflow: hidden; }

.menu {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 36.5rem; /* 584 */
  visibility: hidden;
  transform: translateX(-100%);
  transition: transform 0.45s var(--ease), visibility 0.45s var(--ease);
}
body.menu-open .menu { visibility: visible; transform: none; }

.menu__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  background: var(--panel);
  color: #000;
}

.menu__logo { width: 17.875rem; height: 11.625rem; margin: 0.8125rem 0 0 9.3125rem; }

.menu__close {
  position: absolute;
  top: 1.625rem;
  right: 1.5625rem;
  width: 1.5625rem;
  height: 1.5625rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.menu__close img { width: 100%; height: 100%; }

.menu__nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 4.8125rem; /* 77 */
  font-size: 1.8229rem;  /* 29.167 */
  line-height: 1.2;
  text-align: center;
}
.menu__nav a { color: var(--dim); transition: color 0.2s var(--ease); }
.menu__nav a + a { margin-top: 2.1875rem; /* 35 */ }
.menu__nav a:hover,
.menu__nav a:focus-visible,
.menu__nav a.is-active { color: #000; }

.menu__socials {
  display: flex;
  justify-content: center;
  gap: 1.3125rem; /* 21 */
  margin: auto 0 2.9375rem; /* 47 */
}
.menu__socials img { width: 3.4375rem; height: 3.4375rem; }

/* ==========================================================================
   Стартовая плитка (hero): 5 карточек, при наведении — затемнение,
   иконка и название; клик ведёт в секцию.
   ========================================================================== */
main { padding-top: 7.9375rem; /* 127 */ }

.hero {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--gutter);
  width: var(--content);
  margin: 0 auto;
  aspect-ratio: 1526 / 642;
}


.hero__card { position: relative; overflow: hidden; }
.hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.hero__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, 0.5); /* маска из макета: чёрный, alpha 128 */
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.hero__icon {
  position: absolute;
  top: 15.25rem; /* 244 */
  width: 4.8125rem;
  height: 4.8125rem;
}
.hero__label {
  position: absolute;
  right: 0;
  bottom: 3.25rem; /* 52 */
  left: 0;
  font-size: 1.5625rem;
  line-height: 1.2;
  text-align: center;
}

@media (hover: hover) {
  .hero__card:hover .hero__overlay { opacity: 1; }
  .hero__card:hover .hero__img { transform: scale(1.05); }
}
.hero__card:focus-visible .hero__overlay { opacity: 1; }
@media (hover: none) {
  .hero__overlay { opacity: 1; } /* на тач-устройствах подписи видны всегда */
  .hero__label { font-size: 1.25rem; }
}

/* ==========================================================================
   Секции: иконка, заголовок, мозаика 5 × 3.
   Позиции плиток заданы в разметке через grid-area (как в макете).
   ========================================================================== */
.services {
  width: var(--content);
  margin: 0 auto;
  padding-top: 9.125rem; /* 146 — разрыв до заголовка секции (и от стартового блока) */
  text-align: center;
  scroll-margin-top: 7.9375rem;
}

.services__icon { width: 4.8125rem; height: 4.8125rem; margin: 0 auto; }

.services__title {
  margin: 1.5625rem 0 2rem; /* 25 / 32 — по макету: капс-строка на 1028, мозаика на 1103 */
  font-size: 2.8969rem;         /* 46.35 */
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.mosaic {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: var(--gutter);
  aspect-ratio: 1526 / 913;
  text-align: left;
}

.tile {
  grid-area: var(--area); /* макетная расстановка приходит из разметки */
  display: flex;
  align-items: center;
  overflow: hidden;
  border-radius: 0.25rem; /* 4 px в масштабе макета */
  background: var(--blue);
}
.tile--photo { background: none; }
.tile--pink { background: var(--pink); }

.tile--photo img { width: 100%; height: 100%; object-fit: cover; }

.tile__text {
  margin: 0;
  padding-left: var(--pad, 1.25rem);
  font-size: 1.5625rem; /* 25 */
  line-height: 1.2;
  white-space: nowrap;
}
.tile__text b { font-weight: 700; }

.tile--center { justify-content: center; }
.tile--center .tile__text { padding-left: 0; text-align: center; }

.tile__list {
  padding-left: var(--pad);
  line-height: 1.3333;
  list-style: decimal inside; /* нумерация без висячего отступа, как в макете */
}
.tile__list li { margin: 0; }

/* ==========================================================================
   Подвал
   ========================================================================== */
.footer {
  width: var(--content);
  margin: 0 auto;
  padding: 6.9375rem 0 10.1875rem; /* 111 / 163 */
  text-align: center;
  scroll-margin-top: 7.9375rem;
}
.footer__nav { display: flex; flex-direction: column; align-items: center; gap: 2.5rem; }
.footer__nav a {
  font-size: 2.0831rem; /* 33.33 */
  line-height: 1.2;
  transition: color 0.2s var(--ease);
}
.footer__nav a:hover { color: var(--pink); }

/* ==========================================================================
   Адаптив. Ниже 1140 px макет перестаёт масштабироваться целиком: кегли
   фиксируются, а мозаика пересобирается в ровную сетку: две колонки, все
   плитки одной ширины, `dense` подтягивает плитку в свободную ячейку, поэтому
   дыр внутри секции нет. Одиночная плитка последнего ряда (в секциях с
   нечётным числом плиток) растягивается на две колонки.
   ========================================================================== */
@media (max-width: 71.25rem) { /* 1140px */
  html { font-size: 16px; }
  :root { --header-h: 64px; }

  .header { padding-top: 12px; } /* полоса 76 = 12 + 64 */
  .header__bar {
    width: 100%;
    max-width: 900px;
    padding-inline: 16px; /* как у секций: контент в одной колонке */
  }
  .menu-btn { justify-self: start; margin-right: 0; }
  .menu-btn__icon { width: 24px; height: 18px; }
  .menu-btn__label { font-size: 13px; }
  .header__logo img { height: 40px; }
  .header__contact { justify-self: end; margin-left: 0; gap: 10px; }
  .header__contact-icon { width: 24px; height: 22px; }
  .header__phone { font-size: 13px; }

  .menu { width: min(100%, 420px); }
  .menu__logo { width: 180px; height: 117px; margin: 16px 0 0 24px; }
  .menu__close { top: 18px; right: 18px; }
  .menu__nav { margin-top: 40px; font-size: 22px; }
  .menu__nav a + a { margin-top: 22px; }
  .menu__socials img { width: 40px; height: 40px; }

  main { padding-top: 0; }

  .hero,
  .services,
  .footer {
    width: 100%;
    max-width: 900px; /* на планшете колонка не растягивается на всю ширину */
    margin-inline: auto;
    padding-inline: 16px;
  }

  .hero {
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); /* 5 карточек в строку */
    gap: 8px;
    padding-top: 84px;
    aspect-ratio: auto;
  }
  .hero__card { aspect-ratio: 3 / 4; }
  .hero__overlay { justify-content: center; gap: 10px; }
  .hero__icon { position: static; width: 44px; height: 44px; }
  .hero__label { position: static; font-size: 15px; }

  .services { padding-top: 72px; scroll-margin-top: 84px; }
  .services__icon { width: 64px; height: 64px; }
  .services__title {
    margin: 14px 0 28px;
    font-size: 26px;
    white-space: normal;
  }

  /* --- мозаика: две колонки, текстовые плашки во всю ширину, фото парами --- */
  .mosaic {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto; /* сброс макетных 3 × 1fr: ряды идут по контенту */
    grid-auto-flow: row dense; /* плитка встаёт в свободную ячейку — дыр в рядах нет */
    gap: 12px;
    aspect-ratio: auto;
  }
  .tile { grid-area: auto; } /* макетная расстановка выключается */
  .tile--photo { aspect-ratio: 1 / 1; } /* фото режется по центру до общего размера */
  .tile--photo img { width: 100%; height: 100%; object-fit: cover; }
  .tile--blue,
  .tile--pink { grid-column: 1 / -1; } /* текстовые плашки — во всю ширину */

  .tile__text {
    padding: 30px 14% 30px 30px; /* справа воздух: строка не растягивается на планшет */
    font-size: 21px;
    line-height: 1.45;
    white-space: normal;
  }
  .tile__text br { display: none; } /* строки макета пересобираются по ширине */
  .tile--center .tile__text { padding: 26px; text-align: center; }
  .tile__list {
    padding: 30px 14% 30px 30px;
    font-size: 19px;
    line-height: 1.55;
  }

  .footer { padding: 56px 16px 64px; scroll-margin-top: 84px; }
  .footer__nav a { font-size: 24px; }
}

@media (min-width: 37.5rem) and (max-width: 47.99rem) { /* 600–767px */
  .hero { grid-template-columns: repeat(3, 1fr); } /* 3 + 2 карточки, без «4 + 1» */
}

@media (max-width: 37.5rem) { /* 600px: одна колонка */
  .hero { grid-template-columns: repeat(2, 1fr); }
  .hero__card:last-child { grid-column: span 2; aspect-ratio: 2 / 1; }

  .mosaic { grid-template-columns: 1fr; gap: 10px; }
  .tile--photo { aspect-ratio: 4 / 3; }
  .tile__text {
    padding: 22px;
    font-size: 17px;
    line-height: 1.5;
  }
  .tile__list { padding: 22px; font-size: 17px; line-height: 1.55; }
}

@media (max-width: 30rem) { /* 480px */
  .menu-btn__label { display: none; }
  .hero__label { font-size: 14px; }
  .services__title { font-size: 20px; }
  .tile__text { padding: 22px; }
  .tile--center .tile__text { padding: 22px; }
  .tile__list { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
