/*
 * Final responsive stability layer.
 * Keeps theme/plugin/editor content inside narrow phone viewports without
 * changing the established desktop layouts.
 */

@media screen and (max-width: 820px) {
  html,
  body {
    max-width: 100%;
    overflow-x: clip;
  }

  body.admin-bar .cookie-header {
    top: calc(12px + 46px);
  }

  .cookie-header,
  .cookie-header > *,
  .cookie-navigation,
  .cookie-navigation .cookie-menu,
  .cookie-navigation .cookie-menu li {
    min-width: 0;
    max-width: 100%;
  }

  .cookie-logo {
    flex-shrink: 1;
  }

  .cookie-header-icons {
    flex: 0 0 auto;
  }

  .cookie-navigation {
    max-height: calc(100svh - 92px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .cookie-navigation a {
    width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  main,
  main > *,
  main section,
  main article,
  .captain-content-area,
  .captain-content-container,
  .captain-entry,
  .captain-entry-content,
  .page-shell,
  .page,
  .site-shell {
    min-width: 0;
    max-width: 100%;
  }

  main :where(h1, h2, h3, h4, p, li, figcaption, blockquote),
  .captain-footer :where(h3, p, li, a) {
    overflow-wrap: anywhere;
    word-break: normal;
  }

  main :where(img, video, canvas, iframe, table, form),
  .captain-footer :where(img, form) {
    max-width: 100%;
  }

  main :where(input, select, textarea) {
    min-width: 0;
    max-width: 100%;
  }

  main :where(button, .button, [class*="-button"]),
  .captain-footer :where(button, .button) {
    max-width: 100%;
    white-space: normal;
  }

  :where(
    .destinations-grid,
    .destination-grid,
    .article-grid,
    .product-grid,
    .value-cards,
    .journey-steps,
    .adventure-grid,
    .coming-grid,
    .captain-benefits-grid,
    .wp-block-columns
  ) > * {
    min-width: 0;
  }

  .image-slot,
  .image-placeholder,
  .product-image,
  .wp-block-image,
  .wp-block-image img {
    max-width: 100%;
  }

  .wp-block-table {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .wp-block-table table {
    width: max-content;
    min-width: 100%;
  }

  .woocommerce,
  .woocommerce form,
  .woocommerce table,
  .wp-block-woocommerce-cart,
  .wp-block-woocommerce-checkout,
  .wc-block-cart,
  .wc-block-cart__main,
  .wc-block-cart__sidebar,
  .wc-block-components-sidebar,
  .wc-block-components-main {
    min-width: 0;
    max-width: 100%;
  }

  .woocommerce table.shop_table_responsive,
  .woocommerce-page table.shop_table_responsive {
    width: 100%;
  }

  .wc-block-components-product-name,
  .wc-block-components-product-metadata,
  .wc-block-components-product-metadata__description {
    overflow-wrap: anywhere;
  }
}

@media screen and (max-width: 600px) {
  .captain-content-area {
    padding-right: 12px;
    padding-left: 12px;
  }

  .captain-footer-inner,
  .captain-footer-column,
  .captain-footer-newsletter,
  .captain-footer-bottom {
    min-width: 0;
    max-width: 100%;
  }

  .captain-newsletter-form,
  .newsletter-form {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
  }

  .captain-newsletter-form input,
  .captain-newsletter-form button,
  .newsletter-form input,
  .newsletter-form button {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .captain-footer-bottom-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
  }

  .cta-buttons,
  .cta-actions,
  .cookie-buttons {
    width: 100%;
    align-items: stretch;
    justify-content: center;
  }

  .cta-buttons a,
  .cta-actions a,
  .cookie-buttons a {
    width: 100%;
    max-width: 320px;
    margin-inline: auto;
    justify-content: center;
    text-align: center;
  }

  .products-toolbar,
  .captain-shop-ordering,
  .captain-shop-ordering .woocommerce-ordering,
  .captain-shop-ordering select {
    width: 100%;
    min-width: 0;
  }

  .captain-shop-ordering {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .product-card-price {
    overflow-wrap: anywhere;
  }

  .wc-block-components-quantity-selector {
    max-width: 122px;
  }

  .wc-block-cart-item__product,
  .wc-block-cart-item__total {
    min-width: 0;
  }

  .wc-block-cart-item__remove-link {
    white-space: normal !important;
  }
}

@media screen and (max-width: 380px) {
  .cookie-header {
    padding-right: 8px;
    padding-left: 10px;
  }

  .cookie-logo {
    width: 124px;
    min-width: 124px;
  }

  .cookie-logo img {
    width: 108px;
  }

  .cookie-header-icons {
    gap: 4px;
  }

  .captain-footer {
    padding-right: 16px;
    padding-left: 16px;
  }
}

@media screen and (max-width: 782px) {
  body.admin-bar .cookie-navigation {
    max-height: calc(100svh - 138px);
  }
}

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