/* === THE TRAI / HL BATTERY v27 DE-AI & UX UPGRADE === */
/* Cohesive editorial polish, bug fixes, and unified interactive 5-branch map */

/* 1. Sticky header z-index fix (never overlapped by maps) */
header.top, nav.nav {
  z-index: 250 !important;
}
.mapfx, .mapfx iframe, .ct2-map, .ct2-map iframe {
  position: relative;
  z-index: 1;
}

/* 2. Cohesive Slim Group Bar for index / tungjai / growthfriend */
.v27-groupbar {
  background: #0f1b33;
  color: #dbe2f0;
  font-size: 12px;
  border-bottom: 2px solid #FFBC01;
}
.v27-groupbar .gb-in {
  max-width: 1180px;
  margin: 0 auto;
  padding: 6px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.v27-groupbar .gb-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  color: #b8c3d9;
}
.v27-groupbar .gb-left b { color: #FFBC01; }
.v27-groupbar .gb-pills {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,0.12);
  padding: 3px;
  border-radius: 20px;
}
.v27-groupbar .gb-pills a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px 5px 10px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  color: #e7e9ef;
  white-space: nowrap;
  transition: background .18s, color .18s;
}
.v27-groupbar .gb-pills a img {
  height: 14px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
}
.v27-groupbar .gb-pills a:hover {
  background: rgba(255,255,255,0.14);
}
.v27-groupbar .gb-pills a.active {
  background: #FFBC01;
  color: #14213D;
  font-weight: 700;
}
.v27-groupbar .gb-pills a.active img {
  filter: brightness(0) saturate(100%) invert(11%) sepia(32%) saturate(2250%) hue-rotate(196deg) brightness(95%) contrast(94%);
}

/* Clean up main header on index / tungjai / growthfriend */
body.v27-has-groupbar header.top .site-toggle-light {
  display: none !important;
}
body.v27-has-groupbar header.top .topwrap {
  padding: 12px 24px !important;
  flex-wrap: nowrap !important;
  gap: 20px !important;
}
body.v27-has-groupbar header.top .brandmark {
  flex-shrink: 0;
}
body.v27-has-groupbar header.top .wordmark {
  white-space: nowrap;
  line-height: 1.25;
}
body.v27-has-groupbar header.top .navcta {
  width: auto !important;
  flex-direction: row !important;
  align-items: center !important;
  margin-top: 0 !important;
  gap: 12px !important;
  flex-shrink: 0;
}
body.v27-has-groupbar header.top .navcta .btn-orange,
body.v27-has-groupbar header.top .navcta .btn-line,
body.v27-has-groupbar header.top .navcta .btn-gold {
  width: auto !important;
  white-space: nowrap;
  padding: 9px 18px !important;
  font-size: 13.5px !important;
}

@media (max-width: 900px) {
  .v27-groupbar .gb-in {
    padding: 6px 8px;
    justify-content: center;
  }
  .v27-groupbar .gb-left { display: none; }
  .v27-groupbar .gb-pills {
    width: 100%;
    max-width: 100%;
    justify-content: space-between;
    gap: 2px;
    padding: 3px;
  }
  .v27-groupbar .gb-pills a {
    padding: 5px 6px;
    gap: 4px;
    font-size: 10.5px;
    flex: 1 1 auto;
    justify-content: center;
  }
  .v27-groupbar .gb-pills a img {
    height: 11px;
  }
  .topbar .site-toggle {
    max-width: 100%;
    gap: 2px;
    padding: 3px;
  }
  .topbar .site-toggle a {
    padding: 4px 6px !important;
    gap: 4px !important;
    font-size: 10.5px !important;
  }
  .topbar .site-toggle a img {
    height: 11px !important;
  }
  @media (max-width: 440px) {
    .topbar .site-toggle a {
      padding: 4px 5px !important;
      gap: 3px !important;
      font-size: 9.8px !important;
    }
    .topbar .site-toggle a img {
      height: 10px !important;
    }
  }
  body.v27-has-groupbar header.top .topwrap {
    padding: 10px 14px !important;
    gap: 10px !important;
  }
  body.v27-has-groupbar header.top .wordmark small { display: none; }
  body.v27-has-groupbar header.top .navcta .btn-orange,
  body.v27-has-groupbar header.top .navcta .btn-line {
    padding: 7px 14px !important;
    font-size: 12.5px !important;
  }
  /* Prevent article & EN mobile nav links from clipping off right edge */
  nav.nav ul {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 6px 14px !important;
    white-space: normal !important;
  }
}
@media (max-width: 768px) {
  /* Give untouched footer clean clearance above fixed mobile .mbar */
  body {
    padding-bottom: 68px !important;
  }
}

