﻿/* Сетка и адаптив */

/* Базовые секции */
.section {
  max-width: 100%;
  overflow: hidden;
  padding-top: 5rem;
  padding-bottom: 5rem;
}

.section--cta,
.section--alt,
.hero {
  width: 100%;
}

.section--cta .container,
.section--alt .container,
.hero .container {
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
}

/* Сетки */

/* Сетка типов домов */
.house-types__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* Сетка услуг */
.services__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

/* Сетка проектов */
.projects__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.projects__scroll-hint {
  display: none;
}

/* Сетка отзывов */
.reviews__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* Сетка доверия */
.trust-badges__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* Адаптив до 1399 */
@media (max-width: 1399.98px) {
  :root {
    --container-max: 1140px;
  }

  .services__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Адаптив до 1199 */
@media (max-width: 1199.98px) {
  :root {
    --container-max: 960px;
    --container-padding: 1.5rem;
  }

  .hero__title {
    font-size: 2.5rem;
  }

  .card-project-img {
    height: auto;
    min-height: 180px;
    aspect-ratio: 16 / 10;
  }

  .projects__grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .trust-badges__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Адаптив до 991 */
@media (max-width: 991.98px) {
  :root {
    --container-max: 720px;
    --container-padding: 1.25rem;
  }

  body {
    padding-top: 80px;
  }

  main {
    padding-top: 80px;
  }

  .header-logo img {
    width: 60px;
    height: 60px;
  }

  .navbar-collapse {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius);
    margin-top: 1rem;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
  }

  .header-contacts {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center !important;
  }

  .hero-form {
    margin-top: 2rem;
  }

  .section__title {
    text-align: center;
    font-size: 1.75rem;
  }

  .hero__title {
    font-size: 2rem;
  }

  .hero__subtitle {
    font-size: 1rem;
  }

  .stat-card {
    padding: 1.25rem 1rem;
  }

  .stat-card__value {
    font-size: 1.5rem;
  }

  .type-card__img {
    height: 100px;
  }

  .card-project-img {
    height: auto;
    min-height: 190px;
    aspect-ratio: 16 / 10;
  }

  .card-type-img {
    height: auto;
    min-height: 200px;
    aspect-ratio: 16 / 10;
  }

  .step-card__number {
    font-size: 2rem;
  }

  .adv-card__icon {
    font-size: 2rem;
  }

  .service-card__icon {
    font-size: 2rem;
  }

  .projects-filter {
    justify-content: center;
  }

  .project-detail__gallery {
    height: 300px;
  }

  /* Сетки */
  .house-types__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

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

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

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

/* Адаптив до 767 */
@media (max-width: 767.98px) {
  :root {
    --container-max: 540px;
    --container-padding: 1rem;
  }

  body {
    padding-top: 70px;
  }

  main {
    padding-top: 70px;
  }

  html {
    font-size: 15px;
  }

  .header-logo img {
    width: 50px;
    height: 50px;
  }

  .hero__title {
    font-size: 1.75rem;
  }

  .hero__badge {
    font-size: 0.75rem;
    padding: 0.3rem 0.75rem;
  }

  .hero-form {
    margin-top: 1.5rem;
  }

  .hero-form .card-body {
    padding: 1.25rem;
  }

  .section {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }

  .section__title {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
  }

  .section__header {
    margin-bottom: 2rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-card__value {
    font-size: 1.35rem;
  }

  .stat-card__label {
    font-size: 0.75rem;
  }

  .stat-card__icon {
    font-size: 1.5rem;
  }

  .type-card__img {
    height: 80px;
  }

  .type-card__body,
  .card-project-content {
    padding: 1rem;
  }

  .type-card__title,
  .card-project-title {
    font-size: 1rem;
  }

  .type-card__price,
  .card-project-price {
    font-size: 1.1rem;
  }

  .service-card {
    padding: 1.25rem;
  }

  .service-card__title {
    font-size: 1rem;
  }

  .service-card__desc {
    font-size: 0.9rem;
  }

  .step-card {
    padding: 1.25rem;
  }

  .step-card__number {
    font-size: 1.75rem;
    top: 0.75rem;
    right: 0.75rem;
  }

  .step-card__title {
    font-size: 0.95rem;
  }

  .adv-card {
    padding: 1.25rem;
  }

  .adv-card__icon {
    font-size: 1.75rem;
  }

  .portfolio-card {
    min-height: 140px;
  }

  .card-review {
    padding: 1.25rem;
  }

  .card-review-rating {
    font-size: 1rem;
  }

  .contact-list__item {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .contact-list__icon {
    font-size: 1.25rem;
  }

  .footer {
    padding: 2rem 0 !important;
  }

  .footer-logo {
    font-size: 1.1rem;
  }

  .trust-badges__grid {
    grid-template-columns: 1fr;
  }

  .projects-page__hero {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }

  .projects-filter .btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
  }

  .project-detail__title {
    font-size: 1.5rem;
  }

  .project-detail__gallery {
    height: 250px;
  }

  .project-detail__specs {
    padding: 1.25rem;
  }

  /* Сетки */
  .house-types__grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .services__grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .projects__grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .reviews__grid {
    grid-template-columns: 1fr;
  }

  .trust-badges__grid {
    grid-template-columns: 1fr;
  }

  /* Кнопки карусели */
  .reviews-carousel__track {
    padding: 0 40px;
  }

  .reviews-carousel__btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
}

/* Адаптив до 575 */
@media (max-width: 575.98px) {
  :root {
    --container-padding: 0.875rem;
  }

  body {
    padding-top: 65px;
  }

  html {
    font-size: 14px;
  }

  .header-logo img {
    width: 45px;
    height: 45px;
  }

  .hero__title {
    font-size: 1.5rem;
  }

  .hero__subtitle {
    font-size: 0.9rem;
  }

  .hero__list li {
    font-size: 0.9rem;
    padding-left: 1.25rem;
  }

  .btn-lg {
    font-size: 0.95rem;
    padding: 0.6rem 1rem;
  }

  .form-control-lg {
    font-size: 0.95rem;
    padding: 0.6rem 0.875rem;
  }

  .stat-card__value {
    font-size: 1.25rem;
  }

  .type-card__img {
    height: 70px;
  }

  .card-project-img {
    min-height: 175px;
  }

  .card-type-img {
    min-height: 185px;
  }

  .portfolio-card {
    min-height: 120px;
  }

  .card-portfolio-title {
    font-size: 0.95rem;
  }

  .card-portfolio-type {
    font-size: 0.75rem;
  }

  .project-detail__gallery {
    height: 200px;
  }

  .project-detail__price {
    font-size: 1.5rem;
  }

  .contact-floating {
    right: 16px;
    bottom: 18px;
  }

  .contact-floating-main {
    width: 50px;
    height: 50px;
  }

  .contact-floating-main svg {
    width: 24px;
    height: 24px;
  }

  .contact-floating-popup {
    min-width: 0;
  }

  .card-project-img,
  .card-type-img {
    background-position: center center !important;
  }
}

/* Адаптив до 399 */
@media (max-width: 399.98px) {
  :root {
    --container-padding: 0.75rem;
  }

  html {
    font-size: 13px;
  }

  .hero__title {
    font-size: 1.35rem;
  }

  .stat-card__value {
    font-size: 1.15rem;
  }

  .stat-card__label {
    font-size: 0.7rem;
  }

  .card-project-img {
    min-height: 160px;
  }

  .card-type-img {
    min-height: 165px;
  }

  .portfolio-card {
    min-height: 100px;
  }
}

/* Страница проектов */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

@media (max-width: 767.98px) {
  .projects-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
  }
}

@media (max-width: 399.98px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

/* Отступы страниц */
body.page-home,
body.page-projects,
body.page-project-detail,
body.page-portfolio,
body.page-privacy,
body.page-error,
body.page-dashboard {
  padding-top: 0 !important;
}

body.page-home main {
  padding-top: 0 !important;
}

body.page-home .hero {
  margin-top: 0 !important;
  padding-top: calc(var(--header-height) + 1.25rem) !important;
  padding-bottom: clamp(1rem, 3vh, 2rem) !important;
}

body.page-home .hero .row {
  min-height: calc(100svh - var(--header-height) - 1.5rem);
}

html.dynamic-viewport body.page-home .hero .row {
  min-height: calc((var(--app-vh, 1svh) * 100) - var(--header-height) - 1.5rem);
}

body.page-projects main,
body.page-project-detail main,
body.page-portfolio main,
body.page-privacy main,
body.page-error main,
body.page-dashboard main {
  padding-top: calc(var(--header-height) + 1rem) !important;
}

body.page-project-detail .project-detail {
  padding-top: 1rem;
}

body.page-privacy main .container {
  background: rgba(248, 251, 255, 0.92);
  border: 1px solid rgba(206, 219, 236, 0.95);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: clamp(1rem, 3vw, 2rem);
}

@media (max-width: 991.98px) {
  :root {
    --header-height: 78px;
  }

  body.page-home main {
    padding-top: 0 !important;
  }

  body.page-home .hero {
    padding-top: calc(var(--header-height) + 1rem) !important;
    padding-bottom: 1rem !important;
  }

  body.page-home .hero .row {
    min-height: auto;
    padding-top: 0.35rem;
    padding-bottom: 0.9rem;
  }

  body.page-projects main,
  body.page-project-detail main,
  body.page-portfolio main,
  body.page-privacy main,
  body.page-error main,
  body.page-dashboard main {
    padding-top: calc(var(--header-height) + 0.75rem) !important;
  }
}

@media (max-width: 767.98px) {
  :root {
    --header-height: 72px;
  }

  body.page-home .hero {
    padding-top: calc(var(--header-height) + 0.85rem) !important;
  }

  body.page-home .hero .row {
    margin-left: 0;
    margin-right: 0;
  }

  .section {
    padding-top: 4rem !important;
    padding-bottom: 4rem !important;
  }

  .projects-page__hero {
    padding-top: 1rem !important;
  }

  .project-detail__gallery {
    height: 260px;
  }
}

@media (max-width: 575.98px) {
  :root {
    --header-height: 68px;
  }

  body.page-home .hero {
    padding-top: calc(var(--header-height) + 0.75rem) !important;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 840px) {
  body.page-home .hero {
    overflow: visible;
    padding-top: calc(var(--header-height) + 0.75rem) !important;
    padding-bottom: 0.75rem !important;
  }

  body.page-home .hero .row {
    min-height: auto;
    align-items: flex-start !important;
  }

  body.page-home .hero-title,
  body.page-home .hero__title {
    font-size: clamp(1.8rem, 4.2vw, 3.05rem);
    margin-bottom: 0.55rem;
  }

  body.page-home .hero-subtitle,
  body.page-home .hero__subtitle {
    margin-bottom: 0.85rem;
    line-height: 1.45;
  }

  body.page-home .hero-list,
  body.page-home .hero__list {
    gap: 0.45rem;
  }

  body.page-home .hero-form .card-body {
    padding: clamp(0.95rem, 2.2vw, 1.3rem);
  }

  body.page-home .hero-form .form-control {
    min-height: 42px;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
  }

  body.page-home .hero-form .btn-primary {
    min-height: 44px;
    padding-top: 0.72rem;
    padding-bottom: 0.72rem;
    font-size: 0.95rem;
  }
}

/* Мобильный навбар */
@media (max-width: 991.98px) {
  .header {
    overflow: visible;
  }

  .header .navbar .container {
    position: relative;
  }

  .header .navbar-collapse {
    position: absolute;
    top: calc(100% + 0.55rem);
    left: 0;
    right: 0;
    z-index: 1055;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 249, 255, 0.96));
    border: 1px solid rgba(0, 73, 183, 0.18) !important;
    border-radius: 1.2rem;
    margin-top: 0;
    padding: 0.75rem;
    box-shadow: 0 18px 34px rgba(9, 28, 60, 0.14);
  }

  .header .header-menu {
    gap: 0.35rem;
    padding: 0.2rem;
  }

  .header .header-menu .nav-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0.62rem 0.9rem;
    border-radius: 0.82rem;
    font-weight: 600;
    color: #1f2937;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid transparent;
  }

  .header .header-menu .nav-link::after {
    display: none;
  }

  .header .header-menu .nav-link:hover,
  .header .header-menu .nav-link.active {
    color: var(--color-primary-dark);
    background: rgba(0, 73, 183, 0.11);
    border-color: rgba(0, 73, 183, 0.22);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.48);
  }

  .header .header-contacts {
    margin-top: 0.75rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(216, 225, 239, 0.9);
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }

  .header .header-phone {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 42px;
    border-radius: 0.82rem;
    border: 1px solid rgba(0, 73, 183, 0.16);
    background: rgba(255, 255, 255, 0.84);
  }

  .header .header-contacts .btn {
    width: 100%;
    border-radius: 0.82rem;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 767.98px) {
  .header .navbar-collapse {
    border-radius: 1rem;
    padding: 0.65rem;
  }

  .header .header-menu .nav-link {
    min-height: 42px;
    padding: 0.58rem 0.82rem;
    font-size: 0.95rem;
  }
}
