/* mobile-bar.css: the contact bar fixed to the bottom of the phone screen, wireframe "ส่วนที่ 12" (first half), for krobjobsystem.com (28 พ.ย. 2569).
   The owner chose variant C 28 พ.ย. 2569 (mobile-bar/final.html). The other half of ส่วนที่ 12, the PDPA cookie banner, lives in cookie/cookie.css (variant A).
   One file serves all three variants: the bar is <nav class="mb mb-a"> (or mb-b, mb-c). The variant class only swaps colours and the button layout; sizes, focus rings and the show/hide behaviour are shared.
     A: white bar, two equal buttons: gold "แชต LINE" (Lucide message-circle) and outlined navy "โทร 087-407-9191" (Lucide phone).
     B: white bar, one gold full-width "นัด Demo ทาง LINE" and a 48 x 48 outlined icon-only phone button on the right.
     C: navy bar, gold "แชต LINE" and the phone number as a white text link with its icon.
   Two classes, two jobs:
     .mb        the look of the bar. On its own it is a normal block, so the choice page can show it inside a 390 px phone box.
     .mb-fixed  the real thing: fixed to the bottom of the viewport, phone only. It is hidden from a 900 px viewport up. This is the one
                media query of the file, because the bar is fixed to the viewport and not to a container; inside the bar the layout uses
                container queries on .mb (container-type: inline-size), so the same markup also lays out right in the phone box.
   Show and hide (mobile-bar.js): without JavaScript the bar simply shows and the page gets bottom padding the height of the bar, so it never
   covers the end of the page. With JavaScript the script writes data-mb="on" or data-mb="off" on <html>; "off" while the hero, #pricing
   (which holds #demo and its gold button) or the footer is on screen, so the screen never shows two gold buttons (DESIGN.md: one gold point
   per screen). The hidden state is visibility: hidden, so hidden buttons are out of the Tab order and the accessibility tree, and the bottom
   padding goes away with the bar. prefers-reduced-motion: no slide, the bar just shows and hides.
   Cookie banner: while it is open cookie.js puts the class kj-ck-open on <html>; the bar then hides the same way (slide down, visibility hidden)
   and drops its bottom padding, so the two bars never share the bottom edge and cookie.css alone pads the page by the banner height.
   Clip box (clip/clip.js, 28 พ.ย. 2569): while the floating video box is open clip.js puts the class kj-clip-open on <html>; the bar hides
   the same way (visibility hidden, out of the Tab order) and comes back when the box closes. Its bottom padding stays, so the page behind
   the box does not move.
   Colour tokens come from the page's :root block (index.html today, the site's global tokens later): --navy --gold --white --h-tint --h-line
   --navy-muted --navy-line --font-body. Everything in px or ms below is declared once as a custom property, so the rules only ever use var(). */

/* ---------- size tokens ---------- */
/* on :root, not on .mb, because the page bottom padding (on body) needs the bar height too */
:root {
  --mb-btn: 48px;            /* DESIGN.md: every button at least 48 px tall; also the side of B's square phone button */
  --mb-pad: 8px;             /* bar padding above and below the buttons, and at the sides */
  --mb-gap: 8px;             /* between the two controls */
  --mb-btn-pad: 8px;         /* side padding inside a button (the hero's 24 px does not fit two buttons on a 390 px phone) */
  --mb-btn-radius: 10px;     /* the hero's flat button radius, same as pricing-demo.css */
  --mb-btn-border: 2px;
  --mb-icon: 20px;           /* Lucide, stroke 2 */
  --mb-icon-gap: 6px;
  --mb-fs: 16px;
  --mb-lh: 1.4;
  --mb-hair: 1px;
  --mb-ring: 3px;
  --mb-ring-gap: 2px;
  --mb-max: 640px;           /* the two controls never spread wider than this (matters only if the owner keeps the bar on tablets) */
  --mb-digits: 0.02em;       /* tabular digits of the phone number, same as .mono of pricing-demo.css */
  --mb-z: 50;
  --mb-slide: 240ms;
  --mb-now: 0ms;             /* no delay / no duration, for the visibility switch */
  --mb-ease: cubic-bezier(0.16, 1, 0.3, 1);   /* exponential ease-out */
  --mb-shadow: 0 -12px 32px rgba(10, 22, 40, .08);   /* --h-shadow with the y offset flipped, so it falls upward over the page */
  --mb-gutter-l: max(var(--mb-pad), env(safe-area-inset-left, 0px));
  --mb-gutter-r: max(var(--mb-pad), env(safe-area-inset-right, 0px));
  --mb-safe-b: env(safe-area-inset-bottom, 0px);
  /* the full height of the fixed bar: top hairline + padding + button + padding + the home indicator area (65 px + safe area) */
  --mb-h: calc(var(--mb-hair) + var(--mb-btn) + var(--mb-pad) * 2 + var(--mb-safe-b));
}

/* ---------- the bar (all variants) ---------- */
.mb {
  container-type: inline-size;
  container-name: mb;
  /* variant colours, A by default */
  --mb-bg: var(--white);
  --mb-top: var(--h-line);
  --mb-ink: var(--navy);
  --mb-ring-c: var(--navy);
  --mb-out-bg: var(--white);
  --mb-out-ink: var(--navy);
  --mb-out-border: var(--navy);
  --mb-out-hover: var(--h-tint);
  background: var(--mb-bg);
  color: var(--mb-ink);
  border-top: var(--mb-hair) solid var(--mb-top);
  box-shadow: var(--mb-shadow);
  padding-top: var(--mb-pad);
  padding-bottom: calc(var(--mb-pad) + var(--mb-safe-b));
  padding-left: var(--mb-gutter-l);
  padding-right: var(--mb-gutter-r);
  font-family: var(--font-body);
  font-size: var(--mb-fs);
  line-height: var(--mb-lh);
}
.mb[hidden] { display: none; }
.mb-in {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--mb-gap);
  max-width: var(--mb-max);
  margin-inline: auto;
}