/* 3. Fix topbar/nav spacing & unlabeled phone buttons on hlbattery/* */
.topbar .container {
  gap: 12px;
  flex-wrap: nowrap;
}
.topbar .container > div:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .right {
  gap: 12px !important;
  flex-shrink: 0;
}
.nav .container {
  gap: 14px;
}
.nav ul {
  gap: 18px !important;
  white-space: nowrap;
}
.nav-actions {
  gap: 8px !important;
  flex-shrink: 0;
}
.nav .call-btn, .nav .line-btn {
  white-space: nowrap;
}
@media (max-width: 1180px) {
  .topbar .right > span { display: none !important; }
  .nav .nav-actions .call-btn:nth-of-type(2) { display: none !important; }
}
@media (max-width: 900px) {
  .nav .call-btn {
    padding: 7px 12px !important;
    font-size: 12px !important;
    gap: 5px !important;
  }
  .nav .call-btn span {
    display: inline !important;
  }
  .nav .nav-actions .call-btn:nth-of-type(2) {
    display: none !important;
  }
}

/* 4. Editorial De-AI Card & Gallery Refinement */
.why-card, .procure-card, .svc-card, .check-card {
  border: 1px solid #e2e7f0 !important;
  border-top: 3px solid #14213D !important;
  border-radius: 10px !important;
  box-shadow: 0 2px 10px rgba(20, 33, 61, 0.04) !important;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.why-card:hover, .procure-card:hover, .svc-card:hover, .check-card:hover {
  border-top-color: #FFBC01 !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(20, 33, 61, 0.09) !important;
}

/* Fix orphan 9th photo in 2-col mobile gallery */
@media (max-width: 900px) {
  .gal figure:last-child:nth-child(odd),
  .gallery-grid > *:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    aspect-ratio: 16 / 9;
  }
}

/* 5. Visible 5-Branch Map Hub (Featured HQ Map + 4 Mini-Map Cards) */
.v27-map-hub {
  margin-top: 26px;
}
.v27-map-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 20px;
  background: #14213D;
  color: #fff;
  border-radius: 14px 14px 0 0;
}
.v27-map-filters .mf-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.v27-map-filters .mf-title .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #FFBC01;
  display: inline-block;
}
.v27-filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.v27-filter-tabs button {
  background: rgba(255,255,255,0.1);
  color: #e4e9f2;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
}
.v27-filter-tabs button.active,
.v27-filter-tabs button:hover {
  background: #FFBC01;
  color: #14213D;
  border-color: #FFBC01;
}
.v27-map-body {
  background: #f6f8fb;
  border: 1px solid #dfe5ef;
  border-top: none;
  border-radius: 0 0 14px 14px;
  padding: 20px;
}

