/*
 * Premium responsive home layout layer.
 * Final-pass, home-scoped CSS only. This avoids touching route logic,
 * assets, or existing card rendering while improving hierarchy and desktop fit.
 */

.home-premium-shell {
  --mba-home-max: 1180px;
  --mba-home-gutter: clamp(14px, 3vw, 28px);
}

.home-premium-shell .home-desktop-main {
  width: 100% !important;
  max-width: var(--mba-home-max) !important;
  margin-inline: auto !important;
  box-sizing: border-box !important;
}

.home-premium-shell .home-premium-workspace,
.home-premium-shell .home-dashboard-groups,
.home-premium-shell .home-recent-compact,
.home-premium-shell .home-footer-section {
  width: min(100%, var(--mba-home-max)) !important;
  max-width: var(--mba-home-max) !important;
  margin-inline: auto !important;
  box-sizing: border-box !important;
}

.home-premium-shell .home-dashboard-groups {
  padding-inline: var(--mba-home-gutter) !important;
}

.home-premium-shell .home-dashboard-group {
  scroll-margin-top: 96px;
}

.home-premium-shell .home-dashboard-group__head {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  justify-items: start !important;
  align-items: start !important;
  justify-content: start !important;
  gap: 4px !important;
  text-align: left !important;
}

.home-premium-shell .home-dashboard-group__head span,
.home-premium-shell .home-dashboard-group__head h2 {
  justify-self: start !important;
  max-width: min(100%, 760px) !important;
  text-align: left !important;
}

.home-premium-shell .home-dashboard-card,
.home-premium-shell .home-primary-action-card,
.home-premium-shell .home-special-card,
.home-premium-shell .home-snapshot-stat,
.home-premium-shell .home-search-command__result,
.home-premium-shell .home-continue-card__primary,
.home-premium-shell .home-continue-card__secondary {
  -webkit-tap-highlight-color: transparent !important;
  touch-action: manipulation !important;
}

.home-premium-shell .home-search-command__result {
  min-height: 44px !important;
}

.home-premium-shell .home-dashboard-card__title,
.home-premium-shell .home-special-card__title,
.home-premium-shell .home-primary-action-card__title {
  text-wrap: balance;
}

@media (max-width: 430px) {
  .home-premium-shell {
    --mba-home-gutter: 12px;
  }

  .home-premium-shell .home-dashboard-groups {
    gap: 14px !important;
  }

  .home-premium-shell .home-dashboard-group {
    gap: 9px !important;
  }

  .home-premium-shell .home-dashboard-group__head {
    justify-items: start !important;
    align-items: start !important;
    text-align: left !important;
    gap: 2px !important;
  }

  .home-premium-shell .home-dashboard-group__head h2 {
    max-width: 100% !important;
    margin-bottom: 0 !important;
  }

  .home-premium-shell .home-dashboard-card,
  .home-premium-shell .home-primary-action-card {
    min-height: 84px !important;
  }

  .home-premium-shell .home-special-card__cta {
    max-width: 86px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

@media (min-width: 768px) {
  .home-premium-shell .home-premium-workspace {
    padding-inline: var(--mba-home-gutter) !important;
  }

  .home-premium-shell .home-dashboard-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-rows: 92px !important;
    gap: 12px !important;
  }

  .home-premium-shell .home-special-cards {
    gap: 12px !important;
  }
}

@media (min-width: 1024px) {
  .home-premium-shell .home-hero-brand-media {
    padding-top: calc(72px + env(safe-area-inset-top)) !important;
  }

  .home-premium-shell .home-desktop-main .home-hero-media {
    max-width: 620px !important;
    min-height: 330px !important;
    max-height: 430px !important;
  }

  .home-premium-shell .home-premium-workspace {
    display: grid !important;
    grid-template-columns: minmax(0, 1.24fr) minmax(310px, 0.76fr) !important;
    align-items: start !important;
    gap: 18px !important;
    padding-top: 8px !important;
  }

  .home-premium-shell .home-premium-workspace__primary,
  .home-premium-shell .home-premium-workspace__secondary {
    min-width: 0 !important;
  }

  .home-premium-shell .home-premium-workspace__secondary {
    position: sticky !important;
    top: 88px !important;
    align-self: start !important;
  }

  .home-premium-shell .home-greeting-clock-wrap,
  .home-premium-shell .home-daily-quote-wrap,
  .home-premium-shell .home-search-command,
  .home-premium-shell .home-command-center,
  .home-premium-shell .home-continue-wrap,
  .home-premium-shell .home-snapshot-wrap,
  .home-premium-shell .home-special-cards {
    padding-inline: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }

  .home-premium-shell .home-dashboard-groups {
    gap: 22px !important;
    padding-top: 20px !important;
  }

  .home-premium-shell .home-dashboard-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    grid-auto-rows: 96px !important;
    gap: 14px !important;
  }

  .home-premium-shell .home-dashboard-card {
    grid-template-columns: 40px minmax(0, 1fr) auto 10px !important;
    gap: 9px !important;
    padding: 12px !important;
    border-radius: 19px !important;
  }

  .home-premium-shell .home-dashboard-card__icon {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
  }

  .home-premium-shell .home-dashboard-card__icon svg,
  .home-premium-shell .home-dashboard-card__icon img {
    max-width: 40px !important;
    max-height: 40px !important;
  }

  .home-premium-shell .home-dashboard-card__title {
    font-size: 14.5px !important;
    line-height: 1.18 !important;
  }

  .home-premium-shell .home-dashboard-card__subtitle {
    font-size: 12px !important;
  }
}

