/* cookie.css: the PDPA cookie banner and the cookie settings dialog for krobjobsystem.com (28 พ.ย. 2569, second half of wireframe ส่วนที่ 12).
   Owner decision 28 พ.ย. 2569: the site runs Google Analytics and Facebook Pixel, so it asks first. cookie.js shows the banner only when no valid choice is stored; without JavaScript the banner stays hidden and no tracking script ever loads.
   One file serves the three banner variants: <section class="ck"> also carries ck-a, ck-b or ck-c, and that class only swaps the surface and the button layout. The copy, the type, the 48 px buttons and the focus ring are shared.
   A: full-width white bar on the bottom edge, 1 px top line, text left and the buttons right from a 900 px container; since 29 พ.ย. 2569 also a soft shadow cast upward (--c-shadow) so the bar reads as floating over the page, not cut into it (owner: the bar stays white).
   B: white card bottom-left, 24 px from the edges, max 420 px, buttons stacked.
   C: navy bar, white text, white outlined buttons.
   PDPA parity: "ยอมรับทั้งหมด" and "ปฏิเสธ" are the same button (same size, same outline, same row, equal columns); "ตั้งค่า" is a text button with a 44 px hit area. No gold anywhere here: the page's gold button stays the one gold point of the screen.
   The dialog (.ck-dlg) is shared by all three variants: a native <dialog> opened with showModal(), so Esc closes it and the page behind is inert; the switches are real checkboxes with role="switch".
   Layout rules use container queries on the banner and the dialog themselves (each is a container), so the same markup lays out on the viewport (demo.html, the site) and inside the 390 px phone box of the choice page index.html.
   Colour tokens come from the page's :root block (index.html and demo.html today, the site's global tokens later): --navy --blue --white --h-ink --h-muted --h-line --h-tint --h-shadow --font-head --font-body. Every px and ms below is declared once as a custom property, so the rules only ever use var(). */

