/* ProSol editorial spreads — one grid and one typographic scale for all 3 pages.
   The phone reader (<=767px) and React/page-turn code are deliberately untouched. */

@media (min-width: 768px) {
  .magazine:not(.narrow) :is(.feature, .venues, .model) .spread-grid {
    --editorial-title: clamp(20px, 1.9vw, 35px);
    --editorial-type: clamp(18px, .75vw + 10.5px, 22px);
    --editorial-leading: 1.43;
    box-sizing: border-box !important;
    position: relative !important;
    display: grid !important;
    width: 100% !important;
    min-height: 0 !important;
    gap: 0 !important;
    overflow: visible !important;
  }

  /* Identical headline, always independent of the article column. */
  .magazine:not(.narrow) :is(.feature, .venues, .model) .article-header {
    position: absolute !important;
    inset: clamp(20px, 2.6vh + 8px, 40px) 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
  }
  .magazine:not(.narrow) :is(.feature, .venues, .model) .headline {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: max-content !important;
    max-width: 92% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
  }
  .magazine:not(.narrow) :is(.feature, .venues, .model) .headline img {
    display: block !important;
    width: auto !important;
    height: var(--editorial-title) !important;
    max-width: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    transform: none !important;
  }
  .magazine:not(.narrow) :is(.feature, .venues, .model) .header-rule {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    height: 1px !important;
    margin-top: 4px !important;
  }
  .magazine:not(.narrow) .model .model-column:nth-child(2) > .article-header {
    display: none !important;
  }

  /* Shared editorial text rhythm and content (no per-page width overrides). */
  .magazine:not(.narrow) :is(.feature, .venues, .model)
    :is(.feature-copy, .venue-copy, .model-story-column) {
    box-sizing: border-box !important;
    position: static !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    align-self: center !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    text-align: left !important;
  }
  .magazine:not(.narrow) .model .model-story-column > .model-column {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .magazine:not(.narrow) :is(.feature, .venues, .model)
    :is(.feature-questions, .feature-body, .venue-copy > .copy, .model-copy) {
    box-sizing: border-box !important;
    position: static !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: var(--editorial-type) !important;
    line-height: var(--editorial-leading) !important;
    letter-spacing: normal !important;
    text-align: left !important;
  }
  .magazine:not(.narrow) .feature .feature-questions p,
  .magazine:not(.narrow) :is(.feature, .venues, .model) :is(.copy, .model-copy) p {
    margin: 0 !important;
    padding: 0 !important;
    font: inherit !important;
    line-height: inherit !important;
  }
  /* This margin is on the questions, not the body, to avoid legacy overrides. */
  .magazine:not(.narrow) .feature .feature-copy .feature-questions {
    margin-bottom: clamp(24px, 3vh, 38px) !important;
    /* 1.5 × the original 1.95em question indent, across all viewport bands. */
    padding-left: 2.925em !important;
  }
  .magazine:not(.narrow) :is(.feature, .venues, .model) :is(.copy, .model-copy) p + p,
  .magazine:not(.narrow) .model .model-column + .model-column {
    margin-top: 1.2em !important;
  }

  /* Model: flatten only the artwork wrapper so the address can share the text grid. */
  .magazine:not(.narrow) .model .model-art-column {
    display: contents !important;
  }
  .magazine:not(.narrow) .model .model-economics,
  .magazine:not(.narrow) .feature .feature-photo {
    position: static !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: stretch !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    translate: none !important;
    transform: none !important;
  }
  .magazine:not(.narrow) .feature .feature-photo figure,
  .magazine:not(.narrow) .model .model-economics-frame {
    position: relative !important;
    display: block !important;
    width: min(84%, 68vh) !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    translate: none !important;
    transform: none !important;
  }
  .magazine:not(.narrow) .feature .feature-photo figure { aspect-ratio: 520 / 345 !important; }
  .magazine:not(.narrow) .model .model-economics-frame {
    aspect-ratio: 1202 / 869 !important;
    overflow: hidden !important;
  }
  .magazine:not(.narrow) .feature .feature-photo figure img,
  .magazine:not(.narrow) .venues .venue-photos figure img,
  .magazine:not(.narrow) .model .model-economics-frame img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }
  .magazine:not(.narrow) .model .model-economics-frame img { object-fit: contain !important; }

  /* One compact contact component below the photo, on the image side. */
  .magazine:not(.narrow) .feature .feature-contact,
  .magazine:not(.narrow) .model .model-contact {
    position: static !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    align-self: stretch !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    transform: none !important;
  }
  .magazine:not(.narrow) .feature .feature-contact .model-contact {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    margin: 0 !important;
  }
  .magazine:not(.narrow) :is(.feature, .model) .model-contact {
    gap: .22em !important;
    font-size: clamp(21px, 2.15vw, 36px) !important;
    line-height: 1.15 !important;
    text-align: center !important;
  }
  .magazine:not(.narrow) :is(.feature, .model) .model-contact span {
    width: 100% !important;
    text-align: center !important;
    margin: 0 !important;
    padding: 0 !important;
    font: inherit !important;
    line-height: inherit !important;
  }

  .magazine:not(.narrow) .venues .venue-photos {
    position: static !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: stretch !important;
    gap: clamp(12px, 2vh, 25px) !important;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .magazine:not(.narrow) .venues .venue-photos figure,
  .magazine:not(.narrow) .venues .venue-photos figure:nth-child(2) {
    position: relative !important;
    display: block !important;
    flex: none !important;
    align-self: center !important;
    width: min(80%, 51vh) !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: 1.58 !important;
    margin: 0 !important;
    padding: 0 !important;
    translate: none !important;
    transform: none !important;
  }
}

/* Wide spreads: same two columns and text rhythm on all three pages.
   Contact is visually grouped with the photograph, never with the article. */
@media (min-width: 1400px) {
  .magazine:not(.narrow) :is(.feature, .venues, .model) .spread-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: minmax(0, 1fr) auto auto minmax(0, 1fr) !important;
    height: 92vh !important;
    padding: clamp(108px, 13vh, 152px) 0 clamp(30px, 4vh, 58px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }
  /* Copy gets the entire left half, and centers within its vertical reading area. */
  .magazine:not(.narrow) :is(.feature, .model)
    :is(.feature-copy, .model-story-column) {
    grid-area: 1 / 1 / -1 / 2 !important;
    justify-content: safe center !important;
    margin-left: 12% !important;
    margin-right: 4% !important;
  }
  .magazine:not(.narrow) .venues .venue-copy {
    grid-area: 1 / 2 / -1 / 3 !important;
    align-self: start !important;
    justify-content: flex-start !important;
    margin-left: 4% !important;
    margin-right: 12% !important;
  }
  .magazine:not(.narrow) .feature .feature-photo,
  .magazine:not(.narrow) .model .model-economics {
    grid-area: 2 / 2 !important;
    height: auto !important;
    align-self: end !important;
  }
  .magazine:not(.narrow) .feature .feature-contact,
  .magazine:not(.narrow) .model .model-art-column > .model-contact {
    grid-area: 3 / 2 !important;
    align-self: start !important;
    justify-content: flex-start !important;
    margin: clamp(28px, 4vh, 46px) 0 0 !important;
  }
  .magazine:not(.narrow) .venues .venue-photos {
    grid-area: 1 / 1 / -1 / 2 !important;
  }
  /* Photo + contact form one balanced group; the media remain inside their half. */
  .magazine:not(.narrow) .feature .feature-photo figure,
  .magazine:not(.narrow) .model .model-economics-frame {
    width: min(88%, 66vh) !important;
  }
}

/* Compact two-page spread: reduced type fits the article without crowding media. */
@media (min-width: 1400px) and (max-width: 1599px) {
  .magazine:not(.narrow) :is(.feature, .venues, .model) .spread-grid {
    --editorial-type: clamp(17px, 1.75vw, 19px);
    --editorial-leading: 1.37;
    padding-top: clamp(102px, 11.5vh, 120px) !important;
  }
  .magazine:not(.narrow) :is(.feature, .model) .model-contact {
    font-size: clamp(19px, 2.2vw, 26px) !important;
  }
}

/* Narrow tablet: text flows first, then centered photo, then its caption/contact.
   It is deliberately a readable scrolling composition, not a squeezed spread. */
@media (min-width: 768px) and (max-width: 1399px) {
  .magazine:not(.narrow) :is(.feature, .venues, .model) .spread-grid {
    --editorial-title: clamp(20px, 2.3vw, 28px);
    --editorial-type: clamp(18px, 2.15vw, 20px);
    --editorial-leading: 1.43;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: repeat(3, max-content) !important;
    gap: clamp(22px, 3vh, 34px) !important;
    height: 92vh !important;
    padding: clamp(98px, 11vh, 118px) 5% 45px !important;
    align-content: start !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }
  .magazine:not(.narrow) :is(.feature, .venues, .model)
    :is(.feature-copy, .venue-copy, .model-story-column) {
    grid-area: 1 / 1 !important;
    align-self: start !important;
    margin: 0 !important;
  }
  .magazine:not(.narrow) .feature .feature-copy .feature-questions {
    margin-bottom: clamp(26px, 3vh, 36px) !important;
  }
  .magazine:not(.narrow) .feature .feature-photo,
  .magazine:not(.narrow) .model .model-economics {
    grid-area: 2 / 1 !important;
    height: auto !important;
  }
  .magazine:not(.narrow) .feature .feature-photo figure,
  .magazine:not(.narrow) .model .model-economics-frame {
    width: min(86%, 620px) !important;
  }
  .magazine:not(.narrow) .feature .feature-contact,
  .magazine:not(.narrow) .model .model-art-column > .model-contact {
    grid-area: 3 / 1 !important;
    align-self: start !important;
    margin: 0 !important;
  }
  .magazine:not(.narrow) .venues .venue-photos {
    grid-area: 2 / 1 !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    column-gap: 4% !important;
    height: auto !important;
  }
  .magazine:not(.narrow) .venues .venue-photos figure,
  .magazine:not(.narrow) .venues .venue-photos figure:nth-child(2) {
    width: 100% !important;
    grid-row: 1 !important;
  }
  .magazine:not(.narrow) .venues .venue-photos figure:first-child { grid-column: 1 !important; }
  .magazine:not(.narrow) .venues .venue-photos figure:nth-child(2) { grid-column: 2 !important; }
}

@media (min-width: 1400px) and (max-height: 760px) {
  .magazine:not(.narrow) :is(.feature, .venues, .model) .spread-grid {
    --editorial-type: clamp(15px, min(.8vw + 6px, 2.3vh), 18px);
    --editorial-leading: 1.38;
  }
  .magazine:not(.narrow) :is(.feature, .model) .model-contact {
    font-size: clamp(18px, 1.9vw, 29px) !important;
  }
}

/* The Grape / The Roof: restore alternating photo placement without crossing
   the left-hand column boundary. Narrow tablet retains its paired photo row. */
@media (min-width: 1400px) {
  .magazine:not(.narrow) .venues .venue-photos figure:first-child {
    translate: calc(-1 * clamp(16px, 3vw, 56px)) 0 !important;
  }
  .magazine:not(.narrow) .venues .venue-photos figure:nth-child(2) {
    translate: clamp(16px, 3vw, 56px) 0 !important;
  }
}

/* All reader sizes, including mobile: questions are indented 1.5 times
   their original 1.95em inset. The paragraphs following stay unindented. */
.mobile-page .feature-questions,
.magazine.narrow .feature-questions {
  padding-left: 2.925em !important;
}

/* Align Traditionally with Flooded and 64% despite legacy model margins. */
.magazine:not(.narrow) .model .model-story-column > .model-column:first-child .model-copy {
  margin-top: 0 !important;
}
/* Newspaper copy; final lines and questions are not stretched. */
:is(.magazine, .mobile-page) :is(.feature-body, .venue-copy > .copy, .model-copy) p {
  text-align: justify !important;
  text-align-last: left !important;
  hyphens: auto;
}
/* Obsolete print-only continuation marker (also removed from the DOM). */
:is(.magazine, .mobile-page) .feature-body p:last-child em:last-child {
  display: none !important;
}
/* Scrollable editorial pages at shorter window heights. */
@media (min-width: 768px) {
  .magazine:not(.narrow) :is(.feature, .venues, .model) .spread-grid {
    overscroll-behavior-y: contain;
    touch-action: pan-y;
  }
}

/* The magazine's trackpad/page-turn code checks .article-content for scrolling.
 * Let content overflow the inner grid into that existing scroll container.
 * Keep the grid's original height and alignment completely unchanged. */
@media (min-width: 768px) {
  .magazine:not(.narrow) .slide:is(.feature, .venues, .model) > .article-content {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
  }
  .magazine:not(.narrow) .slide:is(.feature, .venues, .model) .spread-grid {
    overflow: visible !important;
  }
}

/* Extra room after the last paragraph/photo/contact when scrolling a spread.
   The page-turn handler owns .article-content scrolling, not .spread-grid. */
@media (min-width: 768px) {
  .magazine:not(.narrow) .slide:is(.feature, .venues, .model) > .article-content {
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }
  .magazine:not(.narrow) .slide:is(.feature, .venues, .model) .spread-grid {
    /* Match the former 92vh layout until the content needs more height. */
    height: auto !important;
    min-height: 92vh !important;
    overflow: visible !important;
  }
  .magazine:not(.narrow) .slide:is(.feature, .venues, .model) > .article-content::after {
    content: "";
    display: block;
    height: clamp(56px, 7.5vh, 96px);
    width: 100%;
    pointer-events: none;
  }
}
