/* ==========================================================================
   Главная страница (tpl/blocks/home.tpl, javascript/home.js). Подключается после styles/layout.css.
   Перенесено из вёрстки task3/style.css: всё внутри .hp, классы с приставкой hp-.
   ========================================================================== */

/* плавная прокрутка к секциям по якорным ссылкам */
html {
  scroll-behavior: smooth;
}

/* для тех, у кого в системе отключена анимация, — обычная прокрутка */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ==========================================================================
   Блок 1 — Hero
   ========================================================================== */

.hp .hp-hero {
  position: relative;
  display: flex;
  /* на десктопе блок сохраняет пропорции фона макета (2598 × 870) */
  min-height: max(433px, calc(100vw * 870 / 2598));
  background: var(--dark-green) url("/images/home/hero-bg.jpg") center / cover no-repeat;
  color: var(--light);
  overflow: hidden;
}

.hp .hp-hero__inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding-top: 34px;
  padding-bottom: 40px;
}

.hp .hp-hero__content {
  max-width: 600px;
}

.hp .hp-hero__title {
  margin-top: 18px;
  font-size: 43px;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0.01em;
}

.hp .hp-hero__subtitle {
  margin-top: 12px;
  font-size: 23px;
  line-height: 1.3;
}

.hp .hp-hero__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 22px;
}

.hp .hp-hero__buttons .hp-btn {
  min-width: 188px;
}

/* Счётчики — у правого края экрана на фоне тележек */
.hp .hp-hero__stats {
  position: absolute;
  top: 25%;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px clamp(16px, 1.4vw, 40px) 16px 40px;
  /* #99C45A с прозрачностью ~62% (по ТЗ — 60–65%) */
  background: rgba(153, 196, 90, 0.62);
  color: var(--light);
  text-align: right;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.hp .hp-hero__stat {
  display: flex;
  flex-direction: column;
}

.hp .hp-hero__stat-num {
  font-size: 30px;
  font-weight: 500;
  line-height: 1.1;
}

.hp .hp-hero__stat-text {
  font-size: 15px;
  line-height: 1.2;
}

/* Преимущества внизу блока */
.hp .hp-hero__features {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px 0;
}

.hp .hp-hero__feature {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 28px;
  font-size: 18px;
  line-height: 1.2;
}

.hp .hp-hero__feature + .hp-hero__feature {
  padding-left: 40px;
  border-left: 2px solid var(--light);
}

.hp .hp-hero__feature img {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
}

/* ---------- Hero: планшет ---------- */

@media (max-width: 1100px) {
  .hp .hp-hero {
    min-height: 0;
    background-position: 75% center;
  }

  /* затемнение, чтобы текст читался поверх фотографии */
  .hp .hp-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(55, 61, 47, 0.95) 0%, rgba(55, 61, 47, 0.75) 55%, rgba(40, 40, 40, 0.35) 100%);
  }

  .hp .hp-hero__inner {
    position: relative;
    padding-top: 40px;
    padding-bottom: 40px;
  }

  .hp .hp-hero__stats {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 24px 48px;
    padding: 0;
    background: none;
    text-align: left;
  }
}

/* ---------- Hero: мобильные ---------- */

@media (max-width: 768px) {
  .hp {
    --gutter: 16px;
  }

  .hp .hp-hero::before {
    background: linear-gradient(180deg, rgba(55, 61, 47, 0.92) 0%, rgba(55, 61, 47, 0.8) 60%, rgba(35, 35, 35, 0.9) 100%);
  }

  .hp .hp-hero__inner {
    gap: 28px;
    padding-top: 28px;
    padding-bottom: 32px;
  }

  .hp .hp-hero__title {
    margin-top: 14px;
    font-size: 30px;
  }

  .hp .hp-hero__br {
    display: none;
  }

  .hp .hp-hero__subtitle {
    font-size: 18px;
  }

  .hp .hp-hero__buttons .hp-btn {
    flex: 1 1 200px;
  }

  .hp .hp-hero__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 16px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  }

  .hp .hp-hero__stat-num {
    font-size: 24px;
  }

  .hp .hp-hero__stat-text {
    font-size: 13px;
  }

  .hp .hp-hero__stat-text br {
    display: none;
  }

  .hp .hp-hero__features {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .hp .hp-hero__feature,
  .hp .hp-hero__feature + .hp-hero__feature {
    padding: 0;
    border: 0;
    font-size: 16px;
  }
}