/* Featured HQ Map Card (Full width, 2-col split: large visible map + HQ info) */
.v27-hq-card {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  background: #fff;
  border: 1px solid #dfe5ef;
  border-top: 4px solid #FFBC01;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(20, 33, 61, 0.07);
  margin-bottom: 18px;
}
.v27-hq-card.hidden-by-filter { display: none; }
.v27-hq-map {
  position: relative;
  min-height: 290px;
  background: #e9eef5;
}
.v27-hq-map iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.v27-hq-info {
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}
.v27-hq-badge {
  display: inline-block;
  align-self: flex-start;
  background: #FFBC01;
  color: #14213D;
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 11px;
  border-radius: 999px;
}
.v27-hq-info h3 {
  font-size: 21px;
  color: #14213D;
  margin: 0;
}
.v27-hq-info p {
  font-size: 13.5px;
  color: #525b6a;
  line-height: 1.7;
  margin: 0;
}
.v27-hq-meta {
  font-size: 13px;
  color: #2f7d4d;
  font-weight: 700;
}
.v27-hq-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* 4 Sub-branch Mini-Map Cards (clean 4-col on desktop, 2x2 on tablet/mobile — zero orphan!) */
.v27-sub-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.v27-sub-card {
  background: #fff;
  border: 1px solid #dfe5ef;
  border-top: 3px solid #14213D;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 14px rgba(20, 33, 61, 0.05);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.v27-sub-card:hover {
  transform: translateY(-2px);
  border-top-color: #FFBC01;
  box-shadow: 0 8px 22px rgba(20, 33, 61, 0.1);
}
.v27-sub-card.hidden-by-filter { display: none; }
.v27-sub-map {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #e9eef5;
}
.v27-sub-map iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.v27-sub-body {
  padding: 14px 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.v27-sub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.v27-sub-head b {
  font-size: 15px;
  color: #14213D;
}
.v27-sub-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2f8;
  color: #14213D;
  white-space: nowrap;
}
.v27-sub-addr {
  font-size: 12.5px;
  color: #5a6372;
  line-height: 1.55;
  flex: 1;
}
.v27-sub-btns {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}
.v27-sub-nav {
  flex: 1;
  text-align: center;
  background: #14213D;
  color: #fff !important;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 999px;
}
.v27-sub-nav:hover {
  background: #FFBC01;
  color: #14213D !important;
}
.v27-sub-more {
  font-size: 12px;
  font-weight: 700;
  color: #14213D;
  border-bottom: 1.5px solid #FFBC01;
  white-space: nowrap;
}
.v27-btn-nav {
  background: #14213D;
  color: #fff !important;
  font-weight: 700;
  font-size: 13.5px;
  padding: 9px 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.v27-btn-nav:hover {
  background: #FFBC01;
  color: #14213D !important;
}
.v27-btn-call {
  border: 1.5px solid #14213D;
  color: #14213D !important;
  font-weight: 700;
  font-size: 13.5px;
  padding: 8px 16px;
  border-radius: 999px;
}
.v27-map-pdpa {
  font-size: 12px;
  color: #6b7485;
  text-align: center;
  padding: 12px 16px 0;
}
.v27-map-pdpa a {
  color: #14213D;
  text-decoration: underline;
}

@media (max-width: 1080px) {
  .v27-sub-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .v27-hq-card { grid-template-columns: 1fr; }
  .v27-hq-map { min-height: 230px; }
  .v27-map-body { padding: 14px; }
}
@media (max-width: 560px) {
  .v27-sub-grid { grid-template-columns: 1fr; }
}

/* 6. Featured PUMA NA+ Editorial Spotlight Strip on hlbattery.html */
.v27-puma-spot {
  background: linear-gradient(135deg, #101d36 0%, #192d52 100%);
  color: #fff;
  padding: 46px 0;
  border-top: 3px solid #FFBC01;
  border-bottom: 3px solid #FFBC01;
}
.v27-puma-spot .ps-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 32px;
  align-items: center;
}
.v27-puma-spot .ps-kicker {
  display: inline-block;
  background: #FFBC01;
  color: #14213D;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 4px 12px;
  border-radius: 4px;
  margin-bottom: 14px;
}
.v27-puma-spot h2 {
  font-size: 27px;
  line-height: 1.38;
  margin-bottom: 12px;
  color: #fff;
}
.v27-puma-spot p {
  font-size: 14.5px;
  line-height: 1.85;
  color: #d6deed;
  margin-bottom: 18px;
}
.v27-puma-spot .ps-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.v27-puma-spot .ps-stat {
  border-left: 2px solid #FFBC01;
  padding-left: 12px;
}
.v27-puma-spot .ps-stat b {
  display: block;
  font-size: 20px;
  color: #FFBC01;
}
.v27-puma-spot .ps-stat span {
  font-size: 12px;
  color: #c5d0e6;
}
.v27-puma-spot .ps-media {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.v27-puma-spot .ps-media img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.16);
}
.v27-puma-spot .ps-media img:first-child {
  grid-column: 1 / -1;
  aspect-ratio: 16/9;
}
@media (max-width: 900px) {
  .v27-puma-spot .ps-grid { grid-template-columns: 1fr; }
  .v27-puma-spot h2 { font-size: 22px; }
}

