/**
 * Mobile layout polish (phones + small tablets).
 * Loaded after styles.css — rules apply only below 768px.
 */

@media (max-width: 768px) {
  html {
    min-height: 100%;
    min-height: -webkit-fill-available;
  }

  body {
    overflow-x: hidden;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .page > main {
    padding-bottom: max(0.35rem, env(safe-area-inset-bottom, 0px));
  }

  .skip-link {
    left: max(1rem, env(safe-area-inset-left, 0px) + 0.35rem);
  }

  .site-header {
    padding-top: env(safe-area-inset-top, 0px);
  }

  .container {
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
  }

  .section {
    padding: 1.75rem 0;
  }

  .hero + .section--products {
    padding-top: 1.1rem;
  }

  .section--highlights {
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px));
  }

  .section-header {
    margin-bottom: 1.15rem;
  }

  .section-title {
    font-size: clamp(1.2rem, 4.2vw + 0.65rem, 1.65rem);
    line-height: 1.18;
  }

  .section-subtitle,
  .highlight-copy,
  .service-description {
    font-size: 0.86rem;
    line-height: 1.62;
    max-width: none;
  }

  /* Single-column content blocks */
  .highlight-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.85rem;
  }

  .highlight-card {
    padding: 1.05rem 1rem;
  }

  .service-grid,
  .service-grid--four {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0.85rem;
  }

  .service-card {
    padding: 1.1rem 1rem;
  }

  .product-grid,
  .product-grid--four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .gallery-item,
  .gallery-image {
    aspect-ratio: 1;
    min-height: 0;
  }

  .gallery-caption {
    display: none;
  }

  /* Legacy side-by-side hero only (not stacked home hero) */
  .hero:not(.hero--stacked) .hero-headline-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.45rem 0.5rem;
  }

  .hero:not(.hero--stacked) .hero-aside {
    flex: 0 0 30%;
    width: 30%;
    max-width: 108px;
    min-width: 82px;
    align-self: flex-start;
  }

  .hero:not(.hero--stacked) .hero-aside .hero-media-card {
    padding: 0.28rem;
    border-radius: 10px;
  }

  .hero:not(.hero--stacked) .hero-aside .hero-image-frame {
    min-height: 0 !important;
    aspect-ratio: 3 / 4;
    padding: 0.28rem;
  }

  .hero:not(.hero--stacked) .hero-title {
    font-size: clamp(1.15rem, 4.8vw + 0.4rem, 1.55rem);
    letter-spacing: 0.025em;
    line-height: 1.08;
    margin-bottom: 0.35rem;
  }

  .hero:not(.hero--stacked) .hero-copy .hero-subtitle {
    font-size: 0.78rem;
    line-height: 1.42;
    margin-bottom: 0;
  }

  .hero.hero--stacked .hero-title {
    font-size: clamp(1.85rem, 8vw, 2.6rem);
  }

  .hero.hero--stacked .hero-subtitle {
    font-size: clamp(0.95rem, 3.2vw, 1.05rem);
    line-height: 1.55;
  }

  .hero-details {
    gap: 0.3rem;
    padding-top: 0.3rem;
    margin-top: 0.05rem;
  }

  .hero-note {
    font-size: 0.55rem;
    line-height: 1.2;
    letter-spacing: 0.02em;
  }

  .hero-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.25rem 0.2rem;
  }

  .hero-meta .meta-item-label {
    font-size: 0.48rem;
    letter-spacing: 0.1em;
    line-height: 1.2;
  }

  .hero-meta .meta-item-value {
    font-size: 0.6rem;
    line-height: 1.12;
  }

  /* Touch-friendly controls */
  .btn,
  .btn-small,
  .btn-outline,
  .cart-link,
  .nav-drawer a,
  .nav-toggle {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(var(--color-primary-rgb), 0.12);
  }

  .btn {
    min-height: 44px;
    padding: 0.62rem 1.2rem;
  }

  .hero-cta .btn,
  .hero-cta .btn-outline {
    min-height: 40px;
    width: 100%;
    font-size: 0.56rem;
    letter-spacing: 0.07em;
  }

  .product-footer .btn-small {
    min-height: 40px;
    font-size: 0.6rem;
    padding: 0.45rem 0.35rem;
  }

  /* Shop & forms */
  .shop-filters {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
  }

  .shop-filters .filter-label,
  .shop-filters .filter-select {
    width: 100% !important;
    max-width: none !important;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0.85rem;
  }

  /* Cart table scroll */
  .cart-layout {
    gap: 1.25rem !important;
  }

  .cart-layout > .card:first-child {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  .cart-layout > .card:first-child .cart-table {
    min-width: 520px;
  }

  /* Bottom-sheet modals */
  .add-to-bag-modal,
  .product-detail-modal-wrap {
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .add-to-bag-modal-box {
    width: 100%;
    max-width: none;
    border-radius: 20px 20px 0 0;
    max-height: min(92vh, 92dvh);
    padding-bottom: calc(1.35rem + env(safe-area-inset-bottom, 0px));
  }

  .product-detail-modal-box {
    width: 100%;
    max-width: none;
    border-radius: 20px 20px 0 0;
    max-height: min(94vh, 94dvh);
    margin-top: auto;
  }

  .product-detail-modal-body {
    padding-bottom: calc(1.35rem + env(safe-area-inset-bottom, 0px));
  }

  .disclaimer-banner {
    font-size: 0.82rem;
    padding: 0.75rem 0.85rem;
  }

  .site-footer {
    margin-top: 1.75rem;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
  }

  .footer-bottom {
    padding-bottom: max(0.35rem, env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 480px) {
  .nav-cta .btn-outline {
    padding: 0.4rem 0.55rem;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
  }

  .brand-text-tagline {
    display: none;
  }

  .nav-cta .cart-link > span:first-child {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

@media (max-width: 380px) {
  .product-grid,
  .product-grid--four {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero .hero-headline-row {
    gap: 0.4rem 0.45rem;
  }

  .hero .hero-aside {
    flex: 0 0 28%;
    width: 28%;
    max-width: 96px;
    min-width: 76px;
  }

  .hero-cta {
    gap: 0.35rem;
  }
}
