/* Dealsmaster v5.4.3 — layout and interaction repair.
 *
 * This final cascade layer repairs concrete regressions found in live desktop
 * and mobile QA without changing article copy, URLs, or editorial atmospheres.
 */

/* Supporting stories inherited an older two-column card recipe. At the new
 * magazine widths that recipe clipped the title and excerpt out of view. */
.dm-human-warmth .dm-desk-story--brief {
  display: flex !important;
  flex-direction: column;
}

.dm-human-warmth .dm-desk-story__media {
  overflow: hidden;
}

.dm-human-warmth .dm-desk-story--brief .dm-desk-story__media {
  width: 100%;
  min-height: 0 !important;
  flex: 0 0 auto;
  aspect-ratio: 16 / 9;
}

.dm-human-warmth .dm-desk-story__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dm-human-warmth .dm-desk-story__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.dm-human-warmth .dm-desk-story__read {
  margin-top: auto;
}

@media (min-width: 901px) {
  .dm-human-warmth .dm-desk-story--lead {
    display: grid !important;
    grid-template-rows: minmax(520px, 1fr) auto;
  }

  .dm-human-warmth .dm-desk-story--lead .dm-desk-story__media {
    min-height: 0;
  }
}

@media (min-width: 783px) and (max-width: 900px) {
  .dm-human-warmth .dm-desk-story--lead {
    display: grid !important;
    grid-template-columns: minmax(0, 1.25fr) minmax(240px, .75fr);
    grid-template-rows: 1fr;
  }

  .dm-human-warmth .dm-desk-story--lead .dm-desk-story__media {
    min-height: 430px;
  }
}

/* Field-note markup carries a number, title, and explanation. Give each one an
 * explicit grid cell so no browser can place the title and copy together. */
.dm-human-warmth .dm-field-note-card figure {
  height: 100%;
}

.dm-human-warmth .dm-field-note-card figcaption {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: .42rem .9rem;
  align-content: start;
  padding: 1rem 1rem 1.2rem;
}

.dm-human-warmth .dm-field-note-card figcaption > span {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: start;
  padding-top: .15rem;
}

.dm-human-warmth .dm-field-note-card figcaption > strong {
  display: block;
  grid-column: 2;
  grid-row: 1;
}

.dm-human-warmth .dm-field-note-card figcaption > p {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
}

/* The useful edit inherited white-on-dark atmosphere colours even though its
 * new surface is cream. Pin every reader-facing role to the correct surface. */
.dm-human-warmth .dm-useful-edit,
.dm-human-warmth .dm-useful-edit .dm-useful-intro {
  color: #211d18 !important;
}

.dm-human-warmth .dm-useful-edit .dm-useful-intro h2,
.dm-human-warmth .dm-useful-edit .dm-edit-list strong {
  color: #211d18 !important;
}

.dm-human-warmth .dm-useful-edit .dm-useful-intro > p:not(.dm-kicker),
.dm-human-warmth .dm-useful-edit .dm-edit-list p {
  color: #5c5148 !important;
}

.dm-human-warmth .dm-useful-edit .dm-kicker,
.dm-human-warmth .dm-useful-edit .dm-edit-list > li > span {
  color: #8a4334 !important;
}

.dm-human-warmth .dm-useful-edit .dm-useful-actions a {
  color: #244a3d !important;
}

/* Ten-guide author marks are DIVs in the published markup. A broad historic
 * child-DIV rule put both the mark and copy in column two, causing overlap. */
.dmtp-voice-card > .dmtp-voice-card__mark {
  grid-column: 1 !important;
  grid-row: 1 !important;
}

.dmtp-voice-card > div:not(.dmtp-voice-card__mark) {
  min-width: 0;
  grid-column: 2 !important;
  grid-row: 1 !important;
}

@media (min-width: 901px) and (max-width: 1100px) {
  .dm-alive-hero__detail--keys {
    grid-column: 7 / span 3;
  }
}

@media (max-width: 960px) {
  /* Below the sticky-sidebar breakpoint, the contents list is a real native
   * disclosure. Its summary stays visible while its long list may be closed. */
  body .dm-guide-experience .dm-guide-nav:not([open]) > :not(summary) {
    display: none !important;
  }
}

@media (max-width: 782px) {
  /* Keep the compact icon state, but let an opened search occupy the row. */
  .dm-human-warmth.home .dm-site-header .dm-header-search.is-open,
  .dm-human-warmth .dm-site-header .dm-header-search.is-open {
    right: 0;
    left: 0;
    width: auto !important;
    max-width: none;
  }

  .dm-human-warmth .dm-site-header .dm-header-search.is-open .wp-block-search__inside-wrapper,
  .dm-human-warmth .dm-site-header .dm-header-search.is-open .wp-block-search__input {
    width: 100% !important;
  }

  /* WordPress exposes the full navigation from 600px while the theme keeps the
   * menu trigger through 782px. Show only the trigger until the dialog opens. */
  .dm-human-warmth .dm-site-header .wp-block-navigation__responsive-container:not(.is-menu-open) {
    display: none !important;
  }

  .dm-human-warmth .dm-site-header .wp-block-navigation__responsive-container.is-menu-open {
    display: flex !important;
  }

  .dm-human-warmth .dm-desk-stream__grid {
    width: 100%;
    align-items: flex-start;
    margin-right: 0;
    padding-right: 1rem;
    scroll-padding-inline: 0 1rem;
  }

  .dm-human-warmth .dm-desk-story,
  .dm-human-warmth .dm-desk-story--lead,
  .dm-human-warmth .dm-desk-story--brief {
    display: flex !important;
    height: auto;
    flex-direction: column;
    align-self: flex-start;
  }

  .dm-human-warmth .dm-desk-story--lead .dm-desk-story__media {
    min-height: 0;
    aspect-ratio: 4 / 3;
  }

  .dm-human-warmth .dm-desk-story--brief .dm-desk-story__media {
    aspect-ratio: 4 / 3;
  }

  .dm-human-warmth .dm-field-notes__rail {
    width: 100%;
    padding-right: 1rem;
    scroll-padding-inline: 0 1rem;
  }

  .dm-human-warmth .dm-atmosphere-portal__grid {
    width: 100%;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: min(82vw, 330px);
    margin-right: 0;
    padding-right: 1rem;
    overflow-x: auto;
    scroll-padding-inline: 0 1rem;
  }

  .dm-human-warmth .dm-atmosphere-portal__card:nth-child(n) {
    grid-column: auto;
  }

  .dm-human-warmth .dm-site-footer .dm-footer-grid > .dm-footer-practical ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1rem;
  }
}

@media (max-width: 680px) {
  .dm-edition-board,
  .dm-edition-diagram,
  body.dm-article-edition .dm-edition-detail-group {
    width: 100% !important;
    max-width: 100%;
    margin-inline: 0 !important;
    transform: none !important;
  }
}

@media (forced-colors: active) {
  .dm-human-warmth .dm-useful-edit,
  .dm-human-warmth .dm-useful-edit *,
  .dmtp-voice-card {
    color: CanvasText !important;
  }
}
