/* ===== RESPONSIVE CSS - Mobile First Approach ===== */

/* Дополнительная защита от горизонтального скролла */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

* {
  box-sizing: border-box;
}

.container, .container-fluid {
  max-width: 100%;
  overflow-x: hidden;
}

.row {
  margin-left: 0;
  margin-right: 0;
  max-width: 100%;
}

.row > [class*="col-"] {
  padding-left: 10px;
  padding-right: 10px;
}

/* Bootstrap 5 Navbar Collapse Fix */
.navbar-collapse {
  transition: all 0.3s ease !important;
}

.navbar-collapse.show {
  display: block !important;
}

.navbar-collapse.collapsing {
  height: 0 !important;
  overflow: hidden !important;
  transition: height 0.35s ease !important;
}

/* Bootstrap toggle visual feedback (optional) */
.navbar-toggler[aria-expanded="true"] {
  transform: rotate(180deg);
  transition: transform 0.3s ease;
}

.navbar-toggler[aria-expanded="false"] {
  transform: rotate(0deg);
  transition: transform 0.3s ease;
}

/* ===== Base Styles (Mobile - 320px and up) ===== */
/* Typography adjustments for mobile */
h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.75rem;
}

h3 {
  font-size: 1.5rem;
}

.hero-title {
  font-size: 2.25rem;
}

.hero-subtitle {
  font-size: 1.125rem;
}

/* Layout adjustments for mobile */
.section {
  padding: 60px 0;
}

.card-body {
  padding: 1.5rem;
}

.contact-form {
  padding: 2rem;
}

/* Hero section mobile */
.hero {
  min-height: 70vh;
  text-align: center;
}

.hero-image {
  margin-top: 2rem;
}

/* Navigation mobile */
.navbar-brand {
  font-size: 1.25rem;
}

.navbar-nav .nav-link {
  padding: 0.75rem 1rem;
  text-align: center;
}

/* Services cards mobile */
.services-card {
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.services-icon {
  width: 60px;
  height: 60px;
  font-size: 1.5rem;
}

/* Team cards mobile */
.team-photo {
  width: 100px;
  height: 100px;
}

/* Gallery mobile */
.gallery-item {
  margin-bottom: 1rem;
}

.gallery-item img {
  height: 200px;
}

/* Footer mobile */
footer {
  padding: 2rem 0 1rem;
}

/* ===== Small Devices (landscape phones, 576px and up) ===== */
@media (min-width: 576px) {
  .hero-title {
    font-size: 2.5rem;
  }

  .hero-subtitle {
    font-size: 1.2rem;
  }

  .services-icon {
    width: 70px;
    height: 70px;
    font-size: 1.75rem;
  }

  .gallery-item img {
    height: 220px;
  }

  .contact-form {
    padding: 2.5rem;
  }
}

/* ===== Medium Devices (tablets, 768px and up) ===== */
@media (min-width: 768px) {
  .section {
    padding: 80px 0;
  }

  .hero {
    min-height: 90vh;
    text-align: left;
  }

  .hero-title {
    font-size: 3rem;
  }

  .hero-subtitle {
    font-size: 1.25rem;
  }

  .hero-image {
    margin-top: 0;
  }

  .navbar-brand {
    font-size: 1.5rem;
  }

  .navbar-nav .nav-link {
    padding: 0.5rem 1rem;
    text-align: left;
  }

  .services-card {
    padding: 2rem;
  }

  .services-icon {
    width: 80px;
    height: 80px;
    font-size: 2rem;
  }

  .team-photo {
    width: 120px;
    height: 120px;
  }

  .gallery-item img {
    height: 250px;
  }

  .contact-form {
    padding: 3rem;
  }

  .testimonial-card {
    margin: 1rem;
  }

  .faq-item {
    margin-bottom: 1.5rem;
  }

  footer {
    padding: 3rem 0 1rem;
  }
}

/* ===== Large Devices (desktops, 992px and up) ===== */
@media (min-width: 992px) {
  .hero {
    min-height: 100vh;
  }

  .hero-title {
    font-size: 3.5rem;
  }

  .hero-subtitle {
    font-size: 1.35rem;
  }

  h1 {
    font-size: 2.5rem;
  }

  h2 {
    font-size: 2rem;
  }

  .services-card {
    padding: 2.5rem;
  }

  .gallery-item img {
    height: 280px;
  }

  .testimonial-card {
    margin: 1.5rem;
  }

  .card-body {
    padding: 2rem;
  }

  /* Note: Using Bootstrap grid instead of custom grid for better compatibility */
  .services-grid .col-lg-4:nth-child(n+7) {
    margin-top: 2rem;
  }

  .team-grid .col-lg-2:nth-child(n+6) {
    margin-top: 2rem;
  }

  .testimonial-grid .col-lg-6:nth-child(n+3) {
    margin-top: 2rem;
  }
}

/* ===== Extra Large Devices (large desktops, 1200px and up) ===== */
@media (min-width: 1200px) {
  .hero-title {
    font-size: 4rem;
  }

  .hero-subtitle {
    font-size: 1.5rem;
  }

  .container {
    max-width: 1200px;
  }

  .section {
    padding: 100px 0;
  }

  .services-card {
    padding: 3rem;
  }

  .contact-form {
    padding: 4rem;
  }

  .gallery-item img {
    height: 300px;
  }
}

/* ===== Ultra Wide Screens (1400px and up) ===== */
@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }

  .hero-title {
    font-size: 4.5rem;
  }

  .section {
    padding: 120px 0;
  }
}

