/* Chef DS responsive hardening v11
   Mobile/tablet-only presentation rules. No desktop, data, auth, or tool logic changes. */

html.public-nav-open,
body.public-nav-open {
  overflow: hidden !important;
  overscroll-behavior: none;
}

@media (max-width: 1359px) {
  html,
  body {
    max-width: 100%;
  }

  img,
  svg,
  video,
  canvas {
    max-width: 100%;
  }

  .public-site-header.public-about-navigation .public-nav-shell {
    padding-left: max(1rem, env(safe-area-inset-left)) !important;
    padding-right: max(1rem, env(safe-area-inset-right)) !important;
  }

  .public-site-header.public-about-navigation .public-nav-toggle {
    width: 3rem !important;
    height: 3rem !important;
    min-width: 3rem !important;
    min-height: 3rem !important;
    touch-action: manipulation;
  }

  .public-site-header.public-about-navigation .public-mobile-menu.hidden {
    display: none !important;
  }

  .public-site-header.public-about-navigation .public-mobile-menu {
    top: 5rem !important;
    height: calc(100dvh - 5rem) !important;
    max-height: calc(100dvh - 5rem) !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .public-site-header.public-about-navigation .public-mobile-menu-inner {
    width: min(100%, 42rem) !important;
    min-height: 100% !important;
    margin-inline: auto !important;
    padding: 1rem max(1rem, env(safe-area-inset-right)) calc(2rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)) !important;
  }

  .public-site-header.public-about-navigation .public-mobile-link,
  .public-site-header.public-about-navigation .public-mobile-book,
  .public-site-header.public-about-navigation .public-mobile-login {
    min-height: 3rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    touch-action: manipulation;
  }

  .public-site-header.public-about-navigation .public-mobile-link {
    justify-content: space-between !important;
  }
}

