/* Mobile reading and product-evidence controls for the V7 public candidate.
 * Desktop compositions and original image assets remain the source of truth.
 */
.mkt-image-zoom-trigger { display: none; }

@media (max-width: 767px) {
  /* Finite choices must be visible without swiping. Older page adapters used
   * fixed-width tabs, sometimes inside an overflow:hidden frame. Opt in only
   * the audited public controls, leaving product UI and card carousels alone. */
  :root [data-mkt-style="home-v7"][data-mkt-layout="v1"] [data-mkt-mobile-options] {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    min-width: 0;
    max-width: 100%;
    gap: 0.5rem !important;
    margin-inline: 0 !important;
    padding: 0.375rem !important;
    overflow: visible !important;
    scroll-snap-type: none;
  }

  :root [data-mkt-style="home-v7"][data-mkt-layout="v1"] [data-mkt-mobile-options="columns"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  :root [data-mkt-style="home-v7"][data-mkt-layout="v1"] [data-mkt-mobile-options] > button {
    grid-column: auto !important;
    flex: initial !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: var(--mkt-layout-hit-control-min) !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    scroll-snap-align: none;
    transform: none !important;
  }

  :root [data-mkt-style="home-v7"][data-mkt-layout="v1"] [data-mkt-mobile-options] > button :is(span, strong) {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* Keep the brand inside its link and let the adjacent CTA wrap at 320px. */
  :root [data-mkt-style="home-v7"] :is(.medc-brand, .medv3-brand) {
    flex-shrink: 0;
  }
  :root [data-mkt-style="home-v7"] :is(.medc-header__actions, .medv3-site-header__actions) {
    min-width: 0;
  }
  :root [data-mkt-style="home-v7"] :is(.medc-header__cta, .medv3-site-header .medv3-button) {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
  }

  /* The overlapping receipt covered the calendar image's tap target. */
  :root [data-mkt-style="home-v7"] .deck-publish__composition {
    display: grid;
    min-height: 0;
    gap: 1rem;
  }
  :root [data-mkt-style="home-v7"] :is(.deck-publish__calendar, .deck-publish__receipt) {
    position: relative;
    inset: auto;
    width: 100%;
    transform: none;
  }

  :root [data-mkt-style="home-v7"][data-mkt-layout="v1"] {
    --mkt-layout-section-default-block: 3rem;
    --mkt-layout-section-compact-block: 2rem;
    --mkt-layout-section-hero-block: 2rem;
    --mkt-layout-section-closing-block: 3rem;
    --mkt-layout-section-heading-gap: 1.5rem;
    --mkt-type-display-leading: 1.12;
    --mkt-type-section-title-leading: 1.2;
    --mkt-type-lead-size: 1rem;
    --mkt-type-lead-leading: 1.75;
  }

  :root [data-mkt-style="home-v7"] :is(section[id], [data-mkt-section], [role="tabpanel"]) {
    scroll-margin-top: 5rem;
  }

  :root [data-mkt-style="home-v7"] :is(.home-v7-hero__grid, .acsr-hero__grid, .planner-v5-hero-grid) {
    gap: 1.5rem;
  }

  :root [data-mkt-style="home-v7"] :is(.home-v7-hero__copy, .acsr-hero__copy) > p {
    margin-block: 1rem;
  }

  :root [data-mkt-style="home-v7"] :is(.home-v7-actions, .acsr-actions) {
    margin-top: 1.25rem;
    gap: 0.5rem;
  }

  :root [data-mkt-style="home-v7"] .acsr-channel-strip { margin-top: 1rem; }
  :root [data-mkt-style="home-v7"] .acsr-channel-strip__items { gap: 0.375rem; }
  :root [data-mkt-style="home-v7"] .acsr-hero__copy .acsr-boundary-note { margin-top: 1rem; }

  :root [data-mkt-style="home-v7"] :is(.planner-v5-hero, .mkt-native-resource > section:first-of-type, .ops-native-flow > section:first-of-type, .business-native-flow > section:first-of-type),
  :root [data-mkt-style="home-v7"] .nf-style7-page .nf-cut--hero > section {
    min-height: 0;
    padding-block: var(--mkt-layout-section-hero-block) !important;
  }
  :root [data-mkt-style="home-v7"] .planner-v5-landing > section:not(.planner-v5-hero) {
    padding-block: var(--mkt-layout-section-default-block);
  }
  :root [data-mkt-style="home-v7"] .nf-hero-product-frame [role="tabpanel"] > div.absolute:not([aria-hidden="true"]) {
    position: relative !important;
    inset: auto !important;
    max-width: none !important;
    margin: 0.5rem !important;
    box-shadow: none !important;
  }
  :root [data-mkt-style="home-v7"] .nf-hero-product-frame [aria-hidden="true"][class*="absolute"][class*="inset-0"]:not(:has(img)) {
    display: none;
  }
  :root [data-mkt-style="home-v7"] :has(> .mkt-image-zoom-trigger) > img {
    transform: none !important;
    filter: none !important;
    opacity: 1 !important;
    object-fit: contain;
  }

  /* Multiple nested paper frames used to spend a large share of phone width. */
  :root [data-mkt-style="home-v7"] .nf-style7-page .nf-cut:not(.nf-cut--hero, .nf-cut--cta) > section > div:not([aria-hidden="true"]) {
    padding: 1.25rem 1rem !important;
    border-radius: 1.25rem !important;
  }

  :root [data-mkt-style="home-v7"] .nf-style7-page .nf-hero-product-frame {
    padding: 0.375rem !important;
    border-radius: 1.25rem !important;
  }

  :root [data-mkt-style="home-v7"] .home-v7-browser-window { border-radius: 1.25rem; }

  /* Only frames explicitly using the image component receive a control. */
  [data-mkt-style="home-v7"] :has(> .mkt-image-zoom-trigger) { position: relative; }
  :root [data-mkt-style="home-v7"] .mkt-image-zoom-trigger {
    position: absolute;
    z-index: 30;
    right: 0.5rem;
    top: 0.5rem;
    bottom: auto;
    display: inline-flex;
    min-height: 2.75rem !important;
    min-width: 2.75rem !important;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem !important;
    border: 1px solid var(--mkt-brand-line) !important;
    border-radius: 0.75rem !important;
    background: var(--mkt-brand-paper) !important;
    color: var(--mkt-brand-primary-dark) !important;
    box-shadow: 0 3px 12px rgb(41 37 32 / 15%) !important;
    font-family: var(--mkt-type-font-sans);
    font-size: var(--mkt-type-label-size) !important;
    font-weight: 700;
    line-height: 1.4;
    transform: none !important;
  }
  .mkt-image-zoom-trigger svg { width: 1rem; height: 1rem; }
}

/* A separate scroll surface lets users read the original capture from 1x to 5x. */
:root .mkt-image-dialog[data-mkt-style="home-v7"] {
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: calc(100vw - 1rem);
  max-width: 60rem;
  height: min(94dvh, 56rem);
  max-height: 94dvh;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 1.25rem;
  overflow: hidden;
}
.mkt-image-dialog > header { padding-right: 2.75rem; }
:root .mkt-image-dialog .mkt-image-description {
  max-height: 4.5em;
  overflow-y: auto;
  margin-top: 0.5rem;
  color: var(--mkt-brand-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}
.mkt-image-zoom-tools { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.mkt-image-zoom-tools button, .mkt-image-zoom-tools output {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  font-size: 0.875rem;
  font-weight: 700;
}
.mkt-image-zoom-tools button {
  border: 1px solid var(--mkt-brand-line);
  border-radius: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--mkt-brand-paper);
  color: var(--mkt-brand-primary-dark);
}
.mkt-image-zoom-tools button:disabled { opacity: 0.45; }
.mkt-image-zoom-tools button[aria-pressed="true"] { background: var(--mkt-brand-primary-soft); }
.mkt-image-zoom-tools svg { width: 1.125rem; height: 1.125rem; }
.mkt-image-pan {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--mkt-brand-line);
  border-radius: 0.75rem;
  background: white;
}
.mkt-image-pan > img { display: block; max-width: none; height: auto; }
:root .mkt-image-dialog .mkt-image-hint { margin: 0; font-size: 0.75rem; line-height: 1.5; color: var(--mkt-brand-muted); }
.mkt-image-dialog > button:last-child { width: 2.75rem; height: 2.75rem; right: 0.5rem; top: 0.5rem; display: grid; place-items: center; }
.mkt-image-dialog :is(button, [tabindex]):focus-visible { outline: 3px solid var(--mkt-brand-primary); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .mkt-image-dialog { animation: none !important; transition: none !important; }
}
