/* ChickenJournal mobile-only responsiveness patch — Nov 2026.
 * Preserves Astra desktop grid, Mediavine/Grow ad containers, WP widgets,
 * Gutenberg post data, Pinterest buttons and six-hour homepage rotation.
 * No generic overflow:hidden or changes to fixed ad/share controls.
 */
@media (max-width: 767px) {
  /* Keep content inside narrow viewports without cropping ads or overlays. */
  body .site-content, body .site-content #primary,
  body .site-content .site-main, body .entry-content { min-width: 0; }
  body :is(.entry-content, .entry-summary) { overflow-wrap: break-word; }
  body :is(.entry-content, .entry-summary) :is(img,video,svg) {
    max-width: 100%;
  }
  body .entry-content .wp-block-table {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  body .entry-content .wp-block-table table { min-width: max-content; }
  body .entry-content .wp-block-embed,
  body .entry-content .wp-block-embed__wrapper,
  body .entry-content .wp-block-video { max-width: 100%; }

  /* Homepage: shorten its above-the-fold content, without changing desktop. */
  body.home .entry-content > .cj-home-hero {
    box-sizing: border-box;
    max-width: 100% !important;
    padding: 24px 19px 30px !important;
    margin-bottom: 38px !important;
  }
  body.home .cj-home-hero h1 {
    max-width: none !important;
    font-size: clamp(34px,8.5vw,40px) !important;
    letter-spacing: -.035em;
    line-height: 1.12;
    margin: 14px 0 16px;
    overflow-wrap: normal;
  }
  body.home .cj-home-hero .cj-home-eyebrow {
    font-size: 10px !important;
    letter-spacing: .12em;
    line-height: 1.45;
  }
  body.home .cj-home-hero .cj-home-intro {
    font-size: 16px !important;
    line-height: 1.58;
    margin: 0 0 17px;
  }
  body.home .cj-home-hero .wp-block-buttons {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center;
    justify-content: flex-start;
    gap: 10px 16px !important;
    margin: 18px 0 !important;
  }
  body.home .cj-home-hero .wp-block-button {
    flex: 0 1 auto;
    width: auto;
    margin: 0 !important;
  }
  body.home .cj-home-hero .wp-block-button__link {
    display: inline-flex;
    align-items: center;
    padding: 12px 17px !important;
    min-height: 44px;
    font-size: 14px !important;
    line-height: 1.3;
    white-space: normal;
  }
  body.home .cj-home-hero .wp-block-button:nth-child(2) .wp-block-button__link {
    padding: 10px 2px !important;
  }
  body.home .cj-home-hero .cj-home-hero-kicker {
    font-size: 11px !important;
    letter-spacing: .025em;
    line-height: 1.65;
    margin: 16px 0 0 !important;
  }
  body.home .cj-home-hero .wp-block-columns {
    gap: 22px !important;
    margin: 0;
  }
  body.home .cj-home-hero .wp-block-columns > .wp-block-column {
    min-width: 0 !important;
    width: 100% !important;
    flex-basis: 100% !important;
  }
  body.home .cj-home-hero figure.wp-block-image {
    width: 100% !important;
    max-width: 100% !important;
    aspect-ratio: auto !important;
    height: auto !important;
    border-radius: 16px !important;
  }
  body.home .cj-home-hero figure.wp-block-image > a,
  body.home .cj-home-hero figure.wp-block-image img {
    aspect-ratio: auto !important;
    height: auto !important;
    border-radius: 16px !important;
    object-fit: initial !important;
  }
  body.home .cj-home-hero .cj-home-spotlight {
    width: 100% !important;
    max-width: 100% !important;
    margin: 12px auto 0 !important;
  }
  body.home .cj-home-hero .cj-home-spotlight-link {
    font-size: 17px !important;
    line-height: 1.38;
  }

  /* Common mobile content grid shared by all homepage sections. */
  body.home .entry-content > :is(.cj-home-topics,.cj-home-latest,.cj-home-guides,.cj-home-search-panel) {
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  body.home .entry-content :is(.cj-home-topics,.cj-home-latest,.cj-home-guides,.cj-home-search-panel) h2 {
    font-size: clamp(26px,7.2vw,34px) !important;
    line-height: 1.18;
    overflow-wrap: break-word;
  }
  body.home .cj-topic-grid > .wp-block-column { min-width: 0; }
  body.home .cj-home-latest .wp-block-post-template {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) !important;
    gap: 17px !important;
    width: 100%;
  }
  body.home .cj-home-latest .wp-block-post-template > li {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* The current top-level two-column guides area pinches post cards to
   * ~half-width on phones. Stack its two editor columns first. */
  body.home .cj-home-guides {
    padding: 27px 16px !important;
    border-radius: 20px !important;
  }
  body.home .cj-home-guides > .wp-block-columns {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) !important;
    gap: 28px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }
  body.home .cj-home-guides > .wp-block-columns > .wp-block-column {
    box-sizing: border-box;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    flex-basis: auto !important;
    margin: 0 !important;
  }
  body.home .cj-home-guides .wp-block-query,
  body.home .cj-home-guides .wp-block-post-template,
  body.home .cj-home-guides .wp-block-post-template > li,
  body.home .cj-home-guides .wp-block-post-template > li > .wp-block-group {
    box-sizing: border-box;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  body.home .cj-home-guides .wp-block-post-template {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) !important;
    gap: 14px !important;
    padding: 0 !important;
  }
  body.home .cj-home-guides .wp-block-post-template > li > .wp-block-group {
    padding: 12px !important;
    border-radius: 14px !important;
    background: #fffefa !important;
  }
  body.home .cj-home-guides .wp-block-post-template .wp-block-columns {
    display: grid !important;
    grid-template-columns: minmax(0,96px) minmax(0,1fr) !important;
    gap: 12px !important;
    align-items: center;
    width: 100% !important;
    margin: 0 !important;
  }
  body.home .cj-home-guides .wp-block-post-template .wp-block-columns > .wp-block-column {
    box-sizing: border-box;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    flex-basis: auto !important;
    margin: 0 !important;
  }
  body.home .cj-home-guides .wp-block-post-featured-image {
    margin: 0 !important;
    width: 100%;
    overflow: hidden;
    border-radius: 10px;
  }
  body.home .cj-home-guides .wp-block-post-featured-image img {
    display: block;
    width: 100% !important;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
  }
  body.home .cj-home-guides .wp-block-post-title {
    font-size: 17px !important;
    line-height: 1.32 !important;
    overflow-wrap: break-word;
    margin: 0;
  }
  body.home .cj-home-guides .wp-block-post-title a {
    color: var(--cj-forest) !important;
    text-decoration: none !important;
    overflow-wrap: break-word;
  }

  /* Search: no off-screen input or button and no narrow side column. */
  body.home .cj-home-search-panel { padding: 28px 18px !important; }
  body.home .cj-home-search-panel > .wp-block-columns {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) !important;
    gap: 18px !important;
    margin: 0 !important;
  }
  body.home .cj-home-search-panel > .wp-block-columns > .wp-block-column {
    min-width: 0 !important;
    width: 100% !important;
    flex-basis: auto !important;
  }
  body.home .cj-home-search-panel .wp-block-search,
  body.home .cj-home-search-panel .wp-block-search__inside-wrapper {
    box-sizing: border-box;
    max-width: 100%;
    width: 100%;
  }
  body.home .cj-home-search-panel .wp-block-search__inside-wrapper {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }
  body.home .cj-home-search-panel .wp-block-search__input {
    flex: 1 1 100% !important;
    min-width: 0 !important;
    width: 100% !important;
    margin: 0 !important;
  }
  body.home .cj-home-search-panel .wp-block-search__button {
    flex: 0 1 auto !important;
    margin: 0 !important;
    min-height: 44px;
    padding: 12px 20px;
  }

  /* Footer: Astra already stacks, but its content was too loose and
   * the disclaimer widgets need predictable centered one-column widths. */
  body .site-footer .site-above-footer-wrap .ast-builder-grid-row {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) !important;
    justify-items: center;
    align-items: start;
    row-gap: 24px;
  }
  body .site-footer .site-above-footer-wrap :is(.site-footer-section,.footer-widget-area,.widget_block) {
    box-sizing: border-box;
    min-width: 0;
    width: 100% !important;
    max-width: 520px;
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center;
  }
  body .site-footer .site-above-footer-wrap .wp-block-group {
    box-sizing: border-box;
    max-width: 100% !important;
    width: 100%;
    margin-left: auto !important;
    margin-right: auto !important;
  }
  body .site-footer .site-above-footer-wrap .widget_block h3 {
    font-size: 21px !important;
    line-height: 1.28 !important;
    margin: 0 0 12px !important;
    text-align: center;
  }
  body .site-footer .site-above-footer-wrap .widget_block p {
    font-size: 14px !important;
    line-height: 1.65 !important;
    max-width: 42ch;
    margin: 0 auto !important;
    text-align: center;
    overflow-wrap: break-word;
  }
  body .site-footer .site-primary-footer-wrap .footer-nav-wrap {
    width: 100%;
    text-align: center;
  }
  body .site-footer .site-primary-footer-wrap .menu-item a {
    line-height: 1.55;
    padding-top: 4px;
    padding-bottom: 4px;
  }
  body .site-footer .ast-footer-copyright {
    font-size: 14px !important;
    line-height: 1.55;
    text-align: center;
    overflow-wrap: break-word;
  }
}

/* Very narrow phones: avoid a two-column teaser cramming at 320px. */
@media (max-width: 360px) {
  body.home .cj-home-guides .wp-block-post-template .wp-block-columns {
    grid-template-columns: minmax(0,82px) minmax(0,1fr) !important;
    gap: 10px !important;
  }
  body.home .cj-home-guides .wp-block-post-title {
    font-size: 16px !important;
  }
  body.home .cj-home-hero figure.wp-block-image { width: 100% !important; max-width: 100% !important; }
}

/* Compact tablets keep the existing Astra desktop/sidebar breakpoints but
 * prevent the homepage's two-column guides from becoming cramped. */
@media (min-width: 768px) and (max-width: 1023px) {
  body.home .cj-home-guides > .wp-block-columns {
    gap: 22px;
  }
  body.home .cj-home-guides .wp-block-post-title {
    font-size: 17px !important;
    line-height: 1.34 !important;
  }
}