@media (min-width: 1280px) {
  .home-premium-shell .home-dashboard-groups {
    padding-bottom: 10px !important;
  }
}

@media (min-width: 1536px) {
  .home-premium-shell .home-dashboard-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-premium-shell .home-premium-workspace__secondary {
    position: static !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   Mobile density pass
   Keep every existing card and route, while reducing vertical travel and
   preserving readable titles/subtitles on phone-sized screens.
   ───────────────────────────────────────────────────────────── */

@media (max-width: 767px) {
  .home-premium-shell .home-dashboard-grid {
    grid-auto-rows: minmax(88px, auto) !important;
    align-items: stretch !important;
    gap: 9px !important;
  }

  .home-premium-shell .home-dashboard-card {
    min-height: 88px !important;
    height: auto !important;
    align-items: center !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    overflow: hidden !important;
  }

  .home-premium-shell .home-dashboard-card__copy {
    gap: 3px !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .home-premium-shell .home-dashboard-card__title {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    white-space: normal !important;
    text-overflow: ellipsis !important;
    min-height: 0 !important;
    max-height: none !important;
    font-size: 12.8px !important;
    line-height: 1.22 !important;
    letter-spacing: -0.15px !important;
  }

  .home-premium-shell .home-dashboard-card__subtitle {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    white-space: normal !important;
    text-overflow: ellipsis !important;
    font-size: 10.8px !important;
    line-height: 1.25 !important;
  }

  .home-premium-shell .home-special-card {
    min-height: 88px !important;
    height: auto !important;
    align-items: center !important;
    padding-top: 11px !important;
    padding-bottom: 11px !important;
    overflow: hidden !important;
  }

  .home-premium-shell .home-special-card__title,
  .home-premium-shell .home-special-card__subtitle {
    white-space: normal !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .home-premium-shell .home-special-card__title {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
  }

  .home-premium-shell .home-special-card__subtitle {
    display: -webkit-box !important;
    -webkit-line-clamp: 1 !important;
    -webkit-box-orient: vertical !important;
  }

  .home-premium-shell .home-continue-wrap {
    position: relative !important;
    z-index: 1 !important;
  }

  .home-premium-shell .home-continue-card__primary {
    min-height: 64px !important;
  }
}