@media (max-width: 400px) {
  .hp .hp-hero__title {
    font-size: 26px;
  }

  .hp .hp-hero__stat-num {
    font-size: 20px;
  }
}

/* ==========================================================================
   Блок 2 — Продукция нашего завода
   ========================================================================== */

.hp .hp-products {
  padding: 34px 0 40px;
  background: var(--gray-bg);
}

.hp .hp-products__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px 20px;
}

.hp .hp-product-card {
  position: relative;
  display: block;
  aspect-ratio: 2400 / 1229;
  overflow: hidden;
  border: 1px solid #cfcfcf;
  border-radius: 8px;
  background: var(--gray-bg);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.hp .hp-product-card:hover {
  border-color: var(--green);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.hp .hp-product-card:active {
  transform: translateY(1px);
}

.hp .hp-product-card:hover .hp-product-card__title {
  color: var(--green);
}

.hp .hp-product-card:hover .hp-circle-arrow {
  color: var(--dark);
}

/* товар на картинке справа, слева — свободное поле под текст */
.hp .hp-product-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right center;
}

.hp .hp-product-card__body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 55%;
  padding: 14px 0 0 16px;
}

/* у лотков товар начинается левее — сужаем текст */
.hp .hp-product-card--narrow .hp-product-card__body {
  max-width: 46%;
}

.hp .hp-product-card__title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  transition: color 0.2s;
}

.hp .hp-product-card__text {
  font-size: 13.5px;
  line-height: 1.35;
}

.hp .hp-product-card .hp-circle-arrow {
  position: absolute;
  left: 14px;
  bottom: 14px;
}

/* ==========================================================================
   Блок 3 — От чертежа до готового изделия
   ========================================================================== */

.hp .hp-production {
  padding: 30px 0 34px;
  background: #e8f3da url("/images/home/production-bg.jpg") center / cover no-repeat;
}

.hp .hp-production__inner {
  display: grid;
  grid-template-columns: minmax(0, 380px) 1fr;
  gap: 40px;
  align-items: start;
}

.hp .hp-production__content {
  padding-top: 28px;
}

.hp .hp-production__title {
  margin-top: 14px;
  font-size: 36px;
  line-height: 1.25;
}

.hp .hp-production__text {
  margin-top: 8px;
  font-size: 17px;
  line-height: 1.5;
}

.hp .hp-production .hp-btn {
  margin-top: 24px;
}

