/* BusX Booking Home: หน้าแรกแบบเว็บจองตั๋ว */
body.bbh-home { overflow-x: hidden; }
.bbh-main { display: block; margin: 0; padding: 0; max-width: none; }

.bbh {
  --bbh-c: #1f40e6; --bbh-c-dark: #142a96; --bbh-c-soft: #e9ecfd; --bbh-a: #ff7a00;
  --bbh-ink: #1b2333; --bbh-muted: #5d6779; --bbh-line: #e3e7ef; --bbh-bg: #f4f6fb;
  --bbh-r: 16px; --bbh-shadow: 0 10px 30px rgba(17, 30, 70, .10);
  font-family: "IBM Plex Sans Thai", "Sarabun", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--bbh-ink); line-height: 1.6; font-size: 16px; background: var(--bbh-bg);
  -webkit-font-smoothing: antialiased;
}
.bbh *, .bbh *::before, .bbh *::after { box-sizing: border-box; }
.bbh h1, .bbh h2, .bbh h3 { font-family: inherit; color: inherit; margin: 0; padding: 0; letter-spacing: 0; text-transform: none; border: 0; background: none; }
.bbh p { margin: 0; }
.bbh a { text-decoration: none; box-shadow: none; }
.bbh ul, .bbh ol { list-style: none; margin: 0; padding: 0; }
.bbh-ic { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; }

/* เต็มความกว้างจอ แม้ธีมจะครอบด้วยกล่องแคบ */
.bbh-full { position: relative; width: 100vw; left: 50%; right: 50%; margin-left: -50vw; margin-right: -50vw; max-width: 100vw; }
.bbh-wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 20px; }

/* ภาพใหญ่ด้านบน */
.bbh-hero {
  position: relative; color: #fff; padding: 56px 0 64px;
  background: linear-gradient(135deg, var(--bbh-c-dark) 0%, var(--bbh-c) 60%, var(--bbh-c) 100%);
  /* ห้ามใช้ overflow:hidden เพราะจะตัดรายการเลือกต้นทาง/ปลายทางของกล่องค้นหาที่ลอยลงมาทับส่วนด้านล่าง */
}
.bbh-hero.has-img { background: var(--bbh-c-dark) var(--bbh-hero) center / cover no-repeat; }
.bbh-hero.has-img::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8, 16, 45, calc(var(--bbh-ov) * .6)) 0%, rgba(8, 16, 45, var(--bbh-ov)) 100%);
}
.bbh-hero:not(.has-img)::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 92% 0%, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 420px);
}
.bbh-hero.is-tall { padding: 110px 0 96px; }
.bbh-hero > .bbh-wrap { position: relative; z-index: 1; }
.bbh-search, .bbh-search-body, .bbh #busx-search-form { overflow: visible; }
.bbh-hero-text { text-align: center; max-width: 820px; margin: 0 auto 28px; }
.bbh .bbh-h1 { text-wrap: balance; font-size: clamp(1.7em, 1.1em + 2.4vw, 2.7em); font-weight: 700; line-height: 1.3; color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, .25); }
.bbh .bbh-lead { margin-top: 10px; font-size: clamp(1em, .95em + .3vw, 1.15em); color: rgba(255, 255, 255, .92); }
.bbh-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-top: 18px !important; }
.bbh-badges li { display: inline-flex; align-items: center; gap: 6px; font-size: .95em; color: #fff; }
.bbh-badges .bbh-ic { width: 20px; height: 20px; padding: 3px; border-radius: 50%; background: rgba(255, 255, 255, .2); stroke-width: 2.6; }

/* กล่องค้นหา */
.bbh-search {
  background: #fff; color: var(--bbh-ink); border-radius: var(--bbh-r); box-shadow: 0 18px 50px rgba(5, 15, 50, .28);
  max-width: 1100px; margin: 0 auto; padding: 18px 22px 22px; text-shadow: none;
}
.bbh-search-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.05em; color: var(--bbh-c); padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--bbh-line); }
.bbh-search-body { min-height: 120px; }
.bbh #busx-search-form { position: relative; min-height: 120px; }
.bbh #busx-search-form:empty::before {
  content: "กำลังโหลดกล่องค้นหา…"; position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--bbh-muted); border-radius: 10px;
  background: repeating-linear-gradient(90deg, #f3f5fa 0 25%, #fff 25% 26%);
}
.bbh-hint { font-size: .95em; background: #fff8e6; border: 1px dashed #e0a400; box-shadow: none; }
.bbh-hint a { color: var(--bbh-c); text-decoration: underline; }
.bbh-search-only { background: none; }

/* จุดเด่น */
.bbh-features { background: #fff; border-bottom: 1px solid var(--bbh-line); padding: 28px 0; }
.bbh-feat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.bbh-feat { display: flex; gap: 14px; align-items: flex-start; }
.bbh-feat-ic { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--bbh-c-soft); color: var(--bbh-c); }
.bbh-feat-ic .bbh-ic { width: 26px; height: 26px; }
.bbh .bbh-feat h3 { font-size: 1em; font-weight: 700; line-height: 1.4; }
.bbh-feat p { font-size: .9em; color: var(--bbh-muted); margin-top: 2px; line-height: 1.5; }

/* หัวข้อของแต่ละส่วน */
.bbh-sec { padding: 56px 0; }
.bbh-sec + .bbh-sec { padding-top: 8px; }
.bbh-sec-head { text-align: center; margin-bottom: 28px; }
.bbh .bbh-sec-head h2 { font-size: clamp(1.4em, 1.1em + 1vw, 1.9em); font-weight: 700; line-height: 1.35; }
.bbh-sec-head p { color: var(--bbh-muted); margin-top: 6px; }
.bbh-sec-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; text-align: left; }
.bbh-more { display: inline-flex; align-items: center; gap: 4px; color: var(--bbh-c) !important; font-weight: 600; white-space: nowrap; }

