/**
 * TES Laptop Layout Fix v1.0.0
 * Loaded after theme + plugins. Targets 768px–1440px laptop/small-desktop viewports.
 * Phone rules (max-width: 720px) are intentionally untouched.
 */

/* ------------------------------------------------------------------ */
/* 768px–900px: bridge range where theme collapses too early            */
/* ------------------------------------------------------------------ */
@media (min-width: 768px) and (max-width: 900px) {
  body.tes-laptop-layout-fix .hero-grid,
  body.tes-laptop-layout-fix .tile-grid,
  body.tes-laptop-layout-fix .grid-2,
  body.tes-laptop-layout-fix .teg-form .row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.tes-laptop-layout-fix .portrait-card-grid,
  body.tes-laptop-layout-fix .portrait-gig-grid,
  body.tes-laptop-layout-fix .featured-acts-section .portrait-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.tes-laptop-layout-fix .archive-grid,
  body.tes-laptop-layout-fix .grid-3,
  body.tes-laptop-layout-fix .hot-slot-summary-grid,
  body.tes-laptop-layout-fix .trending-act-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.tes-laptop-layout-fix .single-layout,
  body.tes-laptop-layout-fix .single-layout-act,
  body.tes-laptop-layout-fix .single-layout-venue {
    grid-template-columns: 1.05fr 0.95fr !important;
  }

  body.tes-laptop-layout-fix .hero-main.compact .hero-welcome-text {
    max-width: 42ch !important;
    font-size: 1rem !important;
  }
}

