/* ==========================================================================
   NAV WORK ORDER (2026-11-19) — single responsive header for Texas Heat
   & Air. One component replaces the old topbar + desktop nav + mobile
   hamburger systems + the VISIBLE BAR grid on every page.
   Structure: <header class="tnav"> logo + [Call][Book][Services v]
   [Service Areas v][More] — desktop single row; mobile two bands
   (logo band, then a five-target action band). Behaviour: tha-nav.js.
   Palette matches the site brand vars in styles.css (:root):
   navy #0b2a5b / navy-dark #071d40 / red #c8352a / red-dark #a82a21 /
   ink #1c2430 / line #e3e7ee / gold #e8a33d.
   ========================================================================== */

.tnav, .tnav *, .tnav *::before, .tnav *::after { box-sizing: border-box; }

.tnav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: #fff;
  border-bottom: 1px solid #e3e7ee;
  box-shadow: 0 2px 10px rgba(7, 29, 64, 0.07);
  color: #1c2430;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.tnav__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.tnav__logo { flex: 0 0 auto; line-height: 0; border-radius: 8px; }
.tnav__logo img { width: 228px; height: auto; display: block; }

.tnav__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* --- shared control shape (desktop height 52px, radius 12px) --- */
.tnav__ctl {
  height: 52px;
  padding: 0 16px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.15;
  text-decoration: none;
  white-space: nowrap;
  border: 2px solid transparent;
  background: none;
  font-family: inherit;
  cursor: pointer;
  color: #0b2a5b;
}
.tnav__ctl svg { flex: 0 0 auto; display: block; }
.tnav__ctl:focus-visible,
.tnav__panel a:focus-visible,
.tnav__logo:focus-visible {
  outline: 3px solid #e8a33d;
  outline-offset: 2px;
}
.tnav__ctl.is-current { box-shadow: inset 0 -4px 0 #e8a33d; }

/* Call — light, red icon, highly visible navy number */
.tnav__call { background: #f2f6fc; border-color: #d7e0ee; color: #0b2a5b; }
.tnav__call:hover { background: #e6eef9; }
.tnav__call .tnav__ic { color: #c8352a; }
.tnav__call-main { display: inline-flex; gap: 6px; align-items: baseline; }
.tnav__call-num { font-weight: 700; }
.tnav__call-short { display: none; }

/* Book Appointment — solid red, most prominent */
.tnav__book { background: #c8352a; border-color: #c8352a; color: #fff; }
.tnav__book:hover { background: #a82a21; border-color: #a82a21; }
.tnav__book-text { display: inline-flex; gap: 6px; }

/* Outlined dropdown triggers + More */
.tnav__btn { background: #fff; border-color: #0b2a5b; }
.tnav__btn:hover { background: #f2f6fc; }
.tnav__btn--more { padding: 0 12px; }
.tnav__chev { transition: transform 0.18s ease; }
.tnav__btn[aria-expanded="true"] .tnav__chev { transform: rotate(180deg); }
.tnav__areas-short { display: none; }

/* --- dropdown panels --- */
.tnav__drop { position: relative; }
.tnav__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 264px;
  background: #fff;
  border: 1px solid #e3e7ee;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(7, 29, 64, 0.18);
  padding: 8px;
  z-index: 220;
}
.tnav__panel[hidden] { display: none !important; }
.tnav__panel a {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  color: #1c2430;
  text-decoration: none;
  font-size: 15.5px;
  font-weight: 500;
  line-height: 1.25;
}
.tnav__panel a:hover { background: #f2f6fc; }
.tnav__panel a[aria-current="page"] { font-weight: 700; background: #f2f6fc; }
.tnav__panel .tnav__panel-all {
  border-top: 1px solid #e3e7ee;
  margin-top: 6px;
  padding-top: 12px;
  font-weight: 700;
  color: #0b2a5b;
  border-radius: 0 0 8px 8px;
}
.tnav__panel--areas { width: 356px; left: auto; right: 0; }
.tnav__cities {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 8px;
  max-height: min(62vh, 460px);
  overflow-y: auto;
}
.tnav__panel--more { left: auto; right: 0; min-width: 224px; }

/* ==========================================================================
   Tablet / laptop (768–1199px): same single row, shortened labels.
   Call keeps icon + number; Book goes two-line; Areas shortens;
   More becomes icon-only. No second row, no clipped labels.
   ========================================================================== */
@media (max-width: 1199px) {
  .tnav__logo img { width: 184px; }
  .tnav__inner { gap: 12px; padding: 10px 16px; }
  .tnav__actions { gap: 8px; }
  .tnav__ctl { height: 50px; padding: 0 12px; font-size: 15px; }
  .tnav__call-word { display: none; }
  .tnav__areas-full { display: none; }
  .tnav__areas-short { display: inline; }
  .tnav__more-label { display: none; }
  .tnav__btn--more { padding: 0 10px; }
  .tnav__book-text { flex-direction: column; gap: 0; line-height: 1.12; text-align: center; }
}
@media (max-width: 1023px) {
  .tnav__logo img { width: 164px; }
  .tnav__ctl { padding: 0 10px; font-size: 14.5px; }
}
/* Low tablet (768–900px): tighten so the single row fits without
   clipping — smaller logo, slimmer padding and gaps. */
@media (max-width: 900px) {
  .tnav__logo img { width: 148px; }
  .tnav__inner { padding: 10px 12px; gap: 10px; }
  .tnav__actions { gap: 6px; }
  .tnav__ctl { padding: 0 9px; font-size: 14px; }
}

/* ==========================================================================
   Mobile (320–767px): TWO bands.
   Band A — compact logo only (no phone number up here).
   Band B — five touch targets >=44px: Call / Book / Services /
   Areas / More, in a 5-column grid. No horizontal scrolling, no
   giant Menu button, no six-link grid. Panels open as full-width
   bands under the header.
   ========================================================================== */
@media (max-width: 767px) {
  .tnav__inner { flex-wrap: wrap; padding: 8px 8px 10px; gap: 8px 0; }
  .tnav__logo img { width: 142px; }
  .tnav__actions {
    order: 2;
    flex: 1 1 100%;
    margin-left: 0;
    display: grid;
    /* minmax(0, 1fr): tracks may shrink BELOW each item's min-content.
       Plain 1fr floors each track at its widest unbreakable label word,
       so enlarged system fonts (Android font scaling) inflated the
       floors past the container and clipped the More target off the
       right edge (real-device defect, 2026-11-19). Services carries the
       longest remaining label, so its track gets a modest extra share.
       Book uses its short label in this band (work order sec. 2 allows
       "Book" at very narrow widths); its accessible name stays
       "Book Appointment" via the link's aria-label. */
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 5px;
  }
  .tnav__actions > * { min-width: 0; }
  .tnav__ctl {
    height: 56px;
    flex-direction: column;
    gap: 3px;
    padding: 4px 1px;
    font-size: 11.5px;
    border-radius: 10px;
    white-space: normal;
    text-align: center;
    width: 100%;
  }
  .tnav__ctl > span { min-width: 0; overflow-wrap: anywhere; }
  .tnav__call-main { display: none; }
  .tnav__call-short { display: inline; }
  .tnav__book-text { flex-direction: column; gap: 0; line-height: 1.12; }
  .tnav__book-l2 { display: none; }
  .tnav__more-label { display: inline; }
  .tnav__drop { position: static; }
  .tnav__panel {
    left: 8px;
    right: 8px;
    top: calc(100% + 6px);
    width: auto;
    min-width: 0;
    max-height: min(64vh, 520px);
    overflow-y: auto;
  }
  .tnav__cities { max-height: none; overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  .tnav__chev { transition: none; }
}
