/* Shared layout safeguards, loaded after the active seasonal theme. */
.discovery-banners > *, .detail-layout > *, .checkout-layout > *, .account-layout > * { min-width: 0; }
.discovery-banner { width: 100%; max-width: 100%; }
.discovery-banner .banner-copy { min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 900px) {
  body .header nav, body[data-theme] .header nav { top: 100%; max-height: calc(100dvh - 150px); overflow-y: auto; overscroll-behavior: contain; }
  body .header nav a { display: flex; align-items: center; min-height: 44px; padding: 8px 0; }
  body .header nav.open { gap: 4px; padding: 12px 24px; }
  .breadcrumbs { flex-wrap: wrap; overflow-wrap: anywhere; }
}

@media (max-width: 600px) {
  html { scroll-padding-top: 150px; }
  body .header { gap: 10px; padding-inline: 16px; }
  body .header .brand, body .header-actions { flex-shrink: 0; }
  body .header-actions { gap: 0; }
  body .header .header-actions .icon-button { width: 44px; height: 44px; }
  body .header .header-actions .mobile-toggle { display: grid; }
  body .header .cart-count { right: 2px; top: 2px; }
  .launch-notice { font-size: 12px; line-height: 1.5; padding: 10px 16px; }

  /* Let longer seasonal copy grow instead of colliding with an absolute image. */
  body[data-view=home] .hero,
  body[data-theme=winter][data-view=home] .hero,
  body[data-theme=halloween][data-view=home] .hero { display: flex; flex-direction: column; height: auto; min-height: 0; }
  body[data-view=home] .hero-content,
  body[data-theme=winter][data-view=home] .hero-content,
  body[data-theme=halloween][data-view=home] .hero-content { position: relative; width: 100%; height: auto; min-width: 0; padding: 32px 22px 20px; }
  body[data-theme=winter][data-view=home] .hero-content { padding-top: 56px; }
  body[data-theme=halloween][data-view=home] .hero-content { padding-top: 45px; }
  body[data-view=home] .hero-visual,
  body[data-theme=winter][data-view=home] .hero-visual,
  body[data-theme=halloween][data-view=home] .hero-visual { position: relative; inset: auto; width: 100%; height: clamp(230px, 65vw, 330px); min-height: 0; flex-shrink: 0; }
  body[data-view=home] .hero::after { display: none; }
  body[data-view=home] .hero h1 { overflow-wrap: anywhere; hyphens: auto; }
  body[data-view=home] .hero-links .button { max-width: 100%; min-height: 48px; white-space: normal; gap: 14px; font-size: 16px; text-align: center; }
  body[data-view=home] .brand-ribbon { flex-wrap: wrap; gap: 8px 12px; font-size: 13px; }
  body[data-view=home] .categories h2, .section h1, .section h2 { overflow-wrap: anywhere; hyphens: auto; }
  .discovery-banner, body[data-theme=winter] .discovery-banner { aspect-ratio: auto; min-height: 190px; }
  .discovery-banner .banner-copy { padding-block: 20px; }
  .discovery-banner h2, body[data-theme=winter] .discovery-banner h2 { font-size: clamp(20px, 5.5vw, 26px); hyphens: auto; }
  .discovery-banner .banner-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 12px; }

  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-card, .product-meta, .product-title-row { min-width: 0; }
  .product-title { overflow-wrap: anywhere; hyphens: auto; }
  .card-image-wrap .quick-add { width: 44px; height: 44px; }
  .chip, .color-choice { min-height: 44px; }
  .color-choice { max-width: 100%; white-space: normal; text-align: left; }
  .filter-chips { overscroll-behavior-x: contain; }
  .sort-label select, input:not([type=checkbox],[type=radio]), textarea, select { font-size: 16px; }
  .search-row { display: flex; flex-wrap: wrap; gap: 8px; }
  .search-row input { flex: 1 1 180px; min-width: 0; }
  .search-row button { min-height: 44px; margin: 0; }

  dialog { max-width: calc(100% - 16px); max-height: calc(100dvh - 24px); overscroll-behavior: contain; }
  .product-dialog { width: calc(100% - 16px); }
  .close-button { width: 44px; height: 44px; }
  .lightbox-controls button { min-width: 44px; min-height: 44px; }
  .detail-copy { overflow-wrap: anywhere; }
  .detail-copy h1, .detail-copy h2 { hyphens: auto; }
  .buy-row { flex-wrap: wrap; align-items: end; }
  .buy-row .button { flex: 1 1 180px; min-height: 49px; white-space: normal; padding-inline: 16px; gap: 10px; }
  .cart-dialog { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; padding: 20px 16px max(20px, env(safe-area-inset-bottom)); }
  #cart-items { min-height: 0; overscroll-behavior: contain; }
  .cart-item { gap: 12px; }
  .cart-item .product-image { width: 68px; height: 68px; }
  .cart-item-info { min-width: 0; overflow-wrap: anywhere; }
  .item-controls { flex-wrap: wrap; gap: 8px; }
  .quantity button { width: 44px; min-height: 44px; padding: 4px; }
  .quantity span { min-width: 28px; }
  .remove-item { min-height: 44px; padding: 8px; font-size: 12px; }
  #cart-bottom { flex-shrink: 0; }
  .checkout-layout { gap: 24px; }
  .checkout-form, .checkout-form fieldset { min-width: 0; }
  .checkout-form .form-grid, .login-card .form-grid { grid-template-columns: minmax(0, 1fr); }
  .checkout-form input:not([type=checkbox]), .checkout-form select, .checkout-form textarea { font-size: 16px; min-height: 48px; }
  .checkout-form fieldset { padding: 16px; margin-inline: 0; }
  .checkout-line > div:nth-child(2), .summary-product > div { min-width: 0; overflow-wrap: anywhere; }
  .checkout-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; font-size: 11px; }
  .checkout-steps li { padding: 0 0 12px; overflow-wrap: anywhere; }
  .checkout-form .button, .success-actions .button { width: 100%; min-height: 48px; white-space: normal; gap: 10px; }
  .account-cards { grid-template-columns: minmax(0, 1fr); }
  .account-session { overflow-wrap: anywhere; }
  footer .footer-bottom { flex-wrap: wrap; align-items: center; }
  footer .footer-main a, footer .footer-bottom a, footer .footer-bottom button { display: inline-flex; align-items: center; min-height: 44px; font-size: 12px; }
  .statistics-choice { left: 8px; bottom: max(8px, env(safe-area-inset-bottom)); width: calc(100% - 16px); padding: 20px; max-height: calc(100dvh - 24px); overscroll-behavior: contain; }
  .statistics-choice h2 { font-size: 22px; }
  .statistics-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .statistics-actions button { width: 100%; min-width: 0; min-height: 48px; }
  .toast { max-width: calc(100% - 24px); min-width: 0; overflow-wrap: anywhere; }
}

@media (max-width: 420px) {
  /* Two deliberate rows keep the seasonal logo and all four controls usable. */
  body .header, body[data-theme=winter] .header, body[data-theme=halloween] .header { height: auto; min-height: 112px; flex-wrap: wrap; justify-content: center; padding: 14px 16px 6px; gap: 6px; }
  body .header-actions { flex-basis: 100%; justify-content: space-evenly; }
  body .header nav, body[data-theme] .header nav { top: 100%; }
  .product-page .detail-copy { padding-top: 20px; }
}
