/* ==========================================================================
   responsive.css — Breakpoints, iOS Safari fixes, mobile adaptations
   ========================================================================== */

/* --- Skip Link (accessible, visible on focus) --- */

.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 9999;
  padding: 12px 24px;
  background: var(--brand-dark);
  color: var(--white);
  font-family: var(--font-heading);
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 16px;
}

/* --- iOS Safari / Touch Fixes (global) --- */

.table-wrap,
.mobile-menu {
  -webkit-overflow-scrolling: touch;
}

input,
select,
textarea,
button,
a {
  touch-action: manipulation;
}

/* --- 1440px — Large screens --- */

@media (max-width: 1440px) {
  .container--wide {
    max-width: 1280px;
  }
}

/* --- 1200px — Desktop small --- */

@media (max-width: 1200px) {
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .section {
    padding: 64px 0;
  }

  .footer__grid {
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 32px;
  }

  .stats-grid {
    gap: 32px;
  }
}

/* --- 1024px — Tablet landscape --- */

@media (max-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .gallery-grid {
    columns: 2;
  }

  .timeline__step {
    padding: 0 12px;
  }

  .nav__list {
    gap: 16px;
  }

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

/* --- 768px — Mobile --- */

@media (max-width: 768px) {
  :root {
    --header-h: 64px;
  }

  .section {
    padding: 48px 0;
  }

  .section__subtitle {
    margin-bottom: 32px;
  }

  /* Nav: show burger, hide desktop menu */
  .header__nav,
  .nav__list {
    display: none;
  }

  .header__cta {
    display: none;
  }

  .burger,
  .nav__burger {
    display: flex;
  }

  /* Header height reduction */
  .header__inner,
  .header__container {
    height: var(--header-h);
  }

  .header__logo img {
    height: 36px;
  }

  /* Hero adaptations */
  .hero__title {
    font-size: clamp(1.75rem, 7vw, 2.5rem);
  }

  .hero__subtitle {
    font-size: 1rem;
    margin-bottom: 24px;
  }

  .hero__actions {
    flex-direction: column;
    align-items: center;
  }

  .hero__actions .btn {
    width: 100%;
    max-width: 320px;
  }

  /* Product grid: single column */
  .product-grid {
    grid-template-columns: 1fr;
  }

  /* Timeline becomes vertical */
  .timeline {
    flex-direction: column;
    gap: 0;
  }

  .timeline__step {
    text-align: left;
    padding: 0 0 32px 64px;
  }

  .timeline__number {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0;
  }

  .timeline__step:not(:last-child)::after {
    top: 48px;
    left: 23px;
    width: 2px;
    height: calc(100% - 48px);
  }

  /* Stats: 2 columns */
  .stats-grid {
    gap: 24px;
  }

  .stat {
    min-width: calc(50% - 12px);
  }

  /* Gallery: 2 columns */
  .gallery-grid {
    columns: 2;
    column-gap: 12px;
  }

  .gallery-grid__item {
    margin-bottom: 12px;
  }

  /* Footer stacking */
  .footer__grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .footer__bottom {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  /* Buttons full width on mobile */
  .btn {
    padding: 12px 24px;
    font-size: 13px;
  }

  /* Cards: reduce padding */
  .card {
    padding: 20px;
  }

  /* Tables: scroll hint */
  .table-wrap::after {
    content: '← прокрутіть →';
    display: block;
    text-align: center;
    font-size: 12px;
    color: var(--steel);
    padding: 8px 0 0;
  }

  .product-table th,
  .product-table td {
    padding: 10px 12px;
    font-size: 14px;
  }

  /* FAQ */
  .faq__question {
    font-size: 1rem;
    padding: 16px 0;
  }

  /* Breadcrumbs */
  .breadcrumbs {
    font-size: 13px;
  }

  /* Lightbox controls larger for touch */
  .lightbox__close {
    top: 12px;
    right: 12px;
    font-size: 28px;
  }

  .lightbox__prev {
    left: 8px;
  }

  .lightbox__next {
    right: 8px;
  }

  /* Mobile menu wider */
  .mobile-menu {
    width: 100%;
    max-width: 320px;
  }

  /* Forms */
  .form__input,
  .form__select,
  .form__textarea {
    font-size: 16px; /* prevents iOS zoom */
  }
}

/* --- 480px — Small mobile --- */

@media (max-width: 480px) {
  .section {
    padding: 36px 0;
  }

  .section__title {
    font-size: clamp(1.4rem, 6vw, 1.75rem);
  }

  /* Stats: single column */
  .stat {
    min-width: 100%;
  }

  /* Gallery: single column */
  .gallery-grid {
    columns: 1;
  }

  /* Hero compact */
  .hero__content {
    padding-inline: 16px;
  }

  /* Cards minimal padding */
  .card {
    padding: 16px;
  }

  /* Table font reduction */
  .product-table th,
  .product-table td {
    padding: 8px 10px;
    font-size: 13px;
  }

  .footer {
    padding: 40px 0 0;
  }

  .footer__bottom {
    padding: 16px 0;
  }

  .stats-grid {
    gap: 20px;
  }

  .btn {
    width: 100%;
  }
}

/* --- iOS Safari: safe area + 100svh --- */

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .footer {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-menu {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .header {
    padding-top: env(safe-area-inset-top);
  }
}

@supports not (height: 100svh) {
  .hero {
    height: calc(var(--vh, 1vh) * 100);
  }
}
