Files
web-at-transit-mock/ui/responsive.css
T
phattaranun.a 0a464b6b18 Fix horizontal overflow across the site on phone and tablet widths
- Add box-sizing: border-box and img/svg/video max-width:100% reset
- Add min-width:0 to grid/flex children so they can shrink (hero panel,
  layout grid, metric grid)
- Allow long text to wrap (mock-state query strings, long stop names)
- Topbar: hide CTA button until 1024px, hide brand subtitle until 768px,
  and wrap the bar onto two lines under 360px so nav is never cut off

Verified with headless Chrome at 320/375/414/640/768/1024/1280/1600px:
zero horizontal overflow on all 7 routes.
2026-09-12 15:41:45 +07:00

219 lines
11 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* ============================================================
AT Transit — Mobile-first responsive layer
------------------------------------------------------------
base = มือถือ (จอเล็กสุด iPhone 8 = 375px, รองรับ SE 320px)
ขยายขึ้นด้วย min-width:
≥480px มือถือใหญ่
≥640px มือถือใหญ่ / แท็บเล็ตเล็ก
≥768px iPad แนวตั้ง / แท็บเล็ต
≥1024px iPad แนวนอน / แล็ปท็อป
≥1280px คอม 19.5"–24"
≥1600px คอม 27" / 1440p+
หมายเหตุ: component ที่ router inject จาก partial (อยู่ใน #view)
ต้องใช้ prefix `#view` — เพราะ <style> ของ partial ถูก inject
ทีหลัง จึงต้องชนะด้วย specificity (ID > class)
============================================================ */
/* ---------- base: มือถือ ---------- */
html { -webkit-text-size-adjust: 100%; }
body { font-size: 15px; }
/* --- กัน overflow พื้นฐาน (padding/รูป/grid/ข้อความยาว ไม่ให้ล้นจอมือถือ) --- */
*, *::before, *::after { box-sizing: border-box; }
img, svg, video { max-width: 100%; height: auto; }
/* grid/flex child ต้อง shrink ได้ (กัน min-width:auto ล้น container) */
#view .mu-hero-panel > *,
#view .mu-layout-grid > *,
#view .mu-hero-metric-grid > *,
#view .mu-stop-summary-main { min-width: 0; }
/* ข้อความยาวไม่ break (เช่น mock state query string / ชื่อยาว) */
#view .mu-inline-context strong,
#view .mu-stop-hero-title,
#view .mu-stop-hero-sub { overflow-wrap: anywhere; }
.mu-container { padding: 0 16px; }
main.mu-container { padding-top: 24px; padding-bottom: 24px; }
/* --- topbar --- */
.mu-topbar-inner { gap: 8px; padding: 10px 14px; overflow-x: auto; scrollbar-width: none; }
.mu-topbar-inner::-webkit-scrollbar { display: none; }
.mu-logo-img { width: 36px; height: 36px; }
.mu-brand { gap: 8px; flex-shrink: 0; }
.mu-brand-title { font-size: .92rem; white-space: nowrap; }
.mu-brand-subtitle { display: none; } /* กันล้น — โผล่กลับ ≥640px */
.mu-nav { gap: 8px; margin-left: auto; flex-shrink: 0; }
.mu-nav a { font-size: .76rem; padding: 10px 2px; white-space: nowrap; } /* tap target ≥44px */
.mu-lang-switch { margin-left: 2px; padding: 2px; }
.mu-lang-btn { font-size: .68rem; padding: 5px 8px; }
.mu-action-btn { display: none; } /* กันล้นบนจอเล็ก — โผล่กลับ ≥640px */
/* --- hero (หน้าแรก) — ลดช่องว่างแนวตั้ง --- */
.mu-hero { padding: 20px 0 22px; }
.mu-hero h1 { font-size: clamp(1.6rem, 7vw, 2.4rem); margin-bottom: 10px; line-height: 1.28; }
.mu-badge { margin-bottom: 10px; padding: 5px 14px; }
.mu-hero-lead { margin: 0 0 8px; }
.mu-hero-actions { flex-direction: column; align-items: stretch; padding: 0 6px; margin-top: 10px; gap: 8px; }
.mu-pill-link { justify-content: center; padding: 11px 18px; font-size: .9rem; }
/* --- ตัวเลือกจังหวัด/สถานี (หน้าแรก) --- */
#view .mu-route-selector { flex-direction: column; align-items: stretch; gap: 8px; margin-top: 12px; }
#view .mu-route-selector select,
#view .mu-route-selector .mu-select-field,
#view .mu-route-selector .mu-select-arrow { width: 100%; }
#view .mu-select-arrow { transform: rotate(90deg); justify-content: center; }
/* --- marquee (สปอนเซอร์) — การ์ดเล็กลงบนมือถือ --- */
.mu-marquee-track { padding: 2px 0 10px; }
.mu-marquee-tile { width: 132px; height: 68px; margin-right: 10px; border-radius: 10px; }
/* --- โซนเส้นทาง + การ์ด — ระยะห่างกระชับ --- */
main.mu-container { padding-top: 14px; padding-bottom: 14px; }
.mu-zone { margin-bottom: 20px; }
.mu-zone-head { margin-bottom: 10px; gap: 10px; }
.mu-grid { gap: 12px; }
.mu-route-info { padding: 12px 12px 13px; }
.mu-route-name { margin-bottom: 6px; }
.mu-route-chip-wrap { gap: 6px; }
.mu-next-trip { padding: 3px 10px; font-size: .74rem; }
/* --- busStop --- */
#view .mu-hero-panel { grid-template-columns: 1fr; padding: 14px; gap: 12px; }
#view .mu-hero-title { font-size: 1.35rem; }
#view .mu-kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
#view .mu-toolbar { flex-direction: column; align-items: stretch; }
#view .mu-toolbar select,
#view .mu-toolbar .mu-btn { width: 100%; min-height: 44px; }
#view .mu-search-field { width: 100%; min-width: 0; }
#view .mu-province-strip {
display: flex; flex-wrap: nowrap; overflow-x: auto;
-webkit-overflow-scrolling: touch; padding-bottom: 6px;
}
#view .mu-province-strip a { white-space: nowrap; flex-shrink: 0; min-height: 40px; }
#view .mu-stop-grid { grid-template-columns: 1fr; gap: 12px; }
#view .mu-hero-map { min-height: 200px; }
/* --- busDetail / expanded --- */
#view .mu-layout-grid { grid-template-columns: 1fr; gap: 12px; }
#view .mu-page-title { font-size: 1.45rem; }
#view .mu-route-hero { padding: 16px; }
#view .mu-info-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
#view .mu-panel,
#view .mu-card-panel { padding: 14px; }
#view .mu-photo-strip { grid-template-columns: repeat(2, 1fr); gap: 8px; }
#view .mu-quickpick { display: flex; flex-wrap: wrap; gap: 8px; }
#view .mu-inline-actions { flex-wrap: wrap; }
#view .mu-back-btn { width: 100%; justify-content: center; padding: 10px; }
#view .mu-schedule-note { font-size: .82rem; }
/* --- stopDetail --- */
#view .mu-hero-metric-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
#view .mu-live-clock-card { padding: 14px; }
#view .mu-stop-summary-rail { flex-wrap: wrap; }
#view .mu-time-chip { min-width: 0; }
#view .mu-contact-row { flex-wrap: wrap; }
/* --- credits --- */
#view .mu-credit-wrap { padding: 24px 16px 40px; }
#view .mu-credit-hero h1 { font-size: 1.5rem; }
#view .mu-credit-section { padding: 16px; }
/* --- footer --- */
.mu-site-footer { margin-top: 24px; padding: 28px 0 0; }
.mu-site-footer .mu-container { padding: 0 16px; }
.mu-footer-grid { grid-template-columns: 1fr; gap: 20px; }
.mu-sponsor-strip { grid-template-columns: repeat(2, 1fr); gap: 8px; }
/* --- จอแคบมาก (≤360px): topbar ห่อแถว ไม่ให้ nav ถูกตัด --- */
@media (max-width: 360px) {
.mu-topbar-inner { flex-wrap: wrap; }
.mu-nav { order: 3; width: 100%; justify-content: space-between; margin-left: 0; }
.mu-lang-switch { margin-left: auto; }
}
/* ============================================================
≥480px — มือถือใหญ่
============================================================ */
@media (min-width: 480px) {
.mu-topbar-inner { padding: 12px 18px; }
.mu-hero-actions { flex-direction: row; justify-content: center; }
.mu-pill-link { width: auto; }
#view .mu-stop-grid { grid-template-columns: repeat(2, 1fr); }
#view .mu-photo-strip { grid-template-columns: repeat(3, 1fr); }
.mu-sponsor-strip { grid-template-columns: repeat(3, 1fr); }
}
/* ============================================================
≥640px — มือถือใหญ่ / แท็บเล็ตเล็ก
============================================================ */
@media (min-width: 640px) {
body { font-size: 16px; }
.mu-container { padding: 0 28px; }
.mu-brand-title { font-size: 1.05rem; }
.mu-topbar-inner { gap: 18px; padding: 14px 28px; overflow: visible; }
.mu-logo-img { width: 44px; height: 44px; }
.mu-nav { gap: 24px; }
.mu-nav a { font-size: .92rem; }
.mu-lang-btn { font-size: .72rem; padding: 6px 10px; }
.mu-hero { padding: 44px 0 52px; }
.mu-hero-actions { margin-top: 14px; }
.mu-marquee-tile { width: 170px; height: 96px; margin-right: 16px; }
#view .mu-route-selector { flex-direction: row; align-items: flex-end; justify-content: center; }
#view .mu-route-selector select,
#view .mu-route-selector .mu-select-field { width: auto; }
#view .mu-select-arrow { transform: none; }
#view .mu-toolbar { flex-direction: row; flex-wrap: wrap; align-items: center; }
#view .mu-toolbar select,
#view .mu-toolbar .mu-btn { width: auto; }
#view .mu-search-field { flex: 1; min-width: 200px; }
#view .mu-back-btn { width: auto; }
.mu-footer-grid { grid-template-columns: 1fr 1fr; }
}
/* ============================================================
≥768px — iPad แนวตั้ง / แท็บเล็ต
============================================================ */
@media (min-width: 768px) {
.mu-brand-subtitle { display: block; font-size: .72rem; }
#view .mu-kpi-grid { grid-template-columns: repeat(4, 1fr); }
#view .mu-info-grid { grid-template-columns: repeat(4, 1fr); }
#view .mu-hero-metric-grid { grid-template-columns: repeat(4, 1fr); }
#view .mu-photo-strip { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
#view .mu-hero-panel { grid-template-columns: 1.1fr .9fr; padding: 18px; }
.mu-footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1.1fr; }
.mu-sponsor-strip { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
}
/* ============================================================
≥1024px — iPad แนวนอน / แล็ปท็อป
============================================================ */
@media (min-width: 1024px) {
.mu-hero { padding: 56px 0 64px; }
.mu-action-btn { display: inline-flex; }
.mu-hero h1 { font-size: clamp(2.2rem, 4vw, 3rem); }
.mu-hero-actions { padding: 0; }
#view .mu-layout-grid { grid-template-columns: 1.35fr .9fr; gap: 16px; }
#view .mu-hero-title { font-size: 1.8rem; }
#view .mu-hero-map { min-height: auto; }
#view .mu-photo-strip { gap: 10px; }
}
/* ============================================================
≥1280px — คอม 19.5"–24"
============================================================ */
@media (min-width: 1280px) {
.mu-container { max-width: 1200px; }
#view .mu-stop-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
#view .mu-credit-wrap { padding: 40px 28px 56px; }
}
/* ============================================================
≥1600px — คอม 27" / 1440p+
============================================================ */
@media (min-width: 1600px) {
body { font-size: 17px; }
.mu-container { max-width: 1280px; }
#view .mu-photo-strip { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
#view .mu-stop-grid { grid-template-columns: repeat(4, 1fr); }
}