.hp .hp-stages {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.hp .hp-stage__img {
  position: relative;
  margin-top: 12px;
}

.hp .hp-stage__img img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.hp .hp-stage__num {
  position: absolute;
  top: -14px;
  left: -8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
}

.hp .hp-stage__title {
  margin-top: 8px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}

.hp .hp-stage__text {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.35;
}

/* ==========================================================================
   Блок 4 — Изготовим по вашим размерам
   ========================================================================== */

.hp .hp-order {
  /* высота не меньше пропорции фона (2598×504), иначе на широких экранах обрезается тележка с размерами */
  display: flex;
  align-items: center;
  min-height: calc(100vw * 504 / 2598);
  padding: 30px 0;
  background: #2b2b2b url("/images/home/order-bg.jpg") center / cover no-repeat;
  color: var(--white);
}

.hp .hp-order > .hp-container {
  width: 100%;
}

.hp .hp-order__inner {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 40px;
  align-items: center;
}

.hp .hp-order__content {
  max-width: 580px;
  align-self: start;
}

.hp .hp-order__title {
  margin-top: 16px;
  color: var(--white);
  font-size: 36px;
}

.hp .hp-order__text {
  margin-top: 18px;
  font-size: 17px;
}

.hp .hp-form-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border-radius: 14px;
  background: var(--light);
  color: var(--text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.hp .hp-form-card__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.hp .hp-form-card .hp-btn {
  margin-top: 6px;
}

/* ==========================================================================
   Блок 5 — Подтвержденное качество
   ========================================================================== */

.hp .hp-quality {
  /* светлый зазор между тёмными блоками «Изготовим по вашим размерам» и «Подтвержденное качество» — по макету */
  margin-top: 14px;
  display: flex;
  align-items: center;
  min-height: max(435px, calc(100vw * 870 / 2598));
  padding: 36px 0;
  background: #2c2f28 url("/images/home/quality-bg.jpg") center / cover no-repeat;
  color: var(--white);
}

.hp .hp-quality__content {
  width: min(545px, 52%);
  margin-left: auto;
}

.hp .hp-quality__title {
  margin-top: 14px;
  color: var(--white);
  font-size: 36px;
  font-weight: 500;
  line-height: 1.3;
}

.hp .hp-quality__list {
  margin-top: 18px;
  font-size: 17px;
  line-height: 1.5;
}

.hp .hp-quality__cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: 26px;
}

.hp .hp-info-card {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  grid-template-areas:
    "icon title arrow"
    ".    text  text";
  gap: 10px 12px;
  min-height: 122px;
  padding: 12px 14px 16px;
  border: 1.5px solid rgba(244, 244, 244, 0.85);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
  color: var(--light);
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}

/* при наведении карточка светлеет, текст #333333 (по ТЗ), иконка — тёмная версия */
.hp .hp-info-card:hover {
  border-color: var(--light);
  background: var(--light);
  color: var(--dark);
}

.hp .hp-info-card:active {
  transform: translateY(1px);
}

.hp .hp-info-card:hover .hp-circle-arrow {
  color: var(--dark);
}

.hp .hp-info-card__icon {
  position: relative;
  grid-area: icon;
  width: 44px;
  height: 44px;
}

.hp .hp-info-card__icon img {
  width: 44px;
  height: 44px;
}

.hp .hp-info-card__icon .hp-info-card__icon-hover {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.2s;
}

.hp .hp-info-card:hover .hp-info-card__icon-hover {
  opacity: 1;
}

.hp .hp-info-card__title {
  grid-area: title;
  font-size: 17px;
  line-height: 1.3;
}

.hp .hp-info-card .hp-circle-arrow {
  grid-area: arrow;
}

.hp .hp-info-card__text {
  grid-area: text;
  font-size: 14px;
  line-height: 1.4;
}

/* ==========================================================================
   Блок 6 — Каталог
   ========================================================================== */

.hp .hp-catalog {
  display: flex;
  align-items: center;
  min-height: max(435px, calc(100vw * 870 / 2598));
  padding: 34px 0 30px;
  background: var(--gray-bg) url("/images/home/catalog-bg.jpg") center / cover no-repeat;
}

.hp .hp-catalog > .hp-container {
  width: 100%;
}

.hp .hp-catalog__content {
  max-width: 680px;
}

.hp .hp-catalog__title {
  margin-top: 16px;
  font-size: 36px;
}

.hp .hp-catalog__text {
  max-width: 460px;
  margin-top: 18px;
  font-size: 18px;
  line-height: 1.35;
}

.hp .hp-catalog .hp-icon-list {
  flex-wrap: nowrap;
  margin-top: 16px;
}

.hp .hp-catalog .hp-icon-list__item {
  padding-right: 22px;
}

.hp .hp-catalog .hp-icon-list__item + .hp-icon-list__item {
  padding-left: 22px;
}

.hp .hp-catalog-form__label {
  margin-top: 10px;
  color: var(--line);
  font-size: 15px;
}

.hp .hp-catalog-form__row {
  display: grid;
  grid-template-columns: 175px 182px 1fr;
  gap: 8px;
  margin-top: 6px;
}

.hp .hp-catalog-form__btn {
  gap: 14px;
}

.hp .hp-catalog-form .hp-consent {
  margin-top: 12px;
}

.hp .hp-catalog-form__note {
  margin-top: 10px;
  color: #b5b5b5;
  font-size: 15px;
}

/* ==========================================================================
   Блок 7 — Партнеры
   ========================================================================== */

.hp .hp-partners {
  padding: 30px 0 18px;
  background: var(--gray-bg) url("/images/home/partners-bg.jpg") center / cover no-repeat;
}

.hp .hp-partners__content {
  max-width: 720px;
}

.hp .hp-partners__title {
  margin-top: 12px;
  font-size: 36px;
}

.hp .hp-partners__lead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 24px;
  margin-top: 16px;
}