/* ---------- size and colour tokens, shared by the banner and the dialog ---------- */
.ck, .ck-dlg {
  --c-fs-h: 18px;          /* banner heading */
  --c-fs-dlg-h: 22px;      /* dialog title */
  --c-fs: 15px;            /* banner line, dialog row descriptions */
  --c-fs-btn: 16px;        /* button labels, the settings text button, row names */
  --c-fs-sm: 13px;         /* "เปิดตลอด" tag */
  --c-lh: 1.6;
  --c-lh-h: 1.3;
  --c-lh-btn: 1.4;
  --c-btn: 48px;           /* DESIGN.md: every button at least 48 px tall */
  --c-btn-pad: 20px;
  --c-btn-radius: 10px;
  --c-btn-border: 2px;
  --c-tap: 44px;           /* text button, close button, switch hit area */
  --c-link-pad: 10px;      /* inline policy link: vertical padding that grows the hit area, not the line box */
  --c-icon: 20px;
  --c-ring: 3px;
  --c-ring-gap: 2px;
  --c-hair: 1px;
  --c-ul: 1px;
  --c-ul-hover: 2px;
  --c-ul-gap: 3px;
  --c-radius: 12px;
  --c-radius-sm: 6px;
  --c-s1: 4px;
  --c-s2: 8px;
  --c-s3: 12px;
  --c-s4: 16px;
  --c-s5: 20px;
  --c-s6: 24px;
  --c-s7: 32px;
  --c-wrap: 1200px;        /* bar content width (A and C) */
  --c-card: 420px;         /* B card width */
  --c-edge: 24px;          /* B card distance from the viewport edges */
  --c-measure: 40em;
  --c-dlg-w: 560px;
  --c-gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --c-gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --c-safe-b: env(safe-area-inset-bottom, 0px);
  --c-safe-l: env(safe-area-inset-left, 0px);
  --c-z: 1000;
  /* the switch: 48 x 28 track, 22 px thumb, inside a 52 x 44 hit box */
  --c-sw-hit-w: 52px;
  --c-sw-w: 48px;
  --c-sw-h: 28px;
  --c-sw-knob: 22px;
  --c-sw-inset: 3px;
  --c-sw-travel: 20px;     /* track width - knob - 2 x inset */
  --c-sw-halo: 4px;        /* hover ring around the track */
  /* motion: one rise of the banner, one fade of the dialog, both off under prefers-reduced-motion */
  --c-rise: 16px;
  --c-dur: 240ms;
  --c-dur-sw: 160ms;
  --c-ease: cubic-bezier(.16, 1, .3, 1);
  /* colours: A and the dialog are the defaults (white surface) */
  --c-bg: var(--white);
  --c-ink: var(--h-ink);
  --c-head: var(--navy);
  --c-muted: var(--h-muted);
  --c-link: var(--blue);
  --c-line: var(--h-line);
  --c-btn-bg: var(--white);
  --c-btn-ink: var(--navy);
  --c-btn-line: var(--navy);
  --c-btn-hover: var(--h-tint);
  --c-ring-c: var(--navy);
  --c-sel: var(--navy);
  --c-sel-ink: var(--white);
  --c-sw-off: var(--h-muted);
  --c-sw-on: var(--navy);
  --c-sw-fixed: color-mix(in srgb, var(--navy) 60%, var(--white));
  --c-sw-knob-c: var(--white);
  --c-halo: color-mix(in srgb, var(--navy) 12%, transparent);
  --c-backdrop: color-mix(in srgb, var(--navy, #0a1628) 55%, transparent);
  /* A only (owner 29 พ.ย. 2569): the white bar stays white and lifts off the page with a soft navy shadow cast upward, 4 px up, 16 px blur, 12 % navy, the same mix as --c-halo. It shows on the light sections (hero, tint pricing); over the navy footer the white surface itself and the 1 px --h-line top edge carry the separation. */
  --c-shadow: 0 -4px 16px color-mix(in srgb, var(--navy) 12%, transparent);

  box-sizing: border-box;
  color: var(--c-ink);
  font-family: var(--font-body);
  font-size: var(--c-fs);
  line-height: var(--c-lh);
  -webkit-text-size-adjust: 100%;
}
/* C: navy bar, white type, white outlines, white focus ring */
.ck-c {
  --c-bg: var(--navy);
  --c-ink: var(--white);
  --c-head: var(--white);
  --c-link: var(--white);
  --c-line: transparent;
  --c-btn-bg: transparent;
  --c-btn-ink: var(--white);
  --c-btn-line: var(--white);
  --c-btn-hover: color-mix(in srgb, var(--white) 16%, var(--navy));
  --c-ring-c: var(--white);
  --c-sel: var(--white);
  --c-sel-ink: var(--navy);
}

.ck *, .ck *::before, .ck *::after,
.ck-dlg *, .ck-dlg *::before, .ck-dlg *::after { box-sizing: border-box; }
.ck h2, .ck p, .ck-dlg h2, .ck-dlg p { margin: 0; }
.ck ::selection, .ck-dlg ::selection { background: var(--c-sel); color: var(--c-sel-ink); }
.ck .nw, .ck-dlg .nw { white-space: nowrap; }

/* ---------- the banner ---------- */
.ck {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--c-z);
  container: ck / inline-size;
  background: var(--c-bg);
  border-top: var(--c-hair) solid var(--c-line);
  animation: ck-rise var(--c-dur) var(--c-ease);
}
.ck-a { box-shadow: var(--c-shadow); }
.ck[hidden] { display: none; }
@keyframes ck-rise { from { transform: translateY(var(--c-rise)); } }
@media (prefers-reduced-motion: reduce) { .ck { animation: none; } }

.ck-in {
  width: 100%;
  max-width: var(--c-wrap);
  margin: 0 auto;
  padding: var(--c-s4) var(--c-gutter-r) calc(var(--c-s4) + var(--c-safe-b)) var(--c-gutter-l);
  display: grid;
  gap: var(--c-s3);
}
.ck-text { display: grid; gap: var(--c-s1); min-width: 0; }
.ck-h {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: var(--c-fs-h);
  line-height: var(--c-lh-h);
  color: var(--c-head);
}
.ck-p { max-width: var(--c-measure); color: var(--c-ink); text-wrap: pretty; }

/* the policy link sits inside the sentence; vertical padding grows its hit area to 44 px without growing the line box */
.ck-pol, .ck-dlg-pol {
  padding-block: var(--c-link-pad);
  color: var(--c-link);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: var(--c-ul);
  text-underline-offset: var(--c-ul-gap);
  white-space: nowrap;
}
.ck-pol:hover, .ck-dlg-pol:hover { text-decoration-thickness: var(--c-ul-hover); }

/* actions: accept and reject are one equal pair (two 1fr columns, so the wider label sets both widths), the settings text button follows */
.ck-act { display: grid; gap: var(--c-s2); }
.ck-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--c-s2); }
.ck-act .ck-set { justify-self: center; }

