/* Точечная доработка текущей структуры без добавления новых блоков */

:root {
  --font-display: 'Manrope', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
  scroll-padding-top: var(--header-h);
}

body {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3,
.logo,
.hero-title,
.work-address,
.card-title {
  font-family: var(--font-display);
}

/* Hero: тот же фон и тот же контент, но более собранная композиция */
.hero {
  min-height: 100svh;
  padding: calc(var(--header-h) + 3rem) 1rem 4rem;
}

.hero-content {
  width: min(100%, 960px);
  max-width: 960px;
  padding: 0 clamp(1rem, 4vw, 3rem);
}

.hero-title {
  max-width: 850px;
  margin: 0 auto 1.75rem;
  font-size: clamp(2rem, 4vw, 3.6rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.hero-quote {
  max-width: 560px;
  margin: 0 auto 2.25rem;
  font-family: var(--font-sans);
  font-size: clamp(1rem, 1.7vw, 1.2rem);
  line-height: 1.55;
}

.hero-quote cite {
  font-family: var(--font-sans);
  font-size: 0.85em;
}

.btn-primary {
  min-height: 44px;
  padding: 12px 28px;
  touch-action: manipulation;
}

/* Слайдеры работ: сохраняем текущую разметку, усиливаем сам медиа-блок */
.slider {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.slider-track,
.slide,
.slide img {
  max-width: 100%;
}

.slide img {
  object-fit: cover;
}

.slider-btn,
.dot {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Карточки и контакты не выходят за ширину контейнера */
.cards,
.contacts-grid {
  width: 100%;
  min-width: 0;
}

.card,
.contact-item {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.contact-content {
  min-width: 0;
}

/* Телефоны: 320–767px */
@media (max-width: 767px) {
  html { font-size: 16px; }

  .container {
    width: 100%;
    max-width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .section {
    padding-top: 40px;
    padding-bottom: 40px;
  }

  .hero {
    min-height: 100svh;
    padding: calc(var(--header-h) + 2rem) 0 3rem;
  }

  .hero-content {
    width: 100%;
    max-width: 100%;
    padding: 0 1rem;
  }

  .hero-title {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
  }

  .hero-quote {
    max-width: 100%;
    font-size: 1rem;
    line-height: 1.6;
  }

  .cards,
  .contacts-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .card,
  .contact-item {
    width: 100%;
    min-height: auto;
    padding: 1.5rem;
  }

  .card-icon,
  .contact-icon {
    width: 48px;
    height: 48px;
  }

  .card-text,
  .contact-value,
  .work-desc,
  .about-text p {
    font-size: 1rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
  }

  .contact-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .contact-content {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .burger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 10px;
  }

  .main-nav {
    width: min(100vw, 360px);
    max-width: 100%;
    padding: calc(var(--header-h) + 1rem) 1rem 2rem;
    overflow-y: auto;
  }

  .main-nav a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 12px 16px;
    font-size: 1rem;
  }

  .slider {
    aspect-ratio: 4 / 3;
    touch-action: pan-y;
  }

  .slider-btn {
    width: 44px;
    height: 44px;
  }

  .dot {
    position: relative;
    width: 44px;
    height: 44px;
    background: transparent;
  }

  .dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(255,255,255,0.55);
  }

  .dot.active::after {
    background: #fff;
    transform: translate(-50%, -50%) scale(1.25);
  }

  /* Завершённые проекты: мобильная композиция (не масштабированный десктоп).
     Слайдер становится героем: изображение на всю ширину, текст поверх */
  .work-item {
    position: relative;
    margin-bottom: 3rem;
  }

  .work-body {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-top: 0;
    gap: 0;
  }

  .work-info { display: contents; }

  /* Слайдер — первым, от края до края экрана */
  .work-media {
    order: -2;
    margin-left: -1rem;
    margin-right: -1rem;
  }

  .work-media .slider {
    border-radius: 0;
    box-shadow: none;
  }

  /* Текст проекта поверх изображения-героя; бокс повторяет геометрию
     слайдера (та же ширина с отрицательными отступами и тот же aspect-ratio) */
  .work-hero {
    position: absolute;
    top: 0;
    left: -1rem;
    right: -1rem;
    aspect-ratio: 4 / 3;
    z-index: 5;
    pointer-events: none;
  }

  .work-hero-overlay {
    display: block;
    position: absolute;
    inset: 0;
    background: linear-gradient(
      to bottom,
      rgba(26, 26, 31, 0.55) 0%,
      rgba(26, 26, 31, 0.45) 40%,
      rgba(26, 26, 31, 0.88) 100%
    );
  }

  .work-hero-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 1.25rem 1rem;
  }

  .work-hero-content .work-title {
    color: #fff;
    font-size: 1.35rem;
    text-shadow: 0 2px 12px rgba(0,0,0,0.45);
  }

  .work-hero-address {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.85);
  }

  /* «Результат» — белая карточка сразу под героем */
  .work-result {
    order: -1;
    margin-top: 1rem;
  }

  /* Адресный блок под карточкой результата */
  .work-address-block { margin-top: 1.5rem; }

  .work-desc {
    margin-bottom: 0;
  }
}

/* Маленькие телефоны: 320–479px */
@media (max-width: 479px) {
  .container { padding-left: 0.875rem; padding-right: 0.875rem; }
  .logo { font-size: 1.1rem; }
  .slider { aspect-ratio: 1 / 1; }

  /* Герой следует за слайдером: те же отступы (поля контейнера уже 0.875rem)
     и тот же aspect-ratio */
  .work-media {
    margin-left: -0.875rem;
    margin-right: -0.875rem;
  }

  .work-hero {
    left: -0.875rem;
    right: -0.875rem;
    aspect-ratio: 1 / 1;
  }

  .work-hero-content {
    padding: 1rem 0.875rem;
  }

  .work-hero-content .work-title {
    font-size: 1.2rem;
  }
}

/* Планшеты: 768–1023px */
@media (min-width: 768px) and (max-width: 1023px) {
  .cards,
  .contacts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Большие экраны: не растягиваем текст бесконтрольно */
@media (min-width: 1440px) {
  .hero-content { max-width: 1080px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