/* ---------- controls ---------- */
.mb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--mb-icon-gap);
  min-width: 0;
  min-height: var(--mb-btn);
  padding: 0 var(--mb-btn-pad);
  border: var(--mb-btn-border) solid transparent;
  border-radius: var(--mb-btn-radius);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mb-btn svg { width: var(--mb-icon); height: var(--mb-icon); flex: none; }
.mb-btn:active { transform: translateY(1px); }
.mb-btn:focus-visible { outline: var(--mb-ring) solid var(--mb-ring-c); outline-offset: var(--mb-ring-gap); }
/* the single gold point of the screen while the bar shows: gold ground, navy 700 label; hover keeps the gold and adds a 2 px navy inner border (DESIGN.md) */
.mb-gold { background: var(--gold); color: var(--navy); border-color: var(--gold); font-weight: 700; }
.mb-gold:hover { background: var(--gold); color: var(--navy); border-color: var(--gold); box-shadow: inset 0 0 0 var(--mb-btn-border) var(--navy); }
/* the outlined secondary button: white ground, navy border and label, tint on hover */
.mb-out { background: var(--mb-out-bg); color: var(--mb-out-ink); border-color: var(--mb-out-border); }
.mb-out:hover { background: var(--mb-out-hover); color: var(--mb-out-ink); border-color: var(--mb-out-border); }
.mb-num { font-variant-numeric: tabular-nums; letter-spacing: var(--mb-digits); }
.nw { white-space: nowrap; }

/* A on phones narrower than about 388 px (iPhone SE 375, iPhone mini, 360 px Androids): the word โทร is dropped from view, the number and icon
   stay, and the accessible name stays "โทร 087-407-9191". The query reads the bar's content width (viewport minus 16 px). Measured in Chrome
   with Noto Sans Thai: the full label needs 179 px (icon 20 + gap 6 + text 133 + padding 16 + border 4), the button is 183 px at a 390 px
   viewport and 175 px at 375 px. Under about 328 px (the 320 px iPhone SE of 2016) the number with its icon needs 152 px and the button is
   148 px, so the phone icon goes too and the number stands alone (126 px). */
@container mb (max-width: 371.98px) {
  .mb-a .mb-word { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
}
@container mb (max-width: 311.98px) {
  .mb-a .mb-out svg { display: none; }
}

/* ---------- B: one wide gold button and a square phone button ---------- */
.mb-b .mb-in { grid-template-columns: minmax(0, 1fr) var(--mb-btn); }
.mb-b .mb-sq { width: var(--mb-btn); padding: 0; }

/* ---------- C: navy bar ---------- */
.mb-c {
  --mb-bg: var(--navy);
  --mb-top: var(--navy-line);
  --mb-ink: var(--white);
  --mb-ring-c: var(--white);
}
.mb-c .mb-in { grid-template-columns: minmax(0, 1fr) auto; }
/* the phone number as a white text link with its icon, 48 px tall like the button beside it; underline 1px muted, 2 px white on hover */
.mb-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--mb-icon-gap);
  min-height: var(--mb-btn);
  padding: 0 var(--mb-btn-pad);
  border-radius: var(--mb-btn-radius);
  color: var(--white);
  font-weight: 500;
  white-space: nowrap;
  text-decoration: underline;
  text-decoration-thickness: var(--mb-hair);
  text-underline-offset: 0.25em;
  text-decoration-color: var(--navy-muted);
  -webkit-tap-highlight-color: transparent;
}
.mb-link svg { width: var(--mb-icon); height: var(--mb-icon); flex: none; }
.mb-link:hover { color: var(--white); text-decoration-color: var(--white); text-decoration-thickness: var(--mb-btn-border); }
.mb-link:active { transform: translateY(1px); }
.mb-link:focus-visible { outline: var(--mb-ring) solid var(--mb-ring-c); outline-offset: var(--mb-ring-gap); }

/* ---------- the fixed bar on the real page ---------- */
.mb-fixed {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--mb-z);
  transform: translateY(0);
  visibility: visible;
  /* showing: slide up, visibility switches at once */
  transition: transform var(--mb-slide) var(--mb-ease), visibility var(--mb-now) linear var(--mb-now);
}
/* hidden by the script, or while the cookie banner is open: out of view, out of the Tab order (visibility), slide down then hide */
html[data-mb="off"] .mb-fixed,
html.kj-ck-open .mb-fixed,
html.kj-clip-open .mb-fixed {
  visibility: hidden;
  transform: translateY(100%);
  box-shadow: none;
  transition: transform var(--mb-slide) var(--mb-ease), visibility var(--mb-now) linear var(--mb-slide);
}
/* page bottom padding the height of the bar, so the end of the page is never covered; it goes away while the script hides the bar */
@media (max-width: 899.98px) {
  html:not([data-mb="off"]):not(.kj-ck-open) body:has(.mb-fixed:not([hidden])) { padding-bottom: var(--mb-h); }
}
/* tablets and computers: no bar (the header menu and the #demo panel are on screen) */
@media (min-width: 900px) {
  .mb-fixed { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .mb-fixed,
  html[data-mb="off"] .mb-fixed,
  html.kj-ck-open .mb-fixed,
  html.kj-clip-open .mb-fixed { transition: none; transform: none; }
  .mb-btn:active, .mb-link:active { transform: none; }
}
@media print {
  .mb-fixed { display: none; }
}
