/* =========================================
   Mobile & iOS Safari Fixes
   ======================================== */

.header {
  padding-inline: max(var(--container-pad), env(safe-area-inset-left))
                  max(var(--container-pad), env(safe-area-inset-right));
}

.footer {
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
}

.hero {
  min-height: 100svh;
}

@supports not (min-height: 100svh) {
  .hero {
    min-height: -webkit-fill-available;
  }
}

.form__input {
  font-size: max(16px, var(--size-base));
}

.nav--mobile {
  -webkit-overflow-scrolling: touch;
  overflow-y: auto;
  max-height: calc(100dvh - var(--header-h));
}

a,
button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

/* Tablet (768-1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  :root {
    --header-h: 72px;
  }

  .hero__title {
    font-size: clamp(2rem, 5.5vw, 3rem);
  }

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

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

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

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

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

/* Mobile form */
@media (max-width: 767px) {
  .form__submit {
    font-size: clamp(0.75rem, 3.5vw, .9rem);
    white-space: normal;
    padding-block: .75rem;
    line-height: 1.3;
  }

  .header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
  }

  .header__burger {
    order: 1;
    z-index: 10;
  }

  .header__logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    z-index: 5;
  }

  .header__actions {
    order: 3;
    z-index: 10;
  }

  .header__actions .btn--accent.btn--sm {
    display: none;
  }

  .mobile-call-btn {
    display: flex;
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 999;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-accent);
    color: #fff;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(229, 9, 20, .4);
    -webkit-tap-highlight-color: transparent;
  }
}

/* Narrow mobile */
@media (max-width: 480px) {
  .header__actions .btn--accent.btn--sm {
    padding-inline: calc(1.25rem - 0.3125rem);
    margin-inline-end: 0.5rem;
    font-size: 0.75rem;
    width: 120px;
  }
}

/* Small mobile (<375px) */
@media (max-width: 374px) {
  :root {
    --container-pad: .875rem;
  }

  .hero__title {
    font-size: 1.75rem;
  }

  .btn {
    padding: .75rem 1.25rem;
    font-size: .9rem;
  }

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

/* Landscape small phones */
@media (max-height: 480px) and (orientation: landscape) {
  .hero__inner {
    padding-block: 3rem 2rem;
  }

  .hero__scroll {
    display: none;
  }
}

/* Focus-visible outlines */
a:focus-visible,
button:focus-visible,
input:focus-visible,
[role="tab"]:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Reduced motion — accessibility exception for !important */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms;
    animation-iteration-count: 1;
    transition-duration: .01ms;
    scroll-behavior: auto;
  }
}
