/* ==========================================================================
   StilRU (Стиль РУ) - Responsive Breakpoints & Mobile Drawer (responsive.css)
   Milestone 2: UI Design System & Modular CSS
   Breakpoints: 1440px, 1024px, 768px, 430px
   Mobile Burger Toggle & Drawer Slide-In Navigation System
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESKTOP LARGE (max-width: 1440px)
   -------------------------------------------------------------------------- */
@media (max-width: 1440px) {
  :root {
    --shell-max: 1180px;
  }

  .hero-title {
    font-size: clamp(2.4rem, 4.8vw, 4rem);
  }
}

/* --------------------------------------------------------------------------
   2. TABLET LANDSCAPE (max-width: 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  :root {
    --shell: min(100%, calc(100vw - 40px));
  }

  .hero-inner {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }

  .hero-subtitle {
    margin-inline: auto;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-stats {
    justify-content: center;
  }

  .hero-card-widget {
    max-width: 540px;
    margin-inline: auto;
    width: 100%;
  }

  /* Bento Grid 2-Column Collapse */
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .bento-card,
  .bento-card:nth-child(1) {
    grid-column: span 1 !important;
  }

  .about-grid,
  .contacts-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
}

/* --------------------------------------------------------------------------
   3. TABLET PORTRAIT & MOBILE BURGER DRAWER (max-width: 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --header-height: 70px;
  }

  /* Burger Menu Button Toggle */
  .menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line-subtle);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    z-index: var(--z-drawer);
    gap: 5px;
    transition: border-color 200ms ease;
  }

  .menu-toggle:hover {
    border-color: var(--accent-cyan);
  }

  .menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-main);
    transition: transform 250ms ease, opacity 250ms ease, background-color 250ms ease;
    transform-origin: center;
  }

  /* Hamburger to 'X' Line Animation */
  .menu-toggle[aria-expanded="true"] span,
  .menu-toggle.is-active span {
    background: var(--accent-cyan);
  }

  .menu-toggle[aria-expanded="true"] span:nth-child(1),
  .menu-toggle.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .menu-toggle[aria-expanded="true"] span:nth-child(2),
  .menu-toggle.is-active span:nth-child(2) {
    opacity: 0;
  }

  .menu-toggle[aria-expanded="true"] span:nth-child(3),
  .menu-toggle.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* Mobile Drawer Navigation Panel (.mobile-menu-drawer, .main-nav) */
  .main-nav,
  .mobile-menu-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 85vw);
    z-index: var(--z-header);
    background: var(--bg-surface);
    border-left: 1px solid var(--line-cyan);
    padding: 100px 32px 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1), visibility 300ms step-end;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.7);
  }

  .main-nav.is-open,
  .main-nav.is-active,
  .mobile-menu-drawer.is-active,
  .mobile-menu-drawer.is-open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0ms step-start;
  }

  .main-nav .nav-link,
  .mobile-menu-drawer .nav-link {
    font-size: 1.15rem;
    font-family: var(--font-display);
    font-weight: 700;
  }

  /* Mobile Nav Backdrop Overlay */
  .nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-header) - 1);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
  }

  body.menu-open .nav-backdrop,
  .nav-backdrop.is-active {
    opacity: 1;
    pointer-events: auto;
  }

  /* Bento Grid Single Column Collapse */
  .services-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .bento-card {
    grid-column: span 1 !important;
    padding: 24px;
  }

  .about-features {
    grid-template-columns: 1fr;
  }

  .about-metric-card {
    padding: 20px;
  }

  .contacts-info {
    padding: 28px 24px;
  }

  .footer-top {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .header-actions {
    gap: 12px;
  }

  .header-phone-text {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   4. MOBILE SMALL (max-width: 430px)
   -------------------------------------------------------------------------- */
@media (max-width: 430px) {
  :root {
    --shell: calc(100vw - 28px);
  }

  .section {
    padding-block: 50px;
  }

  .hero-title {
    font-size: clamp(2rem, 10vw, 2.7rem);
  }

  .hero-stats {
    grid-template-columns: 1fr;
    gap: 16px;
    text-align: center;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
  }

  .hero-actions .btn-primary,
  .hero-actions .btn-secondary,
  .hero-actions .button,
  .hero-actions .button-secondary {
    width: 100%;
  }

  .cookie-banner {
    left: 14px;
    right: 14px;
    bottom: 14px;
    max-width: none;
  }

  .floating-actions {
    bottom: 16px;
    right: 16px;
  }

  .float-btn,
  .floating-phone {
    width: 46px;
    height: 46px;
  }

  .map-container,
  .map-iframe {
    min-height: 360px;
  }

  .working-hours-grid {
    grid-template-columns: 1fr;
  }
}
