/* Dr. Norman P. Johnson v47.9 — proper split-screen and tablet layout.
   Loads AFTER 47.8; no database writes or changes to the public content. */

/* WordPress constrained wrappers should not create a phantom wide column. */
body .wp-site-blocks, body .dnj-homepage, body .dnj-interior-main,
body .dnj-homepage .wp-block-post-content,body .dnj-interior-main .wp-block-post-content {
  min-width:0; box-sizing:border-box;
}
body .wp-site-blocks :is(.dnj-hero,.dnj-book-showcase,.dnj-page-shell,.dnj-featured-promo) {
  box-sizing:border-box;
}

/* Split-screen laptop/browser windows and tablets need a true one-column
   composition, not the desktop design shrunk until content runs off-centre. */
@media (max-width:1120px) {
  /* Homepage hero: centered text, CTA buttons and portrait in one vertical flow. */
  body.home .dnj-hero {
    display:flex!important;flex-direction:column!important;align-items:center!important;
    justify-content:center!important;width:100%!important;max-width:100%!important;
    min-height:0!important;padding:clamp(108px,11vw,138px) clamp(20px,5vw,48px) 64px!important;
    text-align:center!important;
  }
  body.home .dnj-hero > .dnj-hero-content,
  body.home .dnj-hero .wp-block-columns:has(.dnj-responsive-home-title),
  body.home .dnj-homepage .wp-block-columns:has(.dnj-responsive-home-title) {
    box-sizing:border-box!important;width:min(100%,820px)!important;max-width:820px!important;
    margin-inline:auto!important;padding-inline:0!important;display:flex!important;
    flex-direction:column!important;justify-content:center!important;
    align-items:center!important;gap:clamp(20px,4vw,36px)!important;text-align:center!important;
  }
  body.home .dnj-hero .wp-block-columns:has(.dnj-responsive-home-title) > .wp-block-column,
  body.home .dnj-homepage .wp-block-columns:has(.dnj-responsive-home-title) > .wp-block-column {
    box-sizing:border-box!important;flex:0 1 auto!important;flex-basis:auto!important;
    width:100%!important;max-width:800px!important;min-width:0!important;
    margin-inline:auto!important;text-align:center!important;
  }
  body.home .dnj-hero .wp-block-columns:has(.dnj-responsive-home-title) :is(h1,h2,p),
  body.home .dnj-hero .dnj-hero-content :is(h1,h2,p),
  body.home .dnj-hero :is(.dnj-hero-eyebrow,.dnj-hero-description) {
    text-align:center!important;margin-inline:auto!important;
  }
  body.home .dnj-hero :is(.dnj-responsive-home-title,.dnj-hero-title) {
    width:100%!important;max-width:790px!important;margin-inline:auto!important;
    font-size:clamp(2rem,5.2vw,3.5rem)!important;line-height:1.14!important;
    text-align:center!important;white-space:normal!important;text-wrap:balance;
    overflow-wrap:normal!important;word-break:normal!important;hyphens:none!important;
  }
  body.home .dnj-hero .wp-block-buttons,
  body.home .dnj-hero .dnj-hero-buttons {
    display:flex!important;justify-content:center!important;align-items:center!important;
    flex-wrap:wrap!important;width:100%!important;max-width:780px!important;
    gap:14px!important;margin-inline:auto!important;
  }
  body.home .dnj-hero .wp-block-buttons .wp-block-button {
    flex:0 1 auto!important;max-width:100%!important;margin:0!important;
  }
  body.home .dnj-hero figure.wp-block-image {
    box-sizing:border-box!important;max-width:min(100%,360px)!important;width:fit-content!important;
    margin:8px auto 0!important;display:flex!important;justify-content:center!important;
  }
  body.home .dnj-hero figure.wp-block-image img,
  body.home .dnj-hero .wp-block-column img:not(.dnj-cosmic-network) {
    position:relative!important;display:block!important;width:auto!important;
    max-width:min(100%,360px)!important;height:auto!important;margin-inline:auto!important;
    object-fit:contain!important;
  }
  /* Featured book (as saved in the home page): title and copy centered under cover. */
  body.home .dnj-book-showcase {padding:clamp(44px,6vw,70px) clamp(20px,5vw,48px)!important;}
  body.home .dnj-book-showcase .dnj-book-showcase-columns {
    display:grid!important;grid-template-columns:minmax(0,1fr)!important;
    width:min(100%,790px)!important;max-width:790px!important;
    justify-items:center!important;align-items:center!important;gap:30px!important;
    margin:0 auto!important;
  }
  body.home .dnj-book-showcase .dnj-book-showcase-cover-column,
  body.home .dnj-book-showcase .dnj-book-showcase-info {
    box-sizing:border-box!important;width:100%!important;min-width:0!important;
    max-width:720px!important;margin-inline:auto!important;flex:initial!important;
  }
  body.home .dnj-book-showcase .dnj-book-showcase-image {
    width:min(100%,270px)!important;max-width:270px!important;margin-inline:auto!important;
  }
  body.home .dnj-book-showcase .dnj-book-showcase-info,
  body.home .dnj-book-showcase .dnj-book-showcase-info :is(h2,p) {
    text-align:center!important;
  }
  body.home .dnj-book-showcase .dnj-book-showcase-info :is(h2,p) {margin-inline:auto!important;}
  body.home .dnj-book-showcase .dnj-book-showcase-title{font-size:clamp(2rem,4.2vw,2.8rem)!important;}
  body.home .dnj-book-showcase .dnj-book-showcase-description{
    max-width:640px!important;line-height:1.7!important;
  }
  body.home .dnj-book-showcase .dnj-book-showcase-buttons,
  body.home .dnj-featured-promo .wp-block-buttons {
    justify-content:center!important;align-items:center!important;gap:12px!important;
  }
  /* Shared featured promo is another editable featured-book layout. */
  body.home .dnj-featured-promo .dnj-promo-columns {
    display:flex!important;flex-direction:column!important;align-items:center!important;
    justify-content:center!important;width:min(100%,780px)!important;max-width:780px!important;
    gap:24px!important;margin-inline:auto!important;
  }
  body.home .dnj-featured-promo .dnj-promo-columns > .wp-block-column {
    flex:0 1 auto!important;flex-basis:auto!important;width:100%!important;max-width:700px!important;
    min-width:0!important;text-align:center!important;margin-inline:auto!important;
  }
  body.home .dnj-featured-promo .dnj-promo-columns :is(h2,p) {text-align:center!important;margin-inline:auto!important;}
  body.home .dnj-featured-promo .dnj-promo-cover {margin-inline:auto!important;}
}