/* ------------------------------------------------------------------ */
/* 901px+: laptop/desktop restore                                       */
/* ------------------------------------------------------------------ */
@media (min-width: 901px) {
  /* Wider content shell on larger laptops */
  body.tes-laptop-layout-fix .container {
    width: min(1120px, calc(100% - 36px)) !important;
  }

  body.tes-laptop-layout-fix .section {
    padding: 26px 0 !important;
  }

  body.tes-laptop-layout-fix .panel {
    padding: 22px 24px !important;
  }

  /* Desktop header: inline nav instead of hamburger stack */
  body.tes-laptop-layout-fix .header-wrap {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 12px 18px !important;
    grid-template-columns: unset !important;
    grid-template-areas: unset !important;
    padding: 12px 0 !important;
  }

  body.tes-laptop-layout-fix .brand {
    grid-area: unset !important;
    flex: 0 1 300px !important;
    min-width: 0 !important;
  }

  body.tes-laptop-layout-fix .header-top-actions {
    grid-area: unset !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    order: 4 !important;
    margin-left: 0 !important;
    flex: 0 0 auto !important;
  }

  body.tes-laptop-layout-fix .menu-toggle {
    display: none !important;
  }

  body.tes-laptop-layout-fix .primary-nav {
    display: flex !important;
    position: static !important;
    width: auto !important;
    flex: 1 1 360px !important;
    min-width: 0 !important;
    order: 2 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  body.tes-laptop-layout-fix .primary-nav ul {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 10px 14px !important;
    justify-content: center !important;
    padding: 0 !important;
  }

  body.tes-laptop-layout-fix .primary-nav a {
    white-space: nowrap !important;
    font-size: 0.95rem !important;
  }

  body.tes-laptop-layout-fix .nav-mobile-tools {
    display: none !important;
  }

  body.tes-laptop-layout-fix .header-auth {
    display: flex !important;
    width: auto !important;
    grid-area: unset !important;
    order: 3 !important;
    flex: 0 0 auto !important;
    padding: 0 !important;
    margin-left: auto !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
  }

  body.tes-laptop-layout-fix .header-auth .pill-link {
    white-space: nowrap !important;
  }

  /* Multi-column grids (undo 900px single-column collapse) */
  body.tes-laptop-layout-fix .hero-grid,
  body.tes-laptop-layout-fix .tile-grid,
  body.tes-laptop-layout-fix .grid-2,
  body.tes-laptop-layout-fix .teg-form .row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.tes-laptop-layout-fix .grid-3,
  body.tes-laptop-layout-fix .archive-grid,
  body.tes-laptop-layout-fix .hot-slot-summary-grid,
  body.tes-laptop-layout-fix .trending-act-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body.tes-laptop-layout-fix .portrait-card-grid,
  body.tes-laptop-layout-fix .portrait-gig-grid,
  body.tes-laptop-layout-fix .featured-acts-section .portrait-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.tes-laptop-layout-fix .single-layout,
  body.tes-laptop-layout-fix .single-layout-act,
  body.tes-laptop-layout-fix .single-layout-venue {
    grid-template-columns: 1.12fr 0.88fr !important;
    gap: 24px !important;
  }

  /* Hero / homepage readability */
  body.tes-laptop-layout-fix .hero-main.compact .hero-welcome-text {
    max-width: 52ch !important;
    font-size: 1.02rem !important;
    line-height: 1.45 !important;
  }

  body.tes-laptop-layout-fix .hero-card.hero-main.compact,
  body.tes-laptop-layout-fix .hero-main.compact {
    padding: 20px 24px !important;
  }

  body.tes-laptop-layout-fix .hero-main.compact h1 {
    font-size: clamp(2rem, 3vw, 2.6rem) !important;
    white-space: normal !important;
  }

  body.tes-laptop-layout-fix .featured-acts-section .homepage-section-head h2,
  body.tes-laptop-layout-fix .featured-acts-section .section-head h2 {
    white-space: normal !important;
    font-size: clamp(1.25rem, 2vw, 1.75rem) !important;
  }

  body.tes-laptop-layout-fix .today-tonight-hero .muted {
    max-width: 760px !important;
  }

  /* Directory cards: less phone-tall thumb strip on laptop */
  body.tes-laptop-layout-fix .portrait-card-grid .act-card,
  body.tes-laptop-layout-fix .portrait-gig-grid .gig-card,
  body.tes-laptop-layout-fix .directory-card.gig-card,
  body.tes-laptop-layout-fix .directory-card.act-card {
    grid-template-columns: 120px minmax(0, 1fr) !important;
  }

  body.tes-laptop-layout-fix .portrait-card-grid .act-card .thumb,
  body.tes-laptop-layout-fix .portrait-gig-grid .gig-card .thumb,
  body.tes-laptop-layout-fix .directory-card.gig-card .thumb,
  body.tes-laptop-layout-fix .directory-card.act-card .thumb {
    min-height: 148px !important;
  }

  /* Dashboard / account panels */
  body.tes-laptop-layout-fix .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.tes-laptop-layout-fix .quick-stats-bar {
    justify-content: center !important;
    flex-wrap: wrap !important;
  }
}

/* ------------------------------------------------------------------ */
/* 1024px+: standard laptop                                             */
/* ------------------------------------------------------------------ */
@media (min-width: 1024px) {
  body.tes-laptop-layout-fix .container {
    width: min(1160px, calc(100% - 40px)) !important;
  }

  body.tes-laptop-layout-fix .hero-main.compact .hero-welcome-text {
    max-width: 60ch !important;
  }

  body.tes-laptop-layout-fix .portrait-card-grid,
  body.tes-laptop-layout-fix .portrait-gig-grid,
  body.tes-laptop-layout-fix .featured-acts-section .portrait-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body.tes-laptop-layout-fix .primary-nav ul {
    gap: 12px 18px !important;
  }
}

/* ------------------------------------------------------------------ */
/* 1280px+: large laptop / small desktop                                */
/* ------------------------------------------------------------------ */
@media (min-width: 1280px) {
  body.tes-laptop-layout-fix .container {
    width: min(1200px, calc(100% - 48px)) !important;
  }

  body.tes-laptop-layout-fix .archive-grid,
  body.tes-laptop-layout-fix .grid-3,
  body.tes-laptop-layout-fix .trending-act-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body.tes-laptop-layout-fix .portrait-card-grid,
  body.tes-laptop-layout-fix .portrait-gig-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body.tes-laptop-layout-fix .stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* ------------------------------------------------------------------ */
/* Local Business Directory app pages on laptop                         */
/* ------------------------------------------------------------------ */
@media (min-width: 901px) {
  body.tes-laptop-layout-fix.tes-lbd-app-mode .tes-lbd-list,
  body.tes-laptop-layout-fix.tes-lbd-app-mode .tes-lbd-directory-list,
  body.tes-laptop-layout-fix.tes-lbd-app-mode .tes-lbd-archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1024px) {
  body.tes-laptop-layout-fix.tes-lbd-app-mode .tes-lbd-list,
  body.tes-laptop-layout-fix.tes-lbd-app-mode .tes-lbd-directory-list,
  body.tes-laptop-layout-fix.tes-lbd-app-mode .tes-lbd-archive-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 901px) {
  body.tes-laptop-layout-fix .tes-lbd-az-letters {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin: 0 0 18px !important;
  }

  body.tes-laptop-layout-fix .tes-lbd-az-letters a {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 38px !important;
    min-height: 38px !important;
    padding: 0 10px !important;
    border-radius: 12px !important;
    border: 1px solid var(--border, #e7e9f7) !important;
    background: #fff !important;
    font-weight: 800 !important;
    text-decoration: none !important;
  }
}
