/* =========================================================
   DESKTOP & WIDE SCREENS (imported after style.css)
   Home split layout, centered content, floating sheet, routes grid
========================================================= */

.container--home-top {
  padding-top: 20px;
}

.home-top-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.home-top-grid__lead {
  min-width: 0;
}

.home-top-grid__map {
  width: 100%;
  min-width: 0;
}

/* Mobile order: DOM stacks search→CTAs→map; unwrap lead so flex order yields search→map→CTAs below map. */
@media (max-width: 1023px) {

  .home-top-grid__lead {
    display: contents;
  }

  .home-top-grid__search {
    order: 1;
  }

  .home-top-grid__map {
    order: 2;
  }

  .home-secondary-actions {
    order: 3;
  }
}

@media (min-width: 1024px) {
  body:not(.dark-mode) {
    background: linear-gradient(165deg, #f8fafc 0%, var(--bg) 38%, #e8eef5 100%);
  }

  .center-wrapper {
    max-width: 1240px;
    padding: 0 24px;
  }

  .home-top-grid {
    display: grid;
    grid-template-columns: minmax(280px, 400px) minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas: "lead map";
    gap: 28px 40px;
    align-items: start;
    max-width: 1280px;
    margin: 0 auto;
    padding: 4px 12px 0;
  }

  /* Undo mobile flex reordering */
  .home-top-grid__search,
  .home-secondary-actions,
  .home-top-grid__map {
    order: unset;
  }

  /*
   * Lead wraps search + Share/How in one sidebar column on desktop (no overlapping grid slots).
   */
  .home-top-grid__lead {
    grid-area: lead;
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .home-top-grid__search {
    text-align: left;
    padding-top: 6px;
  }

  .home-top-grid__search .home-search-title {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    text-align: left;
    max-width: none;
  }

  .home-top-grid__search .search-box {
    margin-left: 0;
    max-width: none;
    padding: 0;
  }

  .home-top-grid__search .find-btn {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }
  /*
   * Under Get a Taxi in sidebar (nested in .home-top-grid__lead).
   */
  .home-top-grid__lead > .home-secondary-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    width: 100%;
    max-width: none;
    margin: 14px 0 0;
  }

  .home-top-grid__lead > .home-secondary-actions > div {
    width: 100%;
    flex: 0 0 auto;
    min-width: 0;
  }

  .home-top-grid__lead > .home-secondary-actions .share-btn,
  .home-top-grid__lead > .home-secondary-actions .how-btn {
    width: 100%;
    padding: 10px 14px;
    border-radius: 115px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
    line-height: 1.35;
  }

  .home-top-grid__map {
    grid-area: map;
    min-width: 0;
  }

  .home-top-grid__map .map-container {
    height: min(58vh, 580px);
    min-height: 440px;
    width: 100%;
  }

  /* Route result sheet — card style on wide screens */
  .bottom-sheet {
    left: 50%;
    right: auto;
    width: min(500px, 42vw);
    max-width: 540px;
    margin: 0;
    bottom: 32px;
    transform: translate(-50%, calc(100% + 120px));
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    padding: 14px 20px calc(16px + env(safe-area-inset-bottom, 0px));
    box-shadow:
      0 12px 40px rgba(15, 23, 42, 0.12),
      0 4px 12px rgba(15, 23, 42, 0.06);
  }

  .bottom-sheet.active {
    transform: translate(-50%, 0);
  }

  /* Header nav aligns with main column width */
  .header {
    padding-left: max(20px, calc((100vw - 1280px) / 2 + 12px));
    padding-right: max(20px, calc((100vw - 1280px) / 2 + 12px));
  }

  .desktop-menu > span,
  .desktop-menu .desktop-dropdown__trigger {
    padding: 8px 10px;
    border-radius: 10px;
    transition:
      background 0.15s ease,
      color 0.15s ease,
      box-shadow 0.15s ease;
  }

  .desktop-menu > span:hover,
  .desktop-menu .desktop-dropdown__trigger:hover {
    background: rgba(15, 23, 42, 0.06);
  }

  body.dark-mode .desktop-menu > span:hover,
  body.dark-mode .desktop-menu .desktop-dropdown__trigger:hover {
    background: rgba(16, 185, 129, 0.14);
    color: #d1fae5;
    box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.14);
  }

  body.dark-mode .desktop-menu > span:active,
  body.dark-mode .desktop-menu .desktop-dropdown__trigger:active {
    background: rgba(16, 185, 129, 0.22);
    color: #ecfdf5;
  }

  body.dark-mode .desktop-menu > span:focus-visible,
  body.dark-mode .desktop-menu .desktop-dropdown__trigger:focus-visible {
    outline: none;
    background: rgba(16, 185, 129, 0.18);
    color: #ecfdf5;
    box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.45);
  }

  .page {
    padding-bottom: 36px;
  }

  #routesPage.routes-page {
    --routes-page-pad-bottom: 24px;
  }

  .routes-page-wrap {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 24px;
    padding-right: 24px;
  }

  .routes-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
  }

  #tipsPage .tips-page-wrap,
  #tipsPage .container.tips-page-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
  }

  #tips.tips-feed {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
  }

  .settings-inner {
    max-width: 640px;
    padding-left: 28px;
    padding-right: 28px;
  }

  #howPage .container {
    max-width: 900px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
  }

  #loginPage .auth-container {
    max-width: 420px;
  }

  .marshal-ui,
  .driver-ui {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 24px;
    padding-right: 24px;
    box-sizing: border-box;
  }

  .dropdown-content {
    border-radius: 14px;
    padding: 8px 0;
    box-shadow:
      0 4px 6px rgba(15, 23, 42, 0.04),
      0 20px 48px rgba(15, 23, 42, 0.14);
    border: 1px solid rgba(15, 23, 42, 0.06);
  }

  body.dark-mode .dropdown-content {
    border-color: var(--border);
  }
}

/* Large monitors — slightly wider content cap */
@media (min-width: 1440px) {
  .home-top-grid {
    max-width: 1320px;
    gap: 32px 48px;
  }

  .routes-page-wrap {
    max-width: 1100px;
  }
}