@container ck (min-width: 600px) {
  .ck-act { display: flex; flex-wrap: wrap; align-items: center; gap: var(--c-s3); }
  .ck-pair { grid-template-columns: 1fr 1fr; }
  .ck-act .ck-set { justify-self: auto; }
}
@container ck (min-width: 900px) {
  .ck-in { grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: var(--c-s7); }
}

/* B: the floating card */
.ck-b {
  left: calc(var(--c-edge) + var(--c-safe-l));
  right: auto;
  bottom: calc(var(--c-edge) + var(--c-safe-b));
  width: calc(100% - var(--c-edge) - var(--c-edge));
  max-width: var(--c-card);
  border: var(--c-hair) solid var(--c-line);
  border-radius: var(--c-radius);
  box-shadow: var(--h-shadow);
}
.ck-b .ck-in { padding: var(--c-s6); gap: var(--c-s4); grid-template-columns: minmax(0, 1fr); }
.ck-b .ck-act { display: grid; }
.ck-b .ck-pair { grid-template-columns: minmax(0, 1fr); }
.ck-b .ck-act .ck-set { justify-self: center; }

/* ---------- buttons, shared by the banner and the dialog ---------- */
.ck-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--c-btn);
  padding: 0 var(--c-btn-pad);
  margin: 0;
  border: var(--c-btn-border) solid var(--c-btn-line);
  border-radius: var(--c-btn-radius);
  background: var(--c-btn-bg);
  color: var(--c-btn-ink);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--c-fs-btn);
  line-height: var(--c-lh-btn);
  white-space: nowrap;
  cursor: pointer;
}
.ck-btn:hover { background: var(--c-btn-hover); color: var(--c-btn-ink); border-color: var(--c-btn-line); }
.ck-btn:active { transform: translateY(var(--c-hair)); }

/* the settings text button: looks like a link, is a button (it opens the dialog) */
.ck-set {
  display: inline-flex;
  align-items: center;
  min-height: var(--c-tap);
  padding: 0 var(--c-s2);
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--c-link);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--c-fs-btn);
  line-height: var(--c-lh-btn);
  text-decoration: underline;
  text-decoration-thickness: var(--c-ul);
  text-underline-offset: var(--c-ul-gap);
  cursor: pointer;
}
.ck-set:hover { text-decoration-thickness: var(--c-ul-hover); }

.ck a:focus-visible, .ck button:focus-visible,
.ck-dlg a:focus-visible, .ck-dlg button:focus-visible {
  outline: var(--c-ring) solid var(--c-ring-c);
  outline-offset: var(--c-ring-gap);
  border-radius: var(--c-radius-sm);
}
.ck .ck-btn:focus-visible, .ck-dlg .ck-btn:focus-visible { border-radius: var(--c-btn-radius); }

/* ---------- the settings dialog ---------- */
.ck-dlg {
  container: ckd / inline-size;
  width: calc(100% - var(--c-gutter-l) - var(--c-gutter-r));
  max-width: var(--c-dlg-w);
  max-height: calc(100dvh - var(--c-s7));
  padding: 0;
  border: var(--c-hair) solid var(--c-line);
  border-radius: var(--c-radius);
  background: var(--c-bg);
  box-shadow: var(--h-shadow);
  overflow: auto;
  overscroll-behavior: contain;
}
.ck-dlg::backdrop { background: var(--c-backdrop, rgba(10, 22, 40, .55)); }
.ck-dlg[open] { animation: ck-fade var(--c-dur) var(--c-ease); }
@keyframes ck-fade { from { opacity: 0; transform: translateY(var(--c-s2)); } }
@media (prefers-reduced-motion: reduce) { .ck-dlg[open] { animation: none; } }

