:root {
  --primary-color: #000000;  /*основной цвет фона*/
  --secondary-color1: #000000; /*дополнительный цвет фона. Секция Услуги*/
  --secondary-color2: #000000; /*еще один доп. цвет фона. Секции Шапка, Отзывы, Контактная форма*/
  --primary-font-color: #FFFFFF; /*Основной цвет шрифта.*/
  --icons-color: #505050; /*Цвет иконок.*/
  --button-color: #008000; /*Цвет кнопок*/
  --color-button-hover: #FFFFFF; /*Цвет кнопок при наведении.*/
}

body {
  font-family: 'fantasy', sans-serif; /* основной текст */
  font-weight: 400;
  color: var(--primary-font-color);
  line-height: 1.6;
  background-color: var(--primary-color);
}

header {
  position: relative;
  background-color: var(--secondary-color2);
  /*раскоментируй код ниже, 
    если нужно вставить картинку в шапке и замени на свою.*/

    /*background-image: url('../img/hero.jpg');
    background-size: cover;
    background-position: center;*/
}

.header-container {
  margin: 0 auto;
  max-width: 1200px;
  text-align: center;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  /* навигация сверху, блок с h1,p,button снизу */
  min-height: 600px;
  position: relative;
}

.header-bottom {
  text-align: center;
  margin-bottom: 40px;
  /* отступ снизу */
}

.header-container p {
  font-size: 20px;
  margin: 0;
  margin-bottom: 40px;
}

a {
  text-decoration: none;
  color: var(--primary-font-color);
  transition: color 0.3s ease;
  /* Плавный переход цвета */
}

.nav a:hover {
  color: var(--button-color);
}

h1 {
  font-size: clamp(28px, 6vw, 50px);
  /* от 28 до 50, плавно */
  line-height: 1.15;
  letter-spacing: -0.01em;
  word-break: normal;
  overflow-wrap: anywhere;
  /* не вылезет за экран */
  hyphens: auto;
  /* переносы по слогам */
  text-wrap: balance;
  text-align: center;
  text-transform: uppercase;
  margin: 0;
  margin-top: 40px;
}

h2 {
  text-align: center;
  margin-bottom: 40px;
  font-size: 28px;
}

h1, h2, h3 {
  font-family: 'Poppins', sans-serif;   /* заголовки */
  font-weight: 700;
}

.btn {
  background-color: var(--button-color);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin: 15px;
}

.btn:hover {
  background-color: var(--color-button-hover);
}



.hamburger {
  display: none;
  font-size: 28px;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}

.hamburger span {
  width: 25px;
  height: 3px;
  background: var(--primary-font-color);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.nav {
  display: flex;
  justify-content: flex-end;
  padding: 0;
  gap: 20px;
  text-transform: uppercase;
}

section {
  margin: 0 auto;
  max-width: 1200px;
  padding: 40px;
}

.about-container {
  display: grid;
  grid-auto-flow: column;
  grid-template-columns: 1.2fr 1fr;
  align-items: center;
  margin: 20px;
  gap: 50px;
}

.about-container img {
  width: 100%;
  height: auto;
  display: block;
}

.about-container p {
  margin: 0;
}

.about-h2 {
  display: none;
}

.services {
  background-color: var(--secondary-color1);
  max-width: none;
}

.services-container {
  display: flex;
  gap: 50px;
  align-items:center;
  max-width: 1200px;
  margin: 0 auto;
}

.services-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  flex: 1;
}

.service-item {
  padding: 15px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s;
}

.service-item.active {
  background: var(--primary-color);
  /* фон для активного блока */
}

.services-image {
  flex: 1;
}

.services-image img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  max-width: 100%;
  object-fit: cover;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 1200px;
  margin: 20px;
}

.gallery img {
  width: 100%;
  height: auto;
  border-radius: 5px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#testimonials {
  padding: 50px 20px;
  background: var(--secondary-color2);
  text-align: center;
}

.testimonials-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  max-width: 100%;
  margin: auto;
  box-sizing: border-box;
}

.testimonial {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;        /* не шире экрана */
  box-sizing: border-box;
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  max-width: 100%;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
  .testimonials-container {
    grid-template-columns: 1fr;
  }
}

/* Контакты */
.contacts { max-width: 800px; }

.contact-form {
  max-width: 560px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
  background: var(--secondary-color2);
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
}

.contact-form .form-row { display: grid; gap: 8px; }
.contact-form .form-row.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.contact-form label { font-weight: 600; }
.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--secondary-color2);
  border-radius: 8px;
  background: #fff;
  color: var(--primary-font-color);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--button-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--button-color) 20%, transparent);
}

.form-hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: #666;
}

.form-status {
  min-height: 18px;
  font-size: 14px;
  margin-top: 4px;
}

