/*
 * СВИБ Дом Сервис — сайт-визитка.
 * Цвета, шрифт и пропорции взяты из брендбука v1.0 (svib-brand/brand-tokens.json, SPECIFICATION.md).
 * Красный — только акцент: скат крыши, полосы и кнопки заявки.
 */

@font-face {
  font-family: Montserrat;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/montserrat-regular.woff2') format('woff2');
}

@font-face {
  font-family: Montserrat;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/montserrat-medium.woff2') format('woff2');
}

@font-face {
  font-family: Montserrat;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/montserrat-semibold.woff2') format('woff2');
}

@font-face {
  font-family: Montserrat;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/montserrat-bold.woff2') format('woff2');
}

@font-face {
  font-family: Montserrat;
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../fonts/montserrat-extrabold.woff2') format('woff2');
}

:root {
  /* Брендбук, раздел 5 «Цвет» */
  --svib-blue: #0052cc;
  --svib-red: #e30613;
  --svib-white: #fff;
  --svib-navy: #0b2f6b;
  --svib-light-grey: #eef2f7;
  --svib-tech-grey: #c9d2de;
  --svib-slate: #5b6678;
  --svib-graphite: #1c2533;

  /* Состояния кнопок: те же оттенки, темнее на 15 % */
  --svib-blue-hover: #0046ad;
  --svib-red-hover: #c10510;

  /* Шрифт и сетка; Arial — замена по брендбуку, если Montserrat не загрузился */
  --font: 'Montserrat', 'Arial', sans-serif;
  --container: 1200px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-height: 72px;
  --radius: 8px;

  /* Уклон крыши знака — 30°; полосы наклонены на 30° от вертикали */
  --slant: 0.5774;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
}

body {
  margin: 0;
  background: var(--svib-white);
  color: var(--svib-graphite);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.45;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
}

ul[role='list'],
ol[role='list'] {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--svib-blue);
  outline-offset: 3px;
}

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--svib-blue);
  color: var(--svib-white);
  font-weight: 700;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 22px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.btn--lg {
  min-height: 56px;
  padding-inline: 28px;
  font-size: 1.0625rem;
}

.btn--red {
  background: var(--svib-red);
  color: var(--svib-white);
}

.btn--red:hover {
  background: var(--svib-red-hover);
}

.btn--outline {
  border-color: var(--svib-blue);
  background: var(--svib-white);
  color: var(--svib-blue);
}

.btn--outline:hover {
  background: var(--svib-light-grey);
}

.btn--white {
  background: var(--svib-white);
  color: var(--svib-blue);
}

.btn--white:hover {
  background: var(--svib-light-grey);
}

.btn img {
  width: 24px;
  height: 24px;
}

/* ---------- Шапка ---------- */

.header {
  position: sticky;
  z-index: 10;
  top: 0;
  height: var(--header-height);
  border-bottom: 1px solid var(--svib-tech-grey);
  background: var(--svib-white);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 100%;
}

.header__logo img {
  width: auto;
  height: 40px;
}

.header__nav {
  display: none;
  gap: 28px;
  margin-left: auto;
  font-weight: 600;
}

.header__nav a {
  text-decoration: none;
}

.header__nav a:hover {
  color: var(--svib-blue);
}

