/* Footer layout overrides kept separate from the legacy stylesheet cascade. */
.footer .footer-top {
  display: grid !important;
  grid-template-columns: minmax(280px, 1.45fr) repeat(4, minmax(120px, 0.7fr)) !important;
  gap: 36px 44px !important;
  align-items: start !important;
}

.footer .footer-top > div:not(.footer-brand) {
  min-width: 0;
}

.footer .footer-brand {
  max-width: 360px;
}

.footer .footer-links a {
  display: inline-flex;
  line-height: 1.45;
}

/* Keep the property score fully visible inside the clipped image frame. */
.project-img-wrapper .project-score-badge {
  bottom: 12px;
  right: 12px;
  z-index: 2;
}

.mobile-hero-break {
  display: none;
}

/* Keep legal information compact on wide screens. */
.footer .footer-bottom {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 24px !important;
  text-align: left !important;
}

.footer .footer-bottom-links {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  justify-content: flex-end !important;
  gap: 10px 24px !important;
  width: auto !important;
}

@media (min-width: 769px) and (max-width: 1024px) {
  .footer .footer-top {
    grid-template-columns: 1.35fr repeat(2, minmax(0, 1fr)) !important;
    gap: 34px 30px !important;
  }

  .footer .footer-brand {
    grid-column: 1 / -1 !important;
    max-width: 720px;
  }
}

@media (max-width: 768px) {
  body {
    padding-top: var(--header-height);
    padding-bottom: 60px;
  }

  .header {
    position: fixed !important;
    inset: 0 0 auto 0;
    width: 100%;
    z-index: 1000;
  }

  /* Use the existing drawer instead of squeezing desktop navigation into mobile. */
  .utility-bar {
    display: none !important;
  }

  .header .nav {
    display: none !important;
  }

  .header .header-actions > .action-icon-btn,
  .header .header-actions > .theme-toggle-btn,
  .header .header-actions > .btn {
    display: none !important;
  }

  .header .header-actions .menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
  }

  .header-container {
    position: relative;
    min-width: 0;
    justify-content: space-between !important;
  }

  .header .header-actions {
    display: flex !important;
    flex: 0 0 44px;
    min-width: 44px;
    margin-left: auto;
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
  }

  .header .header-actions .menu-btn {
    width: 44px;
    height: 44px;
  }

  .mobile-menu-trigger {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: var(--bg-white) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-sm);
  }

  .mobile-sticky-bar {
    display: flex !important;
    position: fixed !important;
    inset: auto 0 0 0 !important;
    width: auto !important;
    max-width: none !important;
  }

  .mobile-cta-item {
    flex: 1 1 0 !important;
    min-width: 0;
    width: auto !important;
    overflow: hidden;
  }

  .mobile-cta-item span {
    white-space: nowrap;
    font-size: 0.7rem;
  }

  .floating-actions {
    display: none !important;
  }

  html,
  body,
  main {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .hero-container {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .hero-content {
    width: 100%;
    min-width: 0;
    max-width: 342px;
  }

  .hero h1,
  .hero-desc {
    width: 100%;
    overflow-wrap: anywhere;
  }

  .invest-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 16px;
  }

  .invest-card {
    min-width: 0;
    width: 100%;
    padding: 20px;
  }

  .market-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 20px !important;
  }

  .market-chart-box,
  .market-insights-side,
  .insight-mini-card {
    min-width: 0;
    width: 100%;
  }

  .market-chart-box {
    padding: 20px;
  }

  .market-chart-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .market-legend {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .chart-svg-main {
    height: auto;
    min-height: 190px;
  }

  #propertyDetailContainer .container,
  #propertyDetailContainer .detail-main-layout > *,
  #propertyDetailContainer .detail-card-panel,
  #propertyDetailContainer .calc-content {
    min-width: 0;
    max-width: 100%;
  }

  .detail-header-grid {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }

  .detail-header-left h1 {
    font-size: 2rem;
    overflow-wrap: anywhere;
  }

  .detail-header-right {
    width: 100%;
    text-align: left;
  }

  .detail-badges-row {
    flex-wrap: wrap;
  }

  .gallery-layout,
  .detail-main-layout,
  #propertyDetailContainer .score-grid,
  #propertyDetailContainer .calc-container {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 20px !important;
  }

  .gallery-main-box {
    height: 220px;
  }

  .gallery-side-box {
    display: none;
  }

  .detail-card-panel {
    padding: 20px;
    margin-bottom: 20px;
  }

  .detail-card-panel > div[style*="padding:24px"] {
    padding: 14px !important;
    overflow-x: auto;
  }

  .spec-grid,
  .locality-intel-grid,
  .pros-cons-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .pros-cons-col:first-child {
    padding: 0 0 20px !important;
  }

  .pros-cons-col:last-child {
    padding: 20px 0 0 !important;
  }

  .sticky-detail-sidebar {
    position: static;
    width: 100%;
  }

  #propertyDetailContainer .calc-sidebar {
    width: 100%;
    white-space: normal;
  }

  .newsletter-signup {
    flex-direction: column !important;
    width: 100%;
  }

  .newsletter-signup input,
  .newsletter-signup button {
    width: 100%;
    min-width: 0;
  }

  .mobile-hero-break {
    display: inline;
  }

  .footer {
    padding: 48px 0 92px 0;
  }

  .footer .footer-top {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 28px 22px !important;
    text-align: left;
  }

  .footer .footer-brand {
    grid-column: 1 / -1 !important;
    max-width: none;
  }

  .footer h3 {
    margin-bottom: 12px;
    font-size: 0.9rem;
  }

  .footer .footer-links {
    gap: 9px;
  }

  .footer .footer-links a {
    font-size: 0.84rem;
  }

  .footer .footer-newsletter-form {
    flex-direction: column;
    max-width: 360px;
  }

  .footer .footer-newsletter-form input,
  .footer .footer-newsletter-form button {
    width: 100%;
  }

  .footer .footer-middle {
    padding: 24px 0;
    margin-bottom: 24px;
    font-size: 0.78rem;
    line-height: 1.65;
  }

  .footer .footer-bottom {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start;
    gap: 16px !important;
    text-align: left;
  }

  .footer .footer-bottom-links {
    display: grid;
    flex-direction: initial !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: initial !important;
    gap: 10px 18px;
    width: 100%;
  }
}

@media (max-width: 420px) {
  .footer .footer-top {
    grid-template-columns: 1fr !important;
  }

  .footer .footer-bottom-links {
    grid-template-columns: 1fr;
  }
}