/* ===== Specific Component Responsiveness ===== */

/* Navbar Responsiveness */
@media (max-width: 991.98px) {
  .navbar {
    padding: 0.5rem 0;
  }
  
  .navbar .container {
    padding-left: 15px;
    padding-right: 15px;
    max-width: 100%;
  }
  
  .navbar-brand {
    font-size: 1.2rem;
    margin-right: auto;
  }
  
  .navbar-toggler {
    margin-left: 10px;
  }
  
  .navbar-collapse {
    background-color: var(--bg-light);
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin-top: 1rem;
    max-width: 100%;
    overflow: hidden;
  }

  .navbar-nav {
    gap: 0.5rem;
  }

  .navbar-nav .nav-link {
    border-radius: var(--border-radius-sm);
    transition: background-color 0.3s ease;
    padding: 0.75rem 1rem;
    text-align: center;
  }

  .navbar-nav .nav-link:hover {
    background-color: var(--primary-cream);
  }
}

/* Дополнительные стили для очень маленьких экранов */
@media (max-width: 575.98px) {
  .navbar .container {
    padding-left: 10px;
    padding-right: 10px;
  }
  
  .navbar-brand {
    font-size: 1.1rem;
  }
  
  /* Navbar toggler styles handled by Bootstrap */
}

/* Hero Section Responsiveness */
@media (max-width: 767.98px) {
  .hero {
    padding: 2rem 0;
  }

  .hero-content {
    margin-bottom: 2rem;
  }

  .hero-image img {
    max-width: 100%;
    height: auto;
  }
}

/* Grid sections use Bootstrap responsive classes by default */

/* FAQ Responsiveness */
@media (max-width: 575.98px) {
  .faq-question {
    padding: 1rem;
    font-size: 0.9rem;
  }

  .faq-answer {
    padding: 0 1rem 1rem;
    font-size: 0.85rem;
  }
}

/* Contact Form Responsiveness */
@media (max-width: 575.98px) {
  .contact-form {
    padding: 1.5rem;
  }

  .form-control {
    font-size: 0.9rem;
  }
}

/* Gallery Responsiveness */
@media (max-width: 575.98px) {
  .gallery-item {
    margin-bottom: 0.5rem;
  }

  .gallery-item img {
    height: 180px;
  }
}

/* Footer Responsiveness */
@media (max-width: 767.98px) {
  .footer-content {
    text-align: center;
    margin-bottom: 1.5rem;
  }

  .footer-title {
    font-size: 1.125rem;
  }

  .copyright {
    font-size: 0.8rem;
  }
}

/* ===== Print Styles ===== */
@media print {
  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.4;
  }

  .navbar,
  .btn,
  .gallery-item,
  .contact-form,
  footer {
    display: none;
  }

  .hero,
  .section {
    padding: 20px 0;
  }

  .hero-title {
    font-size: 24pt;
  }

  .hero-subtitle {
    font-size: 14pt;
  }

  h1 {
    font-size: 18pt;
  }

  h2 {
    font-size: 16pt;
  }

  h3 {
    font-size: 14pt;
  }

  .card,
  .services-card,
  .team-card,
  .testimonial-card {
    border: 1px solid #ddd;
    break-inside: avoid;
  }
}

/* ===== Landscape Orientation ===== */
@media screen and (orientation: landscape) and (max-height: 600px) {
  .hero {
    min-height: 80vh;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .navbar {
    padding: 0.5rem 0;
  }
}

/* ===== High DPI Displays ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .hero-image img,
  .gallery-item img,
  .team-photo img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: optimize-contrast;
  }
}

/* ===== Accessibility - Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  .gallery-item:hover {
    transform: none;
  }

  .card:hover,
  .services-card:hover,
  .team-card:hover {
    transform: none;
  }

  .btn-primary:hover {
    transform: none;
  }

  .gallery-item img {
    transition: none;
  }
}

/* ===== Dark Mode Support (if needed in future) ===== */

/* ===== Container Queries (Modern Browsers) ===== */
@supports (container-type: inline-size) {
  .services-container {
    container-type: inline-size;
  }

  @container (min-width: 600px) {
    .services-card {
      padding: 2.5rem;
    }
  }

  @container (min-width: 900px) {
    .services-card {
      padding: 3rem;
    }
  }
}

/* ===== Hover Support Detection ===== */
@media (hover: hover) {
  .card:hover,
  .services-card:hover,
  .team-card:hover,
  .gallery-item:hover {
    transform: translateY(-5px);
  }

  .btn-primary:hover {
    transform: translateY(-2px);
  }
}

@media (hover: none) {
  .card:hover,
  .services-card:hover,
  .team-card:hover,
  .gallery-item:hover,
  .btn-primary:hover {
    transform: none;
  }
}

/* ===== Focus Styles for Keyboard Navigation ===== */
@media (prefers-reduced-motion: no-preference) {
  .nav-link:focus,
  .btn:focus,
  .form-control:focus,
  .faq-question:focus {
    outline: 2px solid var(--primary-terracotta);
    outline-offset: 2px;
  }
}

/* ===== Custom Scrollbar ===== */
@media (min-width: 768px) {
  ::-webkit-scrollbar {
    width: 8px;
  }

  ::-webkit-scrollbar-track {
    background: var(--primary-cream);
  }

  ::-webkit-scrollbar-thumb {
    background: var(--primary-terracotta);
    border-radius: 4px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: var(--dark-terracotta);
  }
} 