.hp .hp-partners__text {
  max-width: 440px;
  font-size: 18px;
  line-height: 1.35;
}

.hp .hp-partners__logos {
  display: grid;
  grid-template-columns: repeat(4, 113px);
  gap: 14px 16px;
  margin-top: 12px;
}

.hp .hp-partners__logos li {
  overflow: hidden;
  border-radius: 2px;
  background: var(--white);
}

.hp .hp-partners__logos img {
  width: 100%;
}

.hp .hp-partners .hp-icon-list {
  margin-top: 10px;
}

/* ==========================================================================
   Адаптив блоков 2–7 и подвала
   ========================================================================== */

@media (max-width: 1200px) {
  .hp .hp-production__inner {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .hp .hp-production__content {
    max-width: 640px;
    padding-top: 0;
  }
}

@media (max-width: 1100px) {
  .hp .hp-products__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hp .hp-order__inner {
    grid-template-columns: 1fr 360px;
  }

  .hp .hp-catalog__content {
    max-width: 56%;
  }

  .hp .hp-catalog .hp-icon-list {
    flex-wrap: wrap;
  }

  .hp .hp-catalog-form__row {
    grid-template-columns: 1fr 1fr;
  }

  .hp .hp-catalog-form__btn {
    grid-column: 1 / -1;
  }

  .hp .hp-partners__content {
    max-width: 58%;
  }

  .hp .hp-partners__logos {
    grid-template-columns: repeat(4, 1fr);
  }

}

/* На планшетах и телефонах фото из фона выносится отдельной полосой,
   а секция получает спокойный однотонный фон */
@media (max-width: 900px) {
  .hp .hp-section-media {
    display: block;
    background-repeat: no-repeat;
    background-size: cover;
  }

  .hp .hp-section-media--order {
    height: 220px;
    margin: 0 calc(var(--gutter) * -1);
    background-image: url("/images/home/order-bg.jpg");
    background-position: 48% center;
  }

  .hp .hp-section-media--quality {
    height: 260px;
    background-image: url("/images/home/quality-bg.jpg");
    background-position: left center;
  }

  .hp .hp-section-media--catalog {
    height: 280px;
    margin: 20px calc(var(--gutter) * -1) 0;
    background-image: url("/images/home/catalog-bg.jpg");
    background-position: 90% center;
  }

  .hp .hp-section-media--partners {
    height: 260px;
    margin: 20px calc(var(--gutter) * -1) 0;
    background-image: url("/images/home/partners-bg.jpg");
    background-position: 85% center;
  }

  .hp .hp-stages {
    grid-template-columns: repeat(3, 1fr);
    row-gap: 24px;
  }

  .hp .hp-order {
    display: block;
    min-height: 0;
    padding-bottom: 36px;
    background: linear-gradient(180deg, #2b2b2b 0%, #2d3a24 100%);
  }

  .hp .hp-order__inner {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .hp .hp-order__content {
    max-width: none;
  }

  .hp .hp-quality {
    display: block;
    min-height: 0;
    padding: 0 0 40px;
    background: linear-gradient(180deg, #2c2c2c 0%, #2e3a26 100%);
  }

  .hp .hp-quality__content {
    width: 100%;
    margin-top: 28px;
  }

  .hp .hp-catalog {
    display: block;
    min-height: 0;
    background: var(--gray-bg);
  }

  .hp .hp-catalog__content,
  .hp .hp-partners__content {
    max-width: none;
  }

  .hp .hp-catalog-form__row {
    grid-template-columns: 1fr 1fr 1.4fr;
  }

  .hp .hp-catalog-form__btn {
    grid-column: auto;
  }

  .hp .hp-partners {
    padding-bottom: 32px;
    background: var(--gray-bg);
  }

  .hp .hp-partners .hp-icon-list {
    margin-top: 20px;
  }
}

@media (max-width: 768px) {
  .hp .hp-section-title,
  .hp .hp-production__title,
  .hp .hp-order__title,
  .hp .hp-quality__title,
  .hp .hp-catalog__title,
  .hp .hp-partners__title {
    font-size: 28px;
  }

  .hp .hp-products {
    padding: 28px 0 32px;
  }

  .hp .hp-stage__title {
    font-size: 16px;
  }

  .hp .hp-order__text br {
    display: none;
  }

  .hp .hp-form-card {
    padding: 16px;
  }

  .hp .hp-quality__title br {
    display: none;
  }

  .hp .hp-quality__list {
    font-size: 16px;
  }

  .hp .hp-quality__cards {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .hp .hp-info-card {
    min-height: 0;
  }

  .hp .hp-catalog-form__row {
    grid-template-columns: 1fr;
  }

  .hp .hp-catalog__text,
  .hp .hp-partners__text {
    font-size: 16px;
  }

  .hp .hp-icon-list {
    flex-direction: column;
    align-items: flex-start;
  }

  .hp .hp-icon-list__item,
  .hp .hp-icon-list__item + .hp-icon-list__item,
  .hp .hp-catalog .hp-icon-list__item,
  .hp .hp-catalog .hp-icon-list__item + .hp-icon-list__item {
    padding: 0;
    border: 0;
  }

  .hp .hp-icon-list__item br {
    display: none;
  }

}

@media (max-width: 600px) {
  .hp .hp-products__grid {
    grid-template-columns: 1fr;
  }

  .hp .hp-stages {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px 16px;
  }
}

@media (max-width: 480px) {
  .hp .hp-section-title,
  .hp .hp-production__title,
  .hp .hp-order__title,
  .hp .hp-quality__title,
  .hp .hp-catalog__title,
  .hp .hp-partners__title {
    font-size: 24px;
  }

  .hp .hp-product-card__body,
  .hp .hp-product-card--narrow .hp-product-card__body {
    max-width: 50%;
    padding: 12px 0 0 14px;
  }

  .hp .hp-product-card__title {
    font-size: 18px;
  }

  .hp .hp-product-card__text {
    font-size: 12.5px;
  }

  .hp .hp-form-card__row {
    grid-template-columns: 1fr;
  }

  .hp .hp-partners__logos {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   Проверка форм и сообщения
   ========================================================================== */

.hp .hp-field.is-invalid .hp-field__input {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.15);
}

.hp .hp-field__error {
  display: block;
  margin-top: 4px;
  color: var(--error);
  font-size: 12px;
  line-height: 1.3;
}

.hp .hp-consent.is-invalid input {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.2);
}

.hp .hp-consent.is-invalid span {
  color: var(--error);
}

.hp .hp-consent-error {
  margin-top: 4px;
  color: var(--error);
  font-size: 12px;
}

.hp .hp-field__files {
  margin-top: -4px;
  color: #555;
  font-size: 12px;
  word-break: break-word;
}

.hp .hp-form-status {
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.35;
}

.hp .hp-form-status--success {
  background: rgba(153, 196, 90, 0.2);
  color: #3d5f17;
}

.hp .hp-form-status--error {
  background: rgba(229, 57, 53, 0.1);
  color: #b71c1c;
}

.hp .hp-catalog-form .hp-form-status {
  max-width: 560px;
  margin-top: 10px;
}

/* Доступ к каталогам открыт */
.hp .hp-catalog-access {
  margin-top: 16px;
}

.hp .hp-catalog-access[hidden] {
  display: none;
}

.hp .hp-catalog-access__title {
  font-size: 20px;
  font-weight: 700;
}

.hp .hp-catalog-access__btn {
  margin-top: 12px;
  gap: 12px;
  text-align: left;
}

@media (max-width: 768px) {
  .hp .hp-catalog-access__btn {
    width: 100%;
    font-size: 16px;
  }
}

/* ==========================================================================
   Дополнения для сайта (нет в вёрстке)
   ========================================================================== */

/* скрытое поле-ловушка для ботов в формах */
.hp .hp-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* «Все партнеры» — кнопка, раскрывающая логотипы сверх восьми */
.hp button.hp-more-link {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.hp .hp-partners__logos li[hidden] {
  display: none;
}

/* переход по якорям (#custom-order, #catalog, #products) — с отступом под фиксированную шапку сайта */
.hp section[id] {
  scroll-margin-top: 90px;
}
