:root {
  --color-primary: #2D5A3D;
  --color-secondary: #1E40AF;
  --color-accent: #F97316;
  --color-bg: #FEFCE8;
}

/* Тень для текста на hero-фоне */
.hero-text-shadow {
  text-shadow: 
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000,
    0 2px 4px rgba(0,0,0,0.5);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
}

.service-card,
.faq-item,
.btn {
  will-change: transform;
}

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  z-index: 60;
  background: rgba(0, 0, 0, 0.06);
}

.reading-progress__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-secondary));
  transition: width 0.1s linear;
}

.btn {
  min-height: 44px;
  min-width: 44px;
  transition: all 0.2s ease;
}

.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.faq-item[open] {
  border-color: var(--color-primary);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 640px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  h1 {
    font-size: 1.75rem;
    line-height: 1.3;
  }
}

/* Скрыть скроллбар в карусели */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Карусель — статичные стрелки (мобильная версия) */
.carousel-arrow-static {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  background: rgba(255,255,255,0.95);
  color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  border: 1px solid rgba(0,0,0,0.06);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  transition: opacity 0.2s ease, transform 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.carousel-arrow-static:active {
  transform: scale(0.92);
}

/* Карусель — стрелки (только десктоп) */
.carousel-arrow {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  background: rgba(255,255,255,0.95);
  color: var(--color-primary);
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  border: 1px solid rgba(0,0,0,0.06);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.carousel-arrow:hover {
  background: var(--color-primary);
  color: #fff;
  transform: scale(1.08);
}
@media (min-width: 768px) {
  .carousel-arrow {
    display: flex;
  }
}

/* Карусель — точки-индикаторы */
.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 9999px;
  background: #d1d5db;
  border: none;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.carousel-dot:hover {
  background: #9ca3af;
  transform: scale(1.25);
}
.carousel-dot.active {
  width: 28px;
  background: var(--color-primary);
}
.carousel-dot.active:hover {
  background: var(--color-primary);
  transform: scale(1.1);
}
@media (min-width: 768px) {
  .carousel-dot {
    width: 14px;
    height: 14px;
  }
  .carousel-dot.active {
    width: 48px;
  }
}

/* Стили для карточек портфолио */
.portfolio-item {
  background: white;
  border-radius: 1rem;
  padding: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  height: 100%;
}
@media (min-width: 768px) {
  .portfolio-item {
    padding: 0.75rem;
  }
}

.portfolio-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.portfolio-item img {
  border-radius: 0.5rem;
}

/* Стили для прогрессивной загрузки изображений */
picture {
  display: block;
  width: 100%;
}

picture img {
  width: 100%;
  height: auto;
}

/* Плейсхолдер для изображений при загрузке */
img[loading="lazy"] {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Убираем анимацию после загрузки */
img[data-loaded="true"],
img[loading="lazy"]:not([src]) {
  animation: none;
  background: none;
}

/* Оптимизация для изображений с заданными размерами */
img[src*="/webp/"],
img[src*=".webp"],
img[src*=".avif"] {
  transition: opacity 0.3s ease;
}

/* Улучшенная производительность для above-the-fold изображений */
#hero-bg-image {
  will-change: transform;
  backface-visibility: hidden;
}

/* Утилита для скрытого заголовка (fallback если Tailwind CDN не подгрузился) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ─── Человечные улучшения ─── */

/* Акцентная типографика для заголовков */
.font-display {
  font-family: "Montserrat", sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Плавное появление элементов при скролле */
.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Акцентная линия под заголовками */
.section-title-accent {
  position: relative;
  display: inline-block;
}

.section-title-accent::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -0.5rem;
  width: 3rem;
  height: 0.25rem;
  border-radius: 9999px;
  background: var(--color-accent);
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.section-title-accent.revealed::after {
  transform: translateX(-50%) scaleX(1);
}

/* Лёгкое "плавание" для иконок преимуществ */
@keyframes gentle-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.float-icon {
  animation: gentle-float 4s ease-in-out infinite;
}

/* Пульсация для CTA-кнопок */
@keyframes soft-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.35); }
  50% { box-shadow: 0 0 0 12px rgba(249, 115, 22, 0); }
}

.pulse-cta {
  animation: soft-pulse 2.5s ease-in-out infinite;
}

/* Плавные ссылки в навигации */
nav a {
  position: relative;
  transition: color 0.25s ease;
}

nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background: var(--color-primary);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Карточки услуг — улучшенные тени */
.service-card {
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.service-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Портфолио — улучшенные hover-эффекты */
.portfolio-item {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.06);
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.portfolio-item:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.1);
}

.portfolio-item img {
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.portfolio-item:hover img {
  transform: scale(1.04);
}

/* picture — скрытие переполнения для масштабирования */
picture {
  overflow: hidden;
  border-radius: 0.5rem;
}

/* Улучшенный prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Skip-link для доступности */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #2D5A3D;
  color: #fff;
  padding: 8px 16px;
  z-index: 100;
  transition: top 0.3s;
  text-decoration: none;
  border-radius: 0 0 8px 0;
  font-size: 14px;
}
.skip-link:focus-visible {
  top: 0;
}

/* Глобальные стили фокуса */
:focus-visible {
  outline: 2px solid #F97316;
  outline-offset: 2px;
}

/* Кнопка «Наверх» */
.back-to-top {
  position: fixed;
  right: 16px;
  bottom: 88px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #2D5A3D;
  color: #fff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
  z-index: 40;
  border: none;
  cursor: pointer;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Кнопка копирования телефона */
.copy-phone-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  margin-left: 4px;
  transition: transform 0.15s ease;
}
.copy-phone-btn:active {
  transform: scale(0.9);
}

/* Skeleton-загрузка */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 0.5rem;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  height: 320px;
  width: 100%;
}

.skeleton-review {
  height: 200px;
  width: 100%;
}

/* Ошибка загрузки */
.load-error {
  text-align: center;
  padding: 2rem;
  color: #6b7280;
}

.load-error__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
}

.load-error__retry {
  color: #2D5A3D;
  text-decoration: underline;
  cursor: pointer;
}

.load-error__retry:hover {
  color: #1e402d;
}

/* Скрываем broken image icon пока JS подставляет src */
img[src=""] {
  visibility: hidden;
}

/* Плавное появление изображений после загрузки */
img[loading="lazy"] {
  background-color: #f3f4f6;
  transition: opacity 0.3s ease;
}

img[data-loaded="true"] {
  opacity: 1;
}

/* Предотвращение сдвига макета для карточек */
.service-card,
.portfolio-item {
  contain: layout paint;
}

/* Обработка ошибок загрузки изображений */
img[data-error="true"] {
  animation: none !important;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
}
img[data-error="true"]::after {
  content: attr(alt);
  display: block;
  padding: 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: #9ca3af;
}

/* FAQ label — скрыт до появления при скролле */
[data-animate="faq-label"] {
  opacity: 0;
  transform: translateY(12px) scale(0.92);
}

/* FAQ items — производительность */
.faq-item {
  will-change: transform, opacity;
}

/* Убираем shimmer для мобильных устройств для лучшей производительности */
@media (max-width: 767px) {
  .skeleton {
    animation-duration: 1s;
  }
}

/* Отключаем анимации для пользователей с prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
    background: #e8e8e8;
  }
}

