/*!
 * Kumo CMS 3.6 (docs/design/3.5/HANDOFF.md 29.1): the blocks of round 19 on the website — before / after, the moving strip,
 * words that take turns, a video in a window, a gallery with filters, the table of contents, items in a sliding row,
 * gradient backgrounds and words, the progress ring. Loaded only on a page that has one (Site::plusStyles). Values from
 * the page CSS or CSSOM (no style=""). Each works without JavaScript (kumo-blocks-plus.js adds the rest).
 */

/* ---------- before / after (ก่อน–หลัง) ---------- */
.kp-cmp { position: relative; margin: 0; overflow: hidden; border-radius: var(--kp-r, 16px); aspect-ratio: var(--kp-ratio, 16 / 10); --kp-pos: 50%; touch-action: pan-y; user-select: none; }
.kp-cmp > .kp-cmp-a, .kp-cmp > .kp-cmp-b { position: absolute; inset: 0; }
.kp-cmp svg, .kp-cmp img { display: block; width: 100%; height: 100%; object-fit: cover; }
.kp-cmp-b { clip-path: inset(0 0 0 var(--kp-pos)); }
.kp-cmp.is-v .kp-cmp-b { clip-path: inset(var(--kp-pos) 0 0 0); }
.kp-cmp-line { position: absolute; top: 0; bottom: 0; left: var(--kp-pos); width: 3px; margin-left: -1.5px; background: #FFFFFF; pointer-events: none; }
.kp-cmp.is-v .kp-cmp-line { top: var(--kp-pos); bottom: auto; left: 0; right: 0; width: auto; height: 3px; margin: -1.5px 0 0; }
.kp-cmp-knob { position: absolute; top: 50%; left: var(--kp-pos); width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: #FFFFFF; color: #121735; display: grid; place-items: center; font-weight: 800; pointer-events: none; }
.kp-cmp.is-v .kp-cmp-knob { top: var(--kp-pos); left: 50%; }
.kp-cmp input[type="range"] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.kp-cmp.is-v input[type="range"] { cursor: ns-resize; }
.kp-cmp:has(input:focus-visible) .kp-cmp-knob { outline: 3px solid #FFD84D; outline-offset: 3px; }
.kp-cmp-tag { position: absolute; top: 12px; padding: 4px 10px; background: rgba(18, 23, 53, .78); color: #FFFFFF; font-size: 13px; font-weight: 700; pointer-events: none; }
.kp-cmp-tag.is-a { left: 12px; } .kp-cmp-tag.is-b { right: 12px; }

/* ---------- marquee (แถบวิ่ง) ---------- */
.kp-mq { position: relative; display: flex; align-items: center; gap: 12px; overflow: hidden; --kp-speed: 30s; }
.kp-mq-view { flex: 1; overflow: hidden; }
.kp-mq.is-fade .kp-mq-view { mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.kp-mq-track { display: flex; width: max-content; animation: kp-mq var(--kp-speed) linear infinite; }
.kp-mq.is-rev .kp-mq-track { animation-direction: reverse; }
.kp-mq.is-hover:hover .kp-mq-track, .kp-mq.is-hover:focus-within .kp-mq-track, .kp-mq.is-paused .kp-mq-track, .kd-paused .kp-mq-track { animation-play-state: paused; }
.kp-mq-list { display: flex; align-items: center; gap: var(--kp-gap, 40px); margin: 0; padding: 0 calc(var(--kp-gap, 40px) / 2); list-style: none; white-space: nowrap; }
.kp-mq-list li { display: inline-flex; align-items: center; gap: var(--kp-gap, 40px); font-size: var(--kp-fs, 1.25rem); font-weight: 800; }
.kp-mq-list li + li::before { content: var(--kp-sep, "✦"); font-weight: 400; opacity: .6; }
.kp-mq-pause { flex: none; min-width: 36px; min-height: 36px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .12); color: inherit; font-weight: 800; }
.kp-mq-pause:focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }
@keyframes kp-mq { to { transform: translateX(-50%); } }

/* ---------- rotating words (คำที่สลับไปมา) ---------- */
.kp-words { display: inline-grid; vertical-align: bottom; overflow: hidden; }
.kp-words > span { grid-area: 1 / 1; white-space: nowrap; color: var(--kp-wc, inherit); transition: transform .5s var(--km-ease-soft, ease), opacity .5s, filter .5s; }
.kp-words > span:not(.is-on) { opacity: 0; transform: translateY(100%); }
.kp-words > span.is-out { opacity: 0; transform: translateY(-100%); }
.kp-words.is-fade > span:not(.is-on), .kp-words.is-fade > span.is-out { transform: none; }
.kp-words.is-blur > span:not(.is-on), .kp-words.is-blur > span.is-out { transform: none; filter: blur(8px); }
.kp-words.is-flip > span:not(.is-on) { transform: perspective(400px) rotateX(-90deg); } .kp-words.is-flip > span.is-out { transform: perspective(400px) rotateX(90deg); }

/* ---------- video in a popup (วิดีโอแบบเปิดเป็นหน้าต่าง) ---------- */
.kp-vid { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; border-radius: var(--kp-r, 16px); overflow: hidden; }
.kp-vid svg { display: block; width: 100%; height: auto; }
.kp-vid-play { position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%; background: #FFFFFF; color: #121735; display: grid; place-items: center; transition: transform .25s var(--km-ease-spring, ease); }
.kp-vid:hover .kp-vid-play, .kp-vid:focus-visible .kp-vid-play { transform: scale(1.08); }
.kp-vid:focus-visible { outline: 3px solid #FFD84D; outline-offset: 3px; }
.kp-dlg { width: min(960px, 94vw); padding: 0; border: 0; background: #000; color: #FFFFFF; }
.kp-dlg::backdrop { background: rgba(10, 12, 24, .82); }
.kp-dlg-bar { display: flex; justify-content: flex-end; padding: 6px; background: #000; }
.kp-dlg-x { min-width: 44px; min-height: 44px; border: 0; background: #FFFFFF; color: #121735; font-size: 20px; font-weight: 800; }
.kp-dlg-x:focus-visible { outline: 3px solid #FFD84D; outline-offset: 2px; }
.kp-dlg-body { aspect-ratio: 16 / 9; display: grid; place-items: center; background: #111; }

/* ---------- filtered gallery (แกลเลอรีแบ่งหมวด) ---------- */
.kp-flt { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.kp-flt button { min-height: 40px; padding: 0 16px; border: 0; background: var(--kp-chip, #EEF3EC); color: inherit; font-weight: 700; }
.kp-flt button[aria-pressed="true"] { background: var(--kp-chip-on, #1F3A20); color: #FFFFFF; }
.kp-flt button:focus-visible { outline: 3px solid #2B3BE0; outline-offset: 2px; }
.kp-grid { display: grid; grid-template-columns: repeat(var(--kp-cols, 4), minmax(0, 1fr)); gap: var(--kp-gap2, 12px); margin: 0; padding: 0; list-style: none; }
.kp-grid li { transition: opacity .3s, transform .3s var(--km-ease-soft, ease); }
.kp-grid li.is-hide { display: none; }
.kp-grid li.is-enter { animation: kp-in .35s var(--km-ease-soft, ease) both; }
.kp-grid figure { margin: 0; } .kp-grid svg { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.kp-grid figcaption { margin-top: 6px; font-size: 14px; font-weight: 700; }
@keyframes kp-in { from { opacity: 0; transform: scale(.94); } }

/* ---------- table of contents (สารบัญบทความ) ---------- */
.kp-toc { padding: 16px 18px; background: var(--kp-toc-bg, #F4FAF1); }
.kp-toc summary { cursor: pointer; font-weight: 800; min-height: 32px; display: flex; align-items: center; }
.kp-toc ol { margin: 10px 0 0; padding-left: 0; list-style: none; counter-reset: none; }
.kp-toc li li { padding-left: 14px; }
.kp-toc a { display: block; padding: 6px 10px; color: inherit; text-decoration: none; border-left: 3px solid transparent; }
.kp-toc a:hover { text-decoration: underline; } .kp-toc a[aria-current="true"] { border-left-color: var(--kp-toc-on, #2F6B34); font-weight: 800; }
.kp-toc a:focus-visible { outline: 3px solid #2B3BE0; outline-offset: 1px; }
.kp-toc.is-sticky { position: sticky; top: 16px; }

/* ---------- carousel mode for repeated items (แสดงแบบเลื่อน) ---------- */
.kp-car { position: relative; }
.kp-car-track { display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - (var(--kp-per, 3) - 1) * var(--kp-gap2, 16px)) / var(--kp-per, 3)); gap: var(--kp-gap2, 16px); overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; padding: 0; margin: 0; list-style: none; }
.kp-car-track::-webkit-scrollbar { display: none; }
.kp-car-track > * { scroll-snap-align: start; }
.kp-car-nav { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.kp-car-nav button { min-width: 44px; min-height: 44px; border: 0; background: var(--kp-chip, #EEF3EC); color: inherit; font-weight: 800; }
.kp-car-nav button:disabled { opacity: .4; }
.kp-car-nav button:focus-visible { outline: 3px solid #2B3BE0; outline-offset: 2px; }
.kp-car-dots { display: flex; gap: 6px; margin-right: auto; }
.kp-car-dots button { min-width: 24px; min-height: 24px; padding: 0; background: transparent; display: grid; place-items: center; }
.kp-car-dots button::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; opacity: .3; }
.kp-car-dots button[aria-current="true"]::after { opacity: 1; width: 22px; border-radius: 5px; }

/* the row / box itself slides (its columns or blocks are the items; kumo-blocks-plus.js adds the buttons after it) */
[data-kp-car] { display: grid !important; grid-auto-flow: column; grid-auto-columns: calc((100% - (var(--kp-per, 3) - 1) * var(--kp-gap2, 16px)) / var(--kp-per, 3)); gap: var(--kp-gap2, 16px); overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; flex-wrap: nowrap; }
[data-kp-car]::-webkit-scrollbar { display: none; }
[data-kp-car] > * { scroll-snap-align: start; width: auto !important; max-width: none !important; flex: none !important; margin: 0 !important; }
.kp-car-nav[hidden] { display: none; }

/* ---------- gradient background + gradient text (ไล่สี) ---------- */
.kp-gbg { background: var(--kp-grad); }
.kp-gtext { background: var(--kp-tgrad); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
@media (forced-colors: active) { .kp-gtext { color: CanvasText; -webkit-text-fill-color: CanvasText; background: none; } }

/* ---------- progress ring (วงความคืบหน้า) ---------- */
.kp-ring { display: inline-grid; place-items: center; position: relative; width: var(--kp-rs, 140px); }
.kp-ring svg { width: 100%; height: auto; transform: rotate(-90deg); }
.kp-ring circle { fill: none; stroke-width: 10; }
.kp-ring .kp-ring-bg { stroke: var(--kp-ring-bg, #DCE9D8); }
.kp-ring .kp-ring-fg { stroke: var(--kp-ring, var(--primary, #2F6B34)); stroke-linecap: round; stroke-dasharray: 289; stroke-dashoffset: calc(289 - 2.89 * var(--kp-v, 0)); transition: stroke-dashoffset 1.2s var(--km-ease-soft, ease); }
html.js .kp-ring:not(.is-in) .kp-ring-fg { stroke-dashoffset: 289; } /* it fills when seen; without JavaScript it shows its value */
.kp-ring b { position: absolute; font-size: 1.6rem; font-weight: 800; }

@media (prefers-reduced-motion: reduce) {
  .kp-mq-track { animation: none; flex-wrap: wrap; width: auto; } .kp-mq-track > [aria-hidden="true"] { display: none; }
  .kp-words > span { transition: none; } .kp-grid li.is-enter { animation: none; } .kp-ring .kp-ring-fg { transition: none; } .kp-car-track { scroll-behavior: auto; }
}

/* ---------- Kumo's own parts of the blocks above ---------- */
.kp-cmp-none { display: grid; place-items: center; width: 100%; height: 100%; background: var(--sk-soft, #F1F3F7); color: var(--sk-text, #121735); font-weight: 700; }
.kp-cmp-b .kp-cmp-none { background: var(--sk-surface, #E4E8F1); }
.kp-mq-s { --kp-fs: 1rem; --kp-gap: 28px; } .kp-mq-m { --kp-fs: 1.25rem; } .kp-mq-l { --kp-fs: 1.75rem; --kp-gap: 56px; }
.kp-mq.is-nosep .kp-mq-list li + li::before { content: none; }
.kp-mq-list img { display: block; height: 2.4em; width: auto; }
.kp-mq-pause .fa-play, .kp-mq.is-paused .kp-mq-pause .fa-pause { display: none; }
.kp-mq.is-paused .kp-mq-pause .fa-play { display: inline-block; }
.kp-toc:has(ol:empty) { display: none; }
.kp-toc summary::-webkit-details-marker { display: none; }
.kp-toc summary::after { content: "\25BE"; margin-inline-start: auto; }
.kp-toc details:not([open]) summary::after { content: "\25B8"; }
.kx-progress-ring { display: flex; flex-wrap: wrap; gap: 24px; }
.kx-progress-ring .kp-ring { display: inline-grid; justify-items: center; gap: 8px; }
.kp-ring-s { --kp-rs: 100px; } .kp-ring-m { --kp-rs: 140px; } .kp-ring-l { --kp-rs: 180px; }
.kp-ring > b { top: calc(var(--kp-rs, 140px) / 2); transform: translateY(-50%); }
.kp-ring svg { overflow: visible; }
[data-kp-filter] .is-hide { display: none !important; }
[data-kp-filter] .is-enter { animation: kp-in .35s var(--km-ease-soft, ease) both; }
.kp-vid img, .kp-vid-blank { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #121735; }
.kp-vid-label { margin: 8px 0 0; font-weight: 700; text-align: center; }
.kp-dlg-body iframe, .kp-dlg-body video { width: 100%; height: 100%; border: 0; }
@media (prefers-reduced-motion: reduce) { [data-kp-filter] .is-enter { animation: none; } }
.kp-sep-star { --kp-sep: "\2726"; } .kp-sep-dot { --kp-sep: "\2022"; } .kp-sep-bar { --kp-sep: "|"; } .kp-sep-slash { --kp-sep: "/"; } .kp-sep-dash { --kp-sep: "\2014"; }