.header__phone {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-left: auto;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

/* На узком телефоне номер не помещается рядом с логотипом: остаётся трубка, номер — для экранного диктора */
@media (max-width: 479px) {
  .header__phone span {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
  }
}

.header__cta {
  display: none;
}

/* ---------- Первый экран ---------- */

.hero {
  padding-block: clamp(40px, 7vw, 88px);
}

.hero__inner {
  display: grid;
  align-items: center;
  gap: 40px;
}

.hero__title {
  max-width: 13ch;
  color: var(--svib-blue);
  font-size: clamp(2.25rem, 1.4rem + 3.4vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.05;
}

.hero__lead {
  max-width: 46ch;
  margin-top: 24px;
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.hero__actions .btn {
  width: 100%;
}

.hero__note {
  max-width: 46ch;
  margin-top: 16px;
  color: var(--svib-slate);
  font-size: 0.9375rem;
  font-weight: 500;
}

/*
 * Фирменная композиция: тонкая синяя и красная полосы и синяя плашка со знаком,
 * как на баннере брендбука. Контейнерные единицы держат наклон ровно 30° от вертикали
 * при любых пропорциях блока: сдвиг верха полосы = tg 30° × высота.
 */
.hero__art {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  container-type: size;
  border-radius: var(--radius);
  background: var(--svib-white);
}

.hero__stripe,
.hero__plate {
  position: absolute;
  inset: 0;

  /*
   * backwards, а не both: после анимации у полос не остаётся transform, Chrome снимает
   * отдельный слой, и на кромке блока не просвечивает пиксельная полоса нижнего края.
   */
  animation: stripe-in 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

.hero__stripe--thin {
  --x: 0cqw;
  --w: 3cqw;

  background: var(--svib-blue);
  clip-path: polygon(
    var(--x) 100%,
    calc(var(--x) + var(--w)) 100%,
    calc(var(--x) + var(--w) + var(--slant) * 100cqh) 0,
    calc(var(--x) + var(--slant) * 100cqh) 0
  );
}

.hero__stripe--red {
  --x: 6cqw;
  --w: 8cqw;

  background: var(--svib-red);
  animation-delay: 0.08s;
  clip-path: polygon(
    var(--x) 100%,
    calc(var(--x) + var(--w)) 100%,
    calc(var(--x) + var(--w) + var(--slant) * 100cqh) 0,
    calc(var(--x) + var(--slant) * 100cqh) 0
  );
}

.hero__plate {
  --x: 17cqw;

  background: var(--svib-blue);
  animation-delay: 0.16s;
  clip-path: polygon(var(--x) 100%, calc(var(--x) + var(--slant) * 100cqh) 0, 100% 0, 100% 100%);
}

.hero__symbol {
  /* Знак стоит на плашке: левый край не ближе 4cqw к наклонной кромке на уровне его верха */
  --sw: min(34cqw, 44cqh);
  --sh: calc(var(--sw) * 0.8856);
  --min-left: calc(21cqw + var(--slant) * (50cqh + var(--sh) / 2));

  position: absolute;
  top: calc(50cqh - var(--sh) / 2);
  left: calc((var(--min-left) + 94cqw - var(--sw)) / 2);
  width: var(--sw);
  height: var(--sh);

  /* Белый знак проявляется, когда под ним уже стоит синяя плашка */
  animation: symbol-in 0.4s ease-out 0.6s backwards;
}

@supports not (width: 1cqw) {
  .hero__stripe {
    display: none;
  }

  .hero__symbol {
    top: 50%;
    left: 60%;
    width: 30%;
    height: auto;
    transform: translateY(-50%);
  }
}

@keyframes stripe-in {
  from {
    transform: translateY(100%);
  }

  to {
    transform: none;
  }
}

@keyframes symbol-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ---------- Секции ---------- */

.section {
  padding-block: clamp(56px, 8vw, 112px);
}

.section--grey {
  background: var(--svib-light-grey);
}

.section__title {
  font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.section__lead {
  max-width: 60ch;
  margin-top: 16px;
  color: var(--svib-slate);
  font-size: 1.0625rem;
}

/* Услуги: сетка с тонкими разделителями, как ряд иконок в брендбуке */
.services {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  margin-top: 40px;
  border: 1px solid var(--svib-tech-grey);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--svib-tech-grey);
}

.service {
  display: grid;
  grid-template-columns: 48px 1fr;
  column-gap: 16px;
  row-gap: 4px;
  align-content: start;
  padding: 20px;
  background: var(--svib-white);
}

.service img {
  grid-row: span 2;
}

.service__title {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
}

.service p {
  color: var(--svib-slate);
  font-size: 0.9375rem;
}

.service--ask {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--svib-blue);
  color: var(--svib-white);
}

.service--ask p {
  color: var(--svib-white);
}

.service__link {
  align-self: flex-start;
  margin-top: auto;
  padding-top: 8px;
  font-weight: 700;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.service--ask .service__link:focus-visible {
  outline-color: var(--svib-white);
}

/* Как мы работаем: настоящая последовательность, поэтому с номерами */
.steps {
  display: grid;
  gap: 28px;
  margin-top: 40px;
}

.step {
  position: relative;
  padding-left: 64px;
}

.step__num {
  position: absolute;
  top: -4px;
  left: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--svib-blue);
  color: var(--svib-white);
  font-size: 1.25rem;
  font-weight: 800;
}

.step:last-child .step__num {
  background: var(--svib-red);
}

.step__title {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
}

.step p {
  margin-top: 6px;
  color: var(--svib-slate);
}

/* Ценности */
.values {
  display: grid;
  gap: 24px;
  margin-top: 40px;
}

.value {
  display: grid;
  grid-template-columns: 48px 1fr;
  column-gap: 16px;
  row-gap: 4px;
}

.value img {
  grid-row: span 2;
}

.value__title {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
}

.value p {
  color: var(--svib-slate);
  font-size: 0.9375rem;
}

/* Призыв */
.cta {
  position: relative;
  overflow: hidden;
  padding-block: clamp(48px, 7vw, 88px);
  background: var(--svib-blue);
  color: var(--svib-white);
}

.cta__inner {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 28px;
}

.cta__title {
  max-width: 20ch;
  font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.5rem);
  font-weight: 800;
  line-height: 1.15;
}

.cta__text {
  max-width: 48ch;
  margin-top: 12px;
  font-size: 1.0625rem;
}

.cta__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
}

.cta__phone {
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.cta :focus-visible {
  outline-color: var(--svib-white);
}

.cta__stripe {
  position: absolute;
  top: 0;
  right: 6%;
  bottom: 0;
  width: 56px;
  background: var(--svib-red);
  transform: skewX(-30deg);
}

/* Контакты */
.contacts {
  display: grid;
  gap: 32px;
}

.contacts__list {
  display: grid;
  gap: 24px;
}

.contact {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.contact img {
  flex: none;
  width: 32px;
  height: 32px;
}

.contact__label {
  color: var(--svib-slate);
  font-size: 0.875rem;
  font-weight: 500;
}

.contact__value {
  display: inline-block;
  margin-top: 2px;
  font-size: 1.125rem;
  font-weight: 700;
  text-decoration: none;
}

a.contact__value {
  white-space: nowrap;
}

a.contact__value:hover {
  color: var(--svib-blue);
}

/* ---------- Подвал ---------- */

.footer {
  padding-block: 48px;
  background: var(--svib-navy);
  color: var(--svib-white);
}

.footer__inner {
  display: grid;
  gap: 28px;
}

.footer__logo {
  width: 260px;
  height: auto;
}

.footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  font-weight: 600;
}

.footer__nav a {
  text-decoration: none;
}

.footer__nav a:hover {
  text-decoration: underline;
}

.footer__copy {
  color: var(--svib-tech-grey);
  font-size: 0.875rem;
}

.footer :focus-visible {
  outline-color: var(--svib-white);
}

/* Нижняя панель на телефоне: позвонить или оставить заявку одним касанием */
.mobile-bar {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
  padding: 8px var(--gutter) calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--svib-tech-grey);
  background: var(--svib-white);
}

/* Место под нижнюю панель, чтобы она не закрывала подвал */
body {
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

/* ---------- Планшет ---------- */

@media (min-width: 640px) {
  .hero__actions .btn {
    width: auto;
  }

  .services {
    grid-template-columns: repeat(2, 1fr);
  }

  .service {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 28px;
  }

  .service img {
    margin-bottom: 8px;
  }

  .values {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }

  .contacts__list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 720px) {
  .mobile-bar {
    display: none;
  }

  body {
    padding-bottom: 0;
  }

  .header__cta {
    display: inline-flex;
  }

  .steps {
    grid-template-columns: repeat(2, 1fr);
    gap: 40px 32px;
  }
}

/* ---------- Десктоп ---------- */

@media (min-width: 1024px) {
  .header__nav {
    display: flex;
  }

  .header__phone {
    margin-left: 0;
  }

  .hero__inner {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 56px;
  }

  .hero__art {
    aspect-ratio: 6 / 5;
  }

  .services {
    grid-template-columns: repeat(4, 1fr);
  }

  .steps {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Линия между номерами шагов */
  .step::before {
    position: absolute;
    top: 18px;
    right: -32px;
    left: 56px;
    height: 2px;
    background: var(--svib-tech-grey);
    content: '';
  }

  .step:last-child::before {
    display: none;
  }

  .step {
    padding-top: 64px;
    padding-left: 0;
  }

  .step__num {
    top: 0;
  }

  .values {
    grid-template-columns: repeat(5, 1fr);
    gap: 32px;
  }

  .value {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .value img {
    margin-bottom: 8px;
  }

  .cta__inner {
    grid-template-columns: 1fr auto;
    align-items: center;
    padding-right: 160px;
  }

  .contacts {
    grid-template-columns: 1fr 1.4fr;
    align-items: start;
  }

  .footer__inner {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 48px;
  }

  .footer__nav {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero__stripe,
  .hero__plate,
  .hero__symbol {
    animation: none;
  }

  .btn {
    transition: none;
  }
}