/* Состояния статуса */
.form-status.success { color: var(--button-color); }   /* зелёный */
.form-status.error   { color: #b42318; }   /* красный */

/* Кнопка как ссылка <a> и как <button> */
.btn {
  display: inline-block;
  background-color: var(--button-color);
  color: #fff;
  padding: 10px 20px;
  border: none; border-radius: 8px;
  cursor: pointer;
  text-align: center;
}
.btn:hover { background-color: var(--color-button-hover); color: #fff; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* Адаптация на мобилке */
@media (max-width: 768px) {
  .contact-form { padding: 20px 16px; gap: 12px; }
  .contact-form .form-row.two { grid-template-columns: 1fr; }
}

.contacts-intro {
  text-align: center;
  font-size: 16px;
  margin: -20px auto 20px; /* чуть сдвинем ближе к заголовку */
  max-width: 600px;
}

.contacts-info {
  text-align: center;
  margin-bottom: 20px;
}

.contacts-info p {
  margin: 4px 0;
  font-size: 16px;
}

.contacts-icons {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 8px;
}


.contacts-icons a {
    width: 65px;
    height: 65px;
    background-color: var(--secondary-icons-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 20px;
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.3s ease;
    vertical-align: middle;
}

.contacts-icons a:hover {
    color: var(--icons-color);
    transform: scale(1.2);
}

/* Мобильная адаптация */
@media (max-width: 768px) {
  .contacts-intro { font-size: 14px; margin-bottom: 16px; }
  .contacts-info p { font-size: 14px; }
}

footer {
  text-align: center;
}

.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--secondary-color2);
  color: var(--primary-font-color);
  padding: 12px;
  border-radius: 50%;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
  opacity: 0;
  visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top:hover {
  transform: translateY(-3px);
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
}

.back-to-top svg {
  width: 20px;
  height: 20px;
}

/* Планшет и ниже: 3 колонки */
@media (max-width: 1024px) {
  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }
  .about-container-h2{
    display: none;
  }

  .about-h2{
    display: flex;
    justify-content: center;
  }
}

/* Мобилка */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1001;
    font-size: 28px;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
  }

  .hamburger span {
    width: 25px;
    height: 3px;
    background: var(--primary-font-color);
    border-radius: 2px;
    transition: .3s;
  }

  /* скрываем nav по умолчанию */
  .nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 56px;
    right: 16px;
    background: var(--secondary-color2);
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, .1);
    z-index: 1000;
    animation: fadeIn .3s ease forwards;
  }

  .nav.show {
    display: flex;
    gap: 12px;
    align-items: flex-start;
  }

  .about-container-h2{
    display: none;
  }

  .about-h2{
    display: flex;
    justify-content: center;
  }

  h1 {
    font-size: clamp(22px, 8vw, 34px);
    line-height: 1.2;
    text-transform: none;
    /* не растягиваем строку */
    margin-top: 16px;
    margin-bottom: 12px;
  }

  .header-container {
    padding: 24px 16px;
    /* меньше поля у героя */
    min-height: auto;
    /* не заставляем 600px высоты */
  }

  .header-bottom p {
    font-size: 16px;
    /* подзаголовок компактней */
    margin-bottom: 20px;
  }

  .btn {
    padding: 10px 16px;
  }

  .about-container {
    display: flex;
    /* Вместо grid */
    flex-direction: column;
    /* Ставим в колонку */
    gap: 20px;
    text-align: center;
    /* Чтобы текст красиво смотрелся */
  }

  .about-container img {
    max-width: 100%;
    height: auto;
  }

  .services {
    padding: 24px 16px;
  }

  /* Становимся в колонку, список сверху, картинка снизу */
  .services-container {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .services-list {
    order: 1;
    gap: 12px;
  }

  .service-item {
    padding: 14px 16px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    background: var(--primary-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    -webkit-tap-highlight-color: transparent;
    /* приятнее на тачах */
  }

  .service-item h3 {
    font-size: 18px;
    margin: 0 0 6px;
  }

  .service-item p {
    font-size: 14px;
    margin: 0;
  }

  .service-item.active {
    outline: 2px solid var(--button-color);
    background: #fff;
  }

  .services-image {
    order: 2;
  }

  /* Фиксированное соотношение сторон, чтобы превью не «скакало» */
  .services-image img {
    width: 100%;
    height: auto;
    max-height: min(55vh, 420px);/* не выше половины экрана (или 420px) */
    object-fit: contain;
    border-radius: 12px;
    display: block;
  }

  .works {
    padding: 24px 16px;
  }

  .gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .gallery img {
    border-radius: 12px;
  }
}

/* Очень узкие экраны: 1 колонка */
@media (max-width: 360px) {
  .gallery {
    grid-template-columns: 1fr;
  }
  .about-container-h2{
    display: none;
  }
  .about-h2{
    display: flex;
    justify-content: center;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Глобально — корректная модель коробки */
html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }

/* Пара Телефон / E-mail — ровные колонки */
.contact-form .form-row.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ВАЖНО: не даём колонкам и инпутам расползаться шире грида */
.contact-form .form-row.two > div { min-width: 0; }
.contact-form input,
.contact-form textarea { min-width: 0; width: 100%; }

/* На мобилке — одна колонка */
@media (max-width: 768px) {
  .contact-form .form-row.two { grid-template-columns: 1fr; }
}