@media (max-width: 767px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: 5.5rem;
  }

  body[data-chef-shell="public"],
  body[data-chef-shell="family"] {
    overflow-x: hidden;
  }

  body[data-chef-shell="public"] *,
  body[data-chef-shell="family"] * {
    min-width: 0;
  }

  body[data-chef-shell="public"] input,
  body[data-chef-shell="public"] select,
  body[data-chef-shell="public"] textarea,
  body[data-chef-shell="family"] input,
  body[data-chef-shell="family"] select,
  body[data-chef-shell="family"] textarea {
    max-width: 100%;
    font-size: 16px !important;
  }

  body[data-chef-shell="public"] input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  body[data-chef-shell="public"] select,
  body[data-chef-shell="public"] textarea,
  body[data-chef-shell="family"] input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  body[data-chef-shell="family"] select,
  body[data-chef-shell="family"] textarea {
    min-height: 2.875rem;
  }

  body[data-chef-shell="public"] button,
  body[data-chef-shell="family"] button,
  body[data-chef-shell="public"] a,
  body[data-chef-shell="family"] a {
    overflow-wrap: anywhere;
  }

  body[data-chef-shell="public"] button:not(.public-nav-toggle):not([aria-label^="Close"]),
  body[data-chef-shell="family"] button:not(.public-nav-toggle):not([aria-label^="Close"]) {
    min-height: 2.75rem;
    touch-action: manipulation;
  }

  .public-site-header.public-about-navigation .public-nav-brand {
    max-width: calc(100vw - 5.5rem) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .public-page-banner:not(.public-page-banner--home) {
    height: 20rem !important;
    min-height: 20rem !important;
    max-height: 20rem !important;
  }

  .public-page-banner:not(.public-page-banner--home) .public-page-banner__inner {
    width: 100% !important;
    padding: 1.5rem 1rem !important;
  }

  .public-page-banner h1,
  .public-page-banner__inner h1 {
    max-width: 100% !important;
    font-size: clamp(2rem, 10vw, 3rem) !important;
    line-height: 1.08 !important;
    overflow-wrap: anywhere;
  }

  .public-page-banner p,
  .public-page-banner__inner p {
    max-width: 34rem !important;
    font-size: 1rem !important;
    line-height: 1.55 !important;
  }

  body[data-chef-page="index"] .public-page-banner--home {
    min-height: 38rem !important;
    height: min(48rem, calc(100svh - 5rem)) !important;
    max-height: none !important;
  }

  body[data-chef-page="index"] .public-page-banner--home .public-page-banner__inner {
    width: 100% !important;
    padding-inline: 1rem !important;
  }

  body[data-chef-page="index"] #contact,
  body[data-chef-page="index"] #services,
  body[data-chef-page="index"] #gallery-preview {
    scroll-margin-top: 5rem;
  }

  body[data-chef-page="index"] .service-card {
    padding: 1.5rem !important;
  }

  body[data-chef-page="index"] .field-control {
    width: 100% !important;
  }

  body[data-chef-page="gallery"] figure img {
    height: auto !important;
    min-height: 15rem;
  }

  body[data-chef-page="menu"] main,
  body[data-chef-page="master-class"] main {
    overflow-x: clip;
  }

  body[data-chef-page="fams-recipes"] #publishedRecipeGrid,
  body[data-chef-page="fams-recipes"] #recipe-inputs-container,
  body[data-chef-page="fams-recipes"] #ingredient-rows {
    min-width: 0 !important;
  }

  body[data-chef-page="fams-recipes"] #publishedRecipeModal,
  body[data-chef-page="fams-recipes"] #custom-ing-modal,
  body[data-chef-page="fams-recipes"] #browse-ing-modal {
    padding: 0 !important;
    align-items: stretch !important;
  }

  body[data-chef-page="fams-recipes"] #publishedRecipeModal > div,
  body[data-chef-page="fams-recipes"] #custom-ing-modal-box,
  body[data-chef-page="fams-recipes"] #browse-ing-modal-box {
    width: 100% !important;
    max-width: none !important;
    max-height: 100dvh !important;
    min-height: 100dvh !important;
    margin: 0 !important;
    border-radius: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  body[data-chef-page="fams-recipes"] #publishedRecipePrintContent {
    padding: 1rem !important;
  }

  body[data-chef-page="fams-recipes"] table,
  body[data-chef-shell="family"] table {
    width: 100% !important;
  }

  body[data-chef-page="fams-recipes"] th,
  body[data-chef-page="fams-recipes"] td,
  body[data-chef-shell="family"] th,
  body[data-chef-shell="family"] td {
    overflow-wrap: anywhere;
  }

  /* Family portal and Family ingredient-search page */
  body[data-chef-shell="family"] section,
  body[data-chef-shell="family"] main {
    max-width: 100%;
  }

  body[data-chef-shell="family"] .family-tool-card {
    min-height: 0 !important;
    padding: 1.25rem !important;
  }

  body[data-chef-shell="family"] .family-tool-card h3 {
    font-size: 1.4rem !important;
    line-height: 1.2 !important;
  }

  body[data-chef-shell="family"] .family-recipe-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: .75rem !important;
    width: 100% !important;
  }

  body[data-chef-shell="family"] .family-recipe-actions > * {
    width: 100% !important;
  }

  body[data-chef-shell="family"] #recipe-card-export-area {
    width: 100% !important;
    overflow: hidden;
  }

  body[data-chef-shell="family"] #recipe-card-export-area .overflow-x-auto,
  body[data-chef-shell="family"] .overflow-x-auto {
    width: 100%;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  body[data-chef-shell="family"] #browse-recipe-modal {
    padding: 0 !important;
    align-items: stretch !important;
  }

  body[data-chef-shell="family"] #browse-recipe-modal-box {
    width: 100% !important;
    max-width: none !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    padding: 1rem !important;
    border-radius: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  body[data-chef-shell="family"] #recipe-list-container {
    grid-template-columns: 1fr !important;
  }

  body[data-chef-shell="family"] #resultsBody td,
  body[data-chef-shell="family"] #resultsBody th {
    white-space: normal !important;
  }

  body[data-chef-shell="family"] .tools-strip,
  body[data-chef-shell="family"] .family-tools-strip {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }
}

@media (min-width: 480px) and (max-width: 767px) {
  body[data-chef-shell="family"] .family-recipe-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 420px) {
  .public-site-header.public-about-navigation .public-nav-brand {
    font-size: 1.15rem !important;
  }

  .public-site-header.public-about-navigation .public-mobile-menu-inner {
    padding-inline: .75rem !important;
  }

  .public-page-banner:not(.public-page-banner--home) {
    height: 18.5rem !important;
    min-height: 18.5rem !important;
    max-height: 18.5rem !important;
  }
}

@media print {
  .public-nav-open {
    overflow: visible !important;
  }
}