/* เส้นทางยอดนิยม */
.bbh-routes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.bbh-route {
  display: flex; flex-direction: column; background: #fff; border-radius: var(--bbh-r); overflow: hidden;
  box-shadow: var(--bbh-shadow); color: var(--bbh-ink) !important; transition: transform .18s ease, box-shadow .18s ease;
}
.bbh-route:hover { transform: translateY(-4px); box-shadow: 0 16px 36px rgba(17, 30, 70, .16); }
.bbh-route-img { height: 160px; position: relative; display: grid; place-items: center; background-size: cover; background-position: center; color: rgba(255, 255, 255, .85); }
.bbh-route-img.has-photo { background-color: #ccd3e6; transition: transform .3s ease; }
.bbh-route-img .bbh-ic { width: 56px; height: 56px; stroke-width: 1.4; }
.bbh-g0 { background-color: #2d55e8; background-image: linear-gradient(135deg, #1f40e6, #4f8cff); }
.bbh-g1 { background-color: #0f9d8a; background-image: linear-gradient(135deg, #0b8a7a, #3cc6a8); }
.bbh-g2 { background-color: #f07b2c; background-image: linear-gradient(135deg, #f0612c, #ffb347); }
.bbh-g3 { background-color: #7a4ce0; background-image: linear-gradient(135deg, #5b33c9, #a07cf5); }
.bbh-g4 { background-color: #d9416b; background-image: linear-gradient(135deg, #c22f5c, #f57c9a); }
.bbh-g5 { background-color: #1d8bd1; background-image: linear-gradient(135deg, #136fae, #4cc3f0); }
.bbh-route-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.bbh-route-name { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1em; flex-wrap: wrap; }
.bbh-route-name .bbh-ic { color: var(--bbh-c); }
.bbh-route-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.bbh-price { color: var(--bbh-a); font-weight: 700; font-size: 1.2em; }
.bbh-price small { color: var(--bbh-muted); font-weight: 400; font-size: .65em; margin-right: 2px; }
.bbh-route-btn { background: var(--bbh-c); color: #fff; padding: 7px 16px; border-radius: 999px; font-size: .9em; font-weight: 600; }
.bbh-route:hover .bbh-route-btn { background: var(--bbh-c-dark); }

/* ขั้นตอนการจอง */
.bbh-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: none; position: relative; }
.bbh-steps li { background: #fff; border-radius: var(--bbh-r); padding: 26px 22px; text-align: center; box-shadow: var(--bbh-shadow); position: relative; }
.bbh-step-n {
  display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; margin-bottom: 12px;
  background: var(--bbh-c); color: #fff; font-weight: 700; font-size: 1.35em; box-shadow: 0 0 0 6px var(--bbh-c-soft);
}
.bbh .bbh-steps h3 { font-size: 1.08em; font-weight: 700; }
.bbh-steps p { color: var(--bbh-muted); font-size: .95em; margin-top: 4px; }

/* บทความ */
.bbh-posts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.bbh-post { display: flex; flex-direction: column; background: #fff; border-radius: var(--bbh-r); overflow: hidden; box-shadow: var(--bbh-shadow); color: var(--bbh-ink) !important; transition: transform .18s ease; }
.bbh-post:hover { transform: translateY(-3px); }
.bbh-post-img { aspect-ratio: 16 / 9; background: var(--bbh-c-soft); color: var(--bbh-c); display: grid; place-items: center; overflow: hidden; }
.bbh-post-img img { width: 100%; height: 100%; object-fit: cover; display: block; margin: 0; max-width: none; border-radius: 0; }
.bbh-post-img .bbh-ic { width: 44px; height: 44px; opacity: .6; }
.bbh-post-body { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 4px; }
.bbh-post-date { font-size: .82em; color: var(--bbh-muted); }
.bbh-post-title { font-weight: 700; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bbh-post:hover .bbh-post-title { color: var(--bbh-c); }

/* เนื้อหาหน้าแรกเดิม */
.bbh-entry { background: #fff; border-radius: var(--bbh-r); padding: 28px; box-shadow: var(--bbh-shadow); }

/* แถบปิดท้าย */
.bbh-cta { background: linear-gradient(135deg, var(--bbh-c-dark), var(--bbh-c)); color: #fff; padding: 44px 0; margin-top: 24px; }
.bbh-cta .bbh-wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.bbh .bbh-cta h2 { font-size: clamp(1.3em, 1.1em + .8vw, 1.7em); font-weight: 700; color: #fff; }
.bbh-btn { display: inline-flex; align-items: center; gap: 8px; background: var(--bbh-a); color: #fff !important; padding: 13px 26px; border-radius: 999px; font-weight: 700; font-size: 1.05em; box-shadow: 0 8px 20px rgba(0, 0, 0, .2); transition: transform .15s ease; }
.bbh-btn:hover { transform: translateY(-2px); }

/* จอเล็ก */
@media (max-width: 960px) {
  .bbh-feat-grid { grid-template-columns: repeat(2, 1fr); }
  .bbh-routes, .bbh-posts { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .bbh-wrap { padding: 0 16px; }
  .bbh-hero { padding: 32px 0 36px; }
  .bbh-hero.is-tall { padding: 56px 0 48px; }
  .bbh-hero-text { margin-bottom: 20px; }
  .bbh-badges { gap: 6px 12px; }
  .bbh-badges li { font-size: .85em; }
  .bbh-search { padding: 14px 14px 16px; border-radius: 14px; }
  .bbh-feat-grid { grid-template-columns: 1fr; gap: 14px; }
  .bbh-routes, .bbh-posts, .bbh-steps { grid-template-columns: 1fr; gap: 14px; }
  .bbh-route { flex-direction: row; }
  .bbh-route-img { width: 96px; height: auto; min-height: 100px; }
  .bbh-route-img .bbh-ic { width: 36px; height: 36px; }
  .bbh-route-body { padding: 12px 14px; gap: 8px; }
  .bbh-route-name { font-size: 1em; }
  .bbh-sec { padding: 40px 0; }
  .bbh-sec-head { margin-bottom: 20px; }
  .bbh-cta .bbh-wrap { justify-content: center; text-align: center; }
  .bbh-post { flex-direction: row; }
  .bbh-post-img { aspect-ratio: auto; width: 112px; flex: none; min-height: 84px; }
  .bbh-post-body { padding: 10px 14px; justify-content: center; }
  .bbh-steps li { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; text-align: left; padding: 16px; align-items: center; }
  .bbh-step-n { grid-row: span 2; margin: 0; width: 42px; height: 42px; font-size: 1.1em; box-shadow: 0 0 0 4px var(--bbh-c-soft); }
  .bbh-steps p { margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .bbh-route, .bbh-post, .bbh-btn { transition: none; }
  html { scroll-behavior: auto; }
}
.bbh-search { transition: box-shadow .3s ease; }
.bbh-search.bbh-flash { box-shadow: 0 0 0 4px var(--bbh-a), 0 18px 50px rgba(5, 15, 50, .28); }

/* กล่องค้นหาใหม่ที่วางแทนกล่องเดิม (หน้าอื่นนอกจากหน้าแรก) */
.bbh-band { padding: 18px 0; background: linear-gradient(135deg, var(--bbh-c-dark), var(--bbh-c)); clear: both; }
.bbh-band { position: relative; }
.bbh-band.has-img { background: var(--bbh-c-dark) var(--bbh-hero) center / cover no-repeat; padding: 28px 0; }
.bbh-band.has-img::before { content: ""; position: absolute; inset: 0; background: rgba(8, 16, 45, var(--bbh-ov)); pointer-events: none; }
.bbh-band > .bbh-wrap { position: relative; z-index: 1; }
.bbh-band .bbh-search { box-shadow: 0 10px 30px rgba(5, 15, 50, .22); }
.bbh-band .bbh-search-head { padding-bottom: 8px; margin-bottom: 10px; }
@media (max-width: 640px) { .bbh-band, .bbh-band.has-img { padding: 14px 0; } }

/* โลโก้บริษัทรถ เลื่อนวน */
.bbh-carriers { background: #fff; overflow: hidden; }
.bbh-sec.bbh-carriers, .bbh-sec + .bbh-sec.bbh-carriers { padding: 44px 0 40px; }
.bbh-carriers + .bbh-sec { padding-top: 56px; }
.bbh-marquee {
  position: relative; overflow-x: auto; padding: 6px 0 14px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  scrollbar-width: none;
}
.bbh-marquee::-webkit-scrollbar { display: none; }
.bbh-marquee.is-on { overflow: hidden; }
.bbh-marquee-track { display: flex; width: max-content; animation: bbh-marquee var(--bbh-dur, 40s) linear infinite; }
.bbh-marquee:hover .bbh-marquee-track, .bbh-marquee:focus-within .bbh-marquee-track { animation-play-state: paused; }
@keyframes bbh-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.bbh .bbh-marquee-set { display: flex; gap: 18px; padding: 0 9px; margin: 0; flex: none; }
.bbh-marquee:not(.is-on) .bbh-marquee-set { justify-content: center; min-width: 100%; }
.bbh-marquee-set li { flex: none; }
.bbh-cr {
  position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: 172px; padding: 14px 12px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--bbh-line);
  color: var(--bbh-ink) !important; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  -webkit-tap-highlight-color: transparent;
}
a.bbh-cr:hover { transform: translateY(-4px); box-shadow: 0 12px 26px rgba(17, 30, 70, .14); border-color: transparent; }
a.bbh-cr:focus-visible { outline: 3px solid var(--bbh-c); outline-offset: 2px; }
.bbh-cr-logo { height: 64px; width: 100%; display: grid; place-items: center; }
.bbh-cr-logo img { max-height: 64px; max-width: 140px; width: auto; height: auto; object-fit: contain; margin: 0; transition: filter .25s ease, opacity .25s ease; }
.bbh-cr-text { font-weight: 700; color: var(--bbh-c); text-align: center; line-height: 1.3; }
.bbh-cr-name { font-size: .82em; color: var(--bbh-muted); text-align: center; line-height: 1.3; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bbh-carriers.is-gray .bbh-cr-logo img { filter: grayscale(1); opacity: .7; }
.bbh-carriers.is-gray .bbh-cr:hover .bbh-cr-logo img, .bbh-carriers.is-gray .bbh-cr:focus-visible .bbh-cr-logo img { filter: none; opacity: 1; }
/* เอฟเฟกต์ตอนคลิก */
.bbh-cr.bbh-tap { animation: bbh-tap .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes bbh-tap { 0% { transform: scale(1); } 35% { transform: scale(.9); } 100% { transform: scale(1); } }
.bbh-ripple {
  position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; pointer-events: none;
  background: var(--bbh-c); opacity: .35; transform: scale(0); animation: bbh-ripple .6s ease-out forwards;
}
@keyframes bbh-ripple { to { transform: scale(22); opacity: 0; } }
@media (max-width: 640px) {
  .bbh-cr { width: 136px; padding: 10px 8px; }
  .bbh-cr-logo { height: 50px; }
  .bbh-cr-logo img { max-height: 50px; max-width: 110px; }
  .bbh .bbh-marquee-set { gap: 12px; padding: 0 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .bbh-marquee-track, .bbh-cr.bbh-tap, .bbh-ripple { animation: none; }
}