.ck-dlg-in { display: grid; gap: var(--c-s4); padding: var(--c-s5); }
@container ckd (min-width: 480px) { .ck-dlg-in { padding: var(--c-s6); } }
.ck-dlg-top { display: flex; align-items: center; justify-content: space-between; gap: var(--c-s3); }
.ck-dlg-h {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: var(--c-fs-dlg-h);
  line-height: var(--c-lh-h);
  color: var(--c-head);
}
.ck-x {
  flex: none;
  display: grid;
  place-items: center;
  width: var(--c-tap);
  height: var(--c-tap);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--c-radius-sm);
  background: transparent;
  color: var(--navy);
  cursor: pointer;
}
.ck-x:hover { background: var(--h-tint); }
.ck-x svg { width: var(--c-icon); height: var(--c-icon); }
.ck-dlg-p { color: var(--c-ink); }

/* the three category rows, ruled like the FAQ list: no cards */
.ck-rows { display: grid; margin: 0; padding: 0; list-style: none; }
.ck-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--c-s4);
  padding-block: var(--c-s3);
  border-top: var(--c-hair) solid var(--c-line);
  cursor: pointer;
}
.ck-row:last-child { border-bottom: var(--c-hair) solid var(--c-line); }
.ck-row-fixed { cursor: default; }
.ck-row-text { display: grid; gap: var(--c-s1); min-width: 0; }
.ck-row-name {
  font-weight: 700;
  font-size: var(--c-fs-btn);
  line-height: var(--c-lh-btn);
  color: var(--c-head);
}
.ck-row-desc { color: var(--c-ink); }
.ck-row-tag { font-size: var(--c-fs-sm); font-weight: 500; color: var(--c-muted); }

/* the switch: a real checkbox with role="switch" laid over a drawn track; Space toggles it natively */
.ck-sw {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: var(--c-sw-hit-w);
  height: var(--c-tap);
}
.ck-sw input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}
.ck-sw input:disabled { cursor: default; }
.ck-sw-track {
  position: relative;
  width: var(--c-sw-w);
  height: var(--c-sw-h);
  border-radius: var(--c-sw-h);
  background: var(--c-sw-off);
  transition: background-color var(--c-dur-sw) ease-out, box-shadow var(--c-dur-sw) ease-out;
}
.ck-sw-track::after {
  content: "";
  position: absolute;
  top: var(--c-sw-inset);
  left: var(--c-sw-inset);
  width: var(--c-sw-knob);
  height: var(--c-sw-knob);
  border-radius: 50%;
  background: var(--c-sw-knob-c);
  transition: transform var(--c-dur-sw) var(--c-ease);
}
.ck-sw input:checked + .ck-sw-track { background: var(--c-sw-on); }
.ck-sw input:checked + .ck-sw-track::after { transform: translateX(var(--c-sw-travel)); }
.ck-sw input:disabled + .ck-sw-track { background: var(--c-sw-fixed); }
.ck-row:hover .ck-sw input:not(:disabled) + .ck-sw-track { box-shadow: 0 0 0 var(--c-sw-halo) var(--c-halo); }
.ck-sw input:focus-visible + .ck-sw-track { outline: var(--c-ring) solid var(--c-ring-c); outline-offset: var(--c-ring-gap); }
@media (prefers-reduced-motion: reduce) {
  .ck-sw-track, .ck-sw-track::after { transition: none; }
}

.ck-dlg-act { display: grid; gap: var(--c-s2); }
@container ckd (min-width: 480px) {
  .ck-dlg-act { grid-template-columns: 1fr 1fr; }
}

/* the page keeps its last screen reachable while the bar is open: cookie.js writes the banner height into --kj-ck-h and sets .kj-ck-open on <html> */
.kj-ck-open body { padding-bottom: var(--kj-ck-h); }
.kj-ck-open { scroll-padding-bottom: var(--kj-ck-h); }
