/*
 * guide.css -- styling of the public Compliance guide (compliance.php).
 *
 * PURPOSE
 *   Layered on styles.css + theme.css (the shared hero, search box, badges and band come from there). Everything here is
 *   scoped to .g-page, so no other page changes. Section colour is the indigo of the Compliance menu item (data-sec="comp").
 *   Print: the header, footer, search and contents list are hidden and the sections are laid out for paper.
 */
.g-page { --g: #4338CA; --g-ink: #1B1F6B; --g-tint: #EEF0FF; --g-line: #D9DDF5; --g-text: #0A1B45; --g-muted: #52607f; }

/* ---- language: both languages are in the page when Thai exists; guide.js sets data-g-lang ---- */
.g-page[data-g-lang="en"] [data-l="th"], .g-page[data-g-lang="th"] [data-l="en"] { display: none; }
.g-nothai { display: none; margin: 18px 0 0; padding: 10px 14px; border-left: 4px solid #D4891A; background: #FFF8EA; border-radius: 0 10px 10px 0; color: #5b3a05; font-size: 14px; }
.g-page[data-g-lang="th"] .g-nothai.on { display: block; }   /* compliance.php adds .on when no Thai text exists */

/* ---- hero chips ---- */
.g-chips { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.g-chip { padding: 6px 14px; font-size: 13px; color: #dfe3ff; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .28); border-radius: 999px; }
.g-chip strong { color: #fff; }

.g-wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 10px; }
.g-countries { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 18px; }
.g-countries-label { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--g-muted); margin-right: 4px; }
.g-country { padding: 7px 16px; font-size: 13.5px; font-weight: 600; color: #334155; text-decoration: none; background: #fff; border: 1px solid #cbd5e1; border-radius: 999px; }
.g-country:hover { background: #f1f5f9; }
.g-country.on { background: var(--g); border-color: var(--g); color: #fff; }
.g-country:focus-visible { outline: 2px solid var(--g); outline-offset: 2px; }
.g-country small { opacity: .7; font-weight: 500; }

.g-empty { padding: 36px 28px; margin: 6px 0 24px; text-align: center; background: var(--g-tint); border: 1px solid var(--g-line); border-radius: 18px; }
.g-empty h2 { margin: 0 0 8px; font-family: 'Bai Jamjuree', sans-serif; color: var(--g-ink); }
.g-empty p { max-width: 560px; margin: 0 auto 14px; color: var(--g-muted); line-height: 1.6; }

/* ---- layout: contents list + article ---- */
.g-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 34px; align-items: start; }
.g-toc { position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow: auto; padding: 16px 14px; background: #fff; border: 1px solid var(--g-line); border-radius: 16px; }
.g-toc summary { cursor: pointer; margin: 0 0 8px; font-family: 'Bai Jamjuree', sans-serif; font-size: 15px; font-weight: 700; color: var(--g-ink); list-style: none; }
.g-toc summary::-webkit-details-marker { display: none; }
.g-toc ol { list-style: none; margin: 0 0 14px; padding: 0; }
.g-toc li a { display: flex; gap: 9px; align-items: flex-start; padding: 6px 8px; font-size: 13.5px; line-height: 1.35; color: var(--g-text); text-decoration: none; border-radius: 8px; }
.g-toc li a:hover { background: var(--g-tint); }
.g-toc li a[aria-current="true"] { background: var(--g-tint); color: var(--g-ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--g); }
.g-toc li a:focus-visible { outline: 2px solid var(--g); outline-offset: 1px; }
.g-toc-n { flex: none; min-width: 22px; font-weight: 700; color: var(--g); }
.g-dot { flex: none; width: 8px; height: 8px; margin: 6px 0 0 auto; border-radius: 50%; background: #D4891A; }
.g-print { display: block; width: 100%; margin: 4px 0 8px; padding: 9px 12px; font: inherit; font-size: 13px; font-weight: 600; color: var(--g-ink); background: var(--g-tint); border: 1px solid var(--g-line); border-radius: 10px; cursor: pointer; }
.g-print:hover { background: #e2e6ff; }
.g-print:focus-visible { outline: 2px solid var(--g); outline-offset: 2px; }
.g-dirlink { display: block; padding: 4px 2px; font-size: 13px; color: var(--g); }

/* ---- article ---- */
.g-article { min-width: 0; }
.g-sec { scroll-margin-top: 92px; margin: 0 0 22px; padding: 26px 28px; background: #fff; border: 1px solid var(--g-line); border-radius: 18px; box-shadow: 0 1px 2px rgba(10, 27, 69, .04); }
.g-sec[hidden], .g-foot[hidden] { display: none; }
.g-sec:target { box-shadow: 0 0 0 3px rgba(67, 56, 202, .25); }
.g-intro { background: linear-gradient(135deg, #fff 0%, var(--g-tint) 100%); }
.g-intro .g-body > p:first-child { margin: 0 0 14px; color: var(--g-muted); font-size: 14px; }
.g-intro .g-body > p:first-child strong { display: block; margin-top: 2px; font-family: 'Bai Jamjuree', sans-serif; font-size: clamp(20px, 3vw, 26px); line-height: 1.25; color: var(--g-ink); }
.g-sec-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 14px; }
.g-sec-head h2 { flex: 1 1 260px; margin: 0; font-family: 'Bai Jamjuree', sans-serif; font-size: clamp(20px, 2.6vw, 25px); line-height: 1.25; color: var(--g-ink); }
.g-num { flex: none; display: inline-grid; place-items: center; width: 38px; height: 38px; font-family: 'Bai Jamjuree', sans-serif; font-size: 17px; font-weight: 700; color: #fff; background: var(--g); border-radius: 12px; }
.g-pending { border-color: #EBCB8B; }
.g-body { color: var(--g-text); font-size: 15.5px; line-height: 1.68; }
.g-body p { margin: 0 0 12px; }
.g-body h3 { margin: 22px 0 8px; font-family: 'Bai Jamjuree', sans-serif; font-size: 17.5px; line-height: 1.3; color: var(--g-ink); }
.g-body ul, .g-body ol { margin: 0 0 14px; padding-left: 22px; }
.g-body li { margin: 0 0 6px; }
.g-body a { color: var(--g); text-underline-offset: 2px; }
.g-body a:focus-visible { outline: 2px solid var(--g); outline-offset: 2px; border-radius: 3px; }

/* callouts: the paragraphs that start with a bold label */
.g-body p.g-note, .g-body p.g-warn, .g-body p.g-meta { padding: 12px 16px; border-radius: 0 12px 12px 0; font-size: 14.5px; line-height: 1.6; }
.g-body p.g-note { background: var(--g-tint); border-left: 4px solid var(--g); }
.g-body p.g-warn { background: #FFF6E5; border-left: 4px solid #D4891A; color: #4a2f05; }
.g-body p.g-meta { margin-bottom: 8px; padding: 8px 14px; background: #F4F7FC; border-left: 4px solid #94a3b8; color: #334155; }
.g-body p.g-note strong, .g-body p.g-warn strong, .g-body p.g-meta strong { font-weight: 700; }

/* tables: horizontal scroll inside a focusable region, never a page-wide scrollbar */
.g-table { margin: 6px 0 18px; overflow-x: auto; border: 1px solid var(--g-line); border-radius: 12px; background: #fff; }
.g-table:focus-visible { outline: 2px solid var(--g); outline-offset: 2px; }
.g-table table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 14px; line-height: 1.5; }
.g-table th, .g-table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--g-line); }
.g-table thead th { position: sticky; top: 0; background: var(--g-tint); color: var(--g-ink); font-weight: 700; white-space: nowrap; }
.g-table tbody tr:nth-child(even) { background: #FAFBFF; }
.g-table tbody tr:last-child td, .g-table tbody tr:last-child th { border-bottom: 0; }
.g-table tbody th { font-weight: 600; color: var(--g-ink); }
.g-refs tr:target td { background: #FFF6E5; }
.g-refs td:first-child { white-space: nowrap; font-weight: 700; color: var(--g); }
.g-gloss th[scope="row"] { width: 28%; }

.g-foot { margin: 0 0 22px; padding: 14px 18px; font-size: 13.5px; color: var(--g-muted); border-top: 1px solid var(--g-line); }
.g-foot p { margin: 0; }

@media (max-width: 900px) {
  .g-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .g-toc { position: static; max-height: none; }
  .g-sec { padding: 20px 16px; }
}
@media (prefers-reduced-motion: no-preference) { html:has(.g-page) { scroll-behavior: smooth; } }

@media print {
  .site-header, .site-footer, .crumbs, .kh-search, .g-countries, .g-toc, .kh-band, .kh-hero::before, #demoBar { display: none !important; }
  .kh-hero { background: none !important; color: #000; }
  .kh-hero h1, .kh-lead, .kh-eyebrow, .g-chip, .g-chip strong { color: #000 !important; background: none !important; border-color: #999 !important; }
  .g-layout { display: block; }
  .g-sec { break-inside: auto; box-shadow: none; border: 0; padding: 8px 0; }
  .g-sec-head, .g-body h3 { break-after: avoid; }
  .g-table { overflow: visible; border: 0; }
  .g-table table { min-width: 0; font-size: 11px; }
  .g-table tr { break-inside: avoid; }
  .g-body a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 10px; color: #555; word-break: break-all; }
}