/* Narrow windows across all interior pages: readable centered content columns
   while preserving intentional desktop grid cards on full-width screens. */
@media (max-width:1120px) {
  body .dnj-page-shell {
    width:100%!important;max-width:100%!important;min-width:0!important;
    padding-left:clamp(20px,5vw,52px)!important;
    padding-right:clamp(20px,5vw,52px)!important;
    box-sizing:border-box!important;
  }
  body .dnj-page-shell > :is(.wp-block-group,.wp-block-columns,.wp-block-embed) {
    box-sizing:border-box!important;max-width:min(100%,850px)!important;
    margin-left:auto!important;margin-right:auto!important;
  }
  body .dnj-page-shell > .wp-block-columns:not(.dnj-grid) {
    display:flex!important;flex-direction:column!important;align-items:center!important;
    justify-content:center!important;gap:28px!important;
  }
  body .dnj-page-shell > .wp-block-columns:not(.dnj-grid) > .wp-block-column {
    box-sizing:border-box!important;width:100%!important;max-width:800px!important;
    flex:0 1 auto!important;flex-basis:auto!important;min-width:0!important;
    margin-inline:auto!important;
  }
  body .dnj-page-shell > .wp-block-columns:not(.dnj-grid) figure.wp-block-image {
    margin-inline:auto!important;max-width:100%!important;text-align:center!important;
  }
  body .dnj-page-shell > .wp-block-columns:not(.dnj-grid) figure.wp-block-image img {
    margin-inline:auto!important;max-width:100%!important;height:auto!important;
  }
}

/* TV/Films landing page: an editorial, centered project listing at split width.
   The class is attached only if WordPress says this is the tv-films page. */