/* 7. Executive Corporate B2B Industrial Sourcing Section (index.html & en/index.html) */
.v27-corp-sourcing {
  background: #F4F6FA;
  border-top: 1px solid #e1e6ef;
  border-bottom: 1px solid #e1e6ef;
  padding: 84px 0;
}
.v27-corp-sourcing .cs-header {
  max-width: 820px;
  margin-bottom: 38px;
}
.v27-corp-sourcing .cs-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: #14213D;
  margin-bottom: 12px;
}
.v27-corp-sourcing .cs-kicker::before {
  content: "";
  width: 28px;
  height: 3px;
  background: #FFBC01;
  display: inline-block;
}
.v27-corp-sourcing h2 {
  font-size: 32px;
  line-height: 1.32;
  color: #14213D;
  margin: 0 0 14px;
  font-weight: 700;
  letter-spacing: -0.3px;
  text-wrap: balance;
}
.v27-corp-sourcing .cs-lead {
  font-size: 15px;
  line-height: 1.85;
  color: #465063;
  margin: 0;
}
.v27-corp-shell {
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  background: #fff;
  border: 1px solid #dbe2ee;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(20, 33, 61, 0.08);
}
.v27-corp-navy {
  background: linear-gradient(155deg, #101c34 0%, #172748 100%);
  color: #fff;
  padding: 36px 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  position: relative;
}
.v27-corp-navy::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #FFBC01;
}
.v27-corp-navy .cn-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #FFBC01;
  margin-bottom: 14px;
}
.v27-spec-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.v27-spec-tab {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.05);
  color: #dbe3f2;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 12px 14px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  transition: all .18s ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.v27-spec-tab small {
  font-size: 11px;
  font-weight: 500;
  color: #9ba9c4;
}
.v27-spec-tab:hover {
  border-color: rgba(255,188,1,0.55);
  background: rgba(255,255,255,0.10);
}
.v27-spec-tab.active {
  background: #FFBC01;
  border-color: #FFBC01;
  color: #14213D;
}
.v27-spec-tab.active small {
  color: #2c3a57;
  font-weight: 600;
}
.v27-spec-panel {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-left: 3px solid #FFBC01;
  border-radius: 12px;
  padding: 22px 22px;
}
.v27-spec-panel .sp-cat {
  font-size: 12px;
  font-weight: 700;
  color: #FFBC01;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}
.v27-spec-panel h3 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 10px;
  line-height: 1.35;
}
.v27-spec-panel p {
  font-size: 14px;
  line-height: 1.8;
  color: #d4dceb;
  margin: 0 0 14px;
}
.v27-spec-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.v27-spec-chips span {
  background: rgba(255,255,255,0.11);
  border: 1px solid rgba(255,255,255,0.16);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 6px;
}
.v27-spec-note {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 12.5px;
  color: #b7c4dc;
  line-height: 1.65;
}
.v27-spec-note b { color: #FFBC01; }
.v27-corp-right {
  padding: 36px 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}
.v27-corp-right .cr-head {
  font-size: 16px;
  font-weight: 700;
  color: #14213D;
  padding-bottom: 12px;
  border-bottom: 2px solid #14213D;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.v27-corp-right .cr-head span {
  font-size: 12px;
  font-weight: 600;
  color: #6b768a;
}
.v27-cap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 22px;
  margin-top: 18px;
}
.v27-cap-item {
  padding-top: 14px;
  border-top: 1px solid #e5eaf2;
}
.v27-cap-item .ci-title {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 14.5px;
  font-weight: 700;
  color: #14213D;
  line-height: 1.45;
  margin-bottom: 5px;
}
.v27-cap-item .ci-title svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  margin-top: 2px;
  color: #14213D;
}
.v27-cap-item p {
  font-size: 13px;
  line-height: 1.65;
  color: #556074;
  margin: 0 0 0 26px;
}
.v27-corp-cta-box {
  background: #F6F8FC;
  border: 1px solid #dfe5f0;
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.v27-corp-cta-box .cc-text {
  font-size: 13.5px;
  color: #364154;
  line-height: 1.6;
  max-width: 310px;
}
.v27-corp-cta-box .cc-text b {
  display: block;
  color: #14213D;
  font-size: 14px;
  margin-bottom: 2px;
}
.v27-corp-cta-btns {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.v27-corp-cta-btns a.cb-gold {
  background: #FFBC01;
  color: #14213D;
  font-weight: 700;
  font-size: 13.5px;
  padding: 11px 22px;
  border-radius: 999px;
  white-space: nowrap;
}
.v27-corp-cta-btns a.cb-gold:hover { filter: brightness(0.95); }
.v27-corp-cta-btns a.cb-navy {
  border: 1.5px solid #14213D;
  color: #14213D;
  font-weight: 700;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 999px;
  white-space: nowrap;
}
.v27-corp-cta-btns a.cb-navy:hover {
  background: #14213D;
  color: #fff;
}
@media (max-width: 960px) {
  .v27-corp-sourcing { padding: 56px 0; }
  .v27-corp-sourcing h2 { font-size: 24px; }
  .v27-corp-shell { grid-template-columns: 1fr; }
  .v27-corp-navy, .v27-corp-right { padding: 26px 20px; }
}
@media (max-width: 560px) {
  .v27-spec-tabs, .v27-cap-grid { grid-template-columns: 1fr; }
}