@media (max-width:1120px) {
  body.dnj-tv-films-index .dnj-page-shell {text-align:center!important;}
  body.dnj-tv-films-index .dnj-page-shell > :is(h1,h2,h3,p,figure),
  body.dnj-tv-films-index .dnj-page-shell :is(.dnj-eyebrow,h1,h2,h3) {
    max-width:850px!important;text-align:center!important;margin-left:auto!important;margin-right:auto!important;
  }
  body.dnj-tv-films-index .dnj-page-shell p {
    max-width:790px!important;margin-left:auto!important;margin-right:auto!important;
    text-align:center!important;line-height:1.7!important;
  }
  body.dnj-tv-films-index .dnj-page-shell .wp-block-columns:not(.dnj-grid) {
    display:flex!important;flex-direction:column!important;align-items:center!important;
    justify-content:center!important;width:min(100%,840px)!important;
    max-width:840px!important;gap:20px!important;margin:28px auto 48px!important;
  }
  body.dnj-tv-films-index .dnj-page-shell .wp-block-columns:not(.dnj-grid) > .wp-block-column {
    box-sizing:border-box!important;width:100%!important;max-width:820px!important;
    flex:0 1 auto!important;flex-basis:auto!important;
    min-width:0!important;margin-inline:auto!important;text-align:center!important;
  }
  body.dnj-tv-films-index .dnj-page-shell figure.wp-block-image {
    box-sizing:border-box!important;width:fit-content!important;
    max-width:min(100%,390px)!important;margin:0 auto 24px!important;
    text-align:center!important;
  }
  body.dnj-tv-films-index .dnj-page-shell figure.wp-block-image img,
  body.dnj-tv-films-index .dnj-page-shell img.dnj-koko-cover,
  body.dnj-tv-films-index .dnj-page-shell img.dnj-cul-poster,
  body.dnj-tv-films-index .dnj-page-shell img.dnj-leilani-poster {
    display:block!important;max-width:min(100%,350px)!important;width:auto!important;
    height:auto!important;margin:0 auto!important;object-fit:contain!important;
  }
  body.dnj-tv-films-index .dnj-page-shell .wp-block-buttons {
    display:flex!important;justify-content:center!important;align-items:center!important;
    flex-wrap:wrap!important;gap:12px!important;width:100%!important;
    margin:24px auto 32px!important;
  }
  body.dnj-tv-films-index .dnj-page-shell .wp-block-button {
    margin:0!important;max-width:100%!important;
  }
  /* Some older film entries are HTML, rather than native Columns blocks. */
  body.dnj-tv-films-index .dnj-v10-project,
  body.dnj-tv-films-index .dnj-v10-project-grid {
    box-sizing:border-box!important;width:min(100%,820px)!important;max-width:820px!important;
    margin-inline:auto!important;text-align:center!important;
  }
  body.dnj-tv-films-index .dnj-v10-project-grid {
    display:grid!important;grid-template-columns:minmax(0,1fr)!important;
    justify-items:center!important;align-items:center!important;gap:24px!important;
  }
  body.dnj-tv-films-index .dnj-v10-project-grid > div {min-width:0!important;width:100%!important;max-width:760px!important;}
  body.dnj-tv-films-index .dnj-v10-project-grid > img {display:block!important;max-width:min(100%,350px)!important;margin-inline:auto!important;}
}

/* At genuinely small widths, avoid too-wide headings and side-by-side CTAs. */
@media(max-width:600px) {
  body.home .dnj-hero {padding:108px 18px 48px!important;}
  body.home .dnj-hero :is(.dnj-responsive-home-title,.dnj-hero-title) {
    font-size:clamp(1.85rem,7.4vw,2.5rem)!important;
    line-height:1.14!important;
  }
  body.home .dnj-hero .wp-block-buttons {flex-direction:column!important;gap:12px!important;}
  body.home .dnj-hero .wp-block-buttons .wp-block-button {width:min(100%,310px)!important;}
  body.home .dnj-hero .wp-block-buttons .wp-block-button__link {
    display:block!important;box-sizing:border-box!important;width:100%!important;
    text-align:center!important;
  }
  body.home .dnj-hero figure.wp-block-image {max-width:min(100%,300px)!important;}
  body.home .dnj-book-showcase {padding:44px 22px!important;}
  body.home .dnj-book-showcase .dnj-book-showcase-description {
    font-size:1rem!important;line-height:1.65!important;
  }
  body.home .dnj-book-showcase .dnj-book-showcase-buttons {
    display:flex!important;flex-direction:column!important;align-items:center!important;
  }
  body.home .dnj-book-showcase .dnj-book-showcase-buttons .wp-block-button {
    width:min(100%,300px)!important;margin:0!important;
  }
  body.home .dnj-book-showcase .dnj-book-showcase-buttons .wp-block-button__link {
    display:block!important;box-sizing:border-box!important;width:100%!important;text-align:center!important;
  }
  body.dnj-tv-films-index .dnj-page-shell {padding-inline:20px!important;}
  body.dnj-tv-films-index .dnj-page-shell .wp-block-button__link {max-width:100%!important;}
}

/* Specificity override: historical film-repair-v12 sets poster rows to a
   two-column grid, even after Gutenberg's own columns become vertical. */
@media (max-width:1120px) {
  body.page.dnj-tv-films-index .wp-block-post-content .dnj-page-shell .wp-block-columns:not(.dnj-grid) {
    display:grid!important;grid-template-columns:minmax(0,1fr)!important;
    justify-items:center!important;align-items:center!important;gap:20px!important;
  }
  body.page.dnj-tv-films-index .wp-block-post-content .dnj-page-shell .wp-block-columns:not(.dnj-grid) > .wp-block-column {
    width:100%!important;min-width:0!important;max-width:800px!important;
    flex:initial!important;flex-basis:auto!important;text-align:center!important;
    margin:0 auto!important;
  }
  body.page.dnj-tv-films-index .wp-block-post-content .dnj-page-shell .wp-block-columns:not(.dnj-grid) figure.wp-block-image {
    display:block!important;margin:0 auto!important;max-width:min(100%,360px)!important;
  }
}
