/* Getting In — Chiang Mai Visa Desk colours: indigo cloth, rice paper, temple gold, celadon */
:root {
  --paper: #F7F4EC; --card: #FFFFFF; --ink: #14161C; --muted: #4A4F5C; --line: #DED7C9;
  --indigo: #24406E; --indigo-deep: #1B3157; --gold: #8E6310; --gold-line: #C79A3A;
  --chip: #F4E7CE; --chip-ink: #63440B; --celadon: #2A5245; --celadon-soft: #E3EEE9;
  --alert: #8A2A1E; --alert-soft: #F8E7E3; --btn-ink: #FFFFFF; --focus: #C79A3A;
  --size: 19px;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --head: Georgia, "Noto Serif", "Times New Roman", serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12161F; --card: #1A2030; --ink: #F2EFE7; --muted: #B9B6AD; --line: #2E3647;
    --indigo: #9DB6E3; --indigo-deep: #0E1626; --gold: #E2B860; --gold-line: #C79A3A;
    --chip: #3A3020; --chip-ink: #F4E7CE; --celadon: #9CCBB8; --celadon-soft: #16302A;
    --alert: #F2A495; --alert-soft: #3A1E1A; --btn-ink: #0E1626;
  }
}
:root[data-theme="dark"] {
  --paper: #12161F; --card: #1A2030; --ink: #F2EFE7; --muted: #B9B6AD; --line: #2E3647;
  --indigo: #9DB6E3; --indigo-deep: #0E1626; --gold: #E2B860; --chip: #3A3020; --chip-ink: #F4E7CE;
  --celadon: #9CCBB8; --celadon-soft: #16302A; --alert: #F2A495; --alert-soft: #3A1E1A; --btn-ink: #0E1626;
}
.lang-th { --body: "Noto Sans Thai", system-ui, sans-serif; --head: "Noto Sans Thai", system-ui, sans-serif; }
.lang-lo { --body: "Noto Sans Lao", system-ui, sans-serif; --head: "Noto Sans Lao", system-ui, sans-serif; }
.lang-km { --body: "Noto Sans Khmer", system-ui, sans-serif; --head: "Noto Sans Khmer", system-ui, sans-serif; }
.lang-ja, .lang-zh, .lang-ko { --head: var(--body); }
.lang-th, .lang-lo, .lang-km { --lh: 1.8; }

* { box-sizing: border-box; }
html { font-size: var(--size); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); line-height: var(--lh, 1.6); overflow-wrap: anywhere; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
a { color: var(--indigo); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--head); line-height: 1.25; }
h1 { font-size: clamp(1.7rem, 6vw, 2.5rem); margin: .2em 0 .4em; }
h2 { font-size: 1.45rem; margin: 0; }
h3 { font-size: 1.1rem; margin: 1em 0 .3em; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--card); padding: 8px; z-index: 9; }
.small { font-size: .85rem; color: var(--muted); }

/* top bar */
.top { background: var(--indigo-deep); color: #F7F4EC; position: sticky; top: 0; z-index: 5; }
.top a { color: #F7F4EC; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; }
.brand { font-family: var(--head); font-weight: 700; text-decoration: none; font-size: 1.05rem; min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-tools { flex: none; }
.top-tools { display: flex; gap: 8px; align-items: center; }
.size button { background: transparent; color: #F7F4EC; border: 1px solid #F7F4EC66; border-radius: 6px; font: inherit; font-size: .85rem; padding: 6px 10px; min-height: 40px; cursor: pointer; }
.langs { position: relative; background: transparent; border: 0; margin: 0; }
.langs summary { cursor: pointer; list-style: none; border: 1px solid #F7F4EC66; border-radius: 6px; padding: 6px 10px; font-size: .85rem; min-height: 40px; display: flex; align-items: center; }
.langs summary::-webkit-details-marker { display: none; }
.lang-menu { position: absolute; right: 0; top: 46px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; min-width: 260px; box-shadow: 0 8px 30px #0004; }
.lang-menu a, .lang-foot a { color: var(--ink); text-decoration: none; padding: 8px 10px; border-radius: 6px; }
.lang-menu a:hover, .lang-menu a[aria-current] { background: var(--chip); color: var(--chip-ink); }
.suggest { background: var(--chip); color: var(--chip-ink); text-align: center; padding: 10px 16px; }
.suggest a { color: var(--chip-ink); font-weight: 700; }

/* hero */
.hero { background: var(--indigo); color: #F7F4EC; padding: 28px 0 24px; }
:root[data-theme="dark"] .hero { background: var(--indigo-deep); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero { background: #1B3157; } }
.kicker { color: #F4E7CE; font-weight: 600; margin: 0; }
.lede { font-size: 1.08rem; max-width: 40em; }
.free { color: #F4E7CE; font-size: .9rem; }

/* sharing kit */
.kit { background: #ffffff14; border: 1px solid #ffffff33; border-radius: 14px; padding: 14px; margin-top: 16px; }
.share .kit { background: var(--card); border-color: var(--line); }
.cta { font-family: var(--head); font-size: 1.25rem; font-weight: 700; margin: 0 0 10px; }
.kit-main, .apps { display: flex; flex-wrap: wrap; gap: 8px; }
.apps { margin-top: 10px; }
.btn, .app { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 8px 14px; border-radius: 10px; font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; text-decoration: none; border: 1.5px solid currentColor; background: transparent; color: inherit; }
.btn.primary { background: var(--gold-line); color: #14161C; border-color: var(--gold-line); }
.app { border: 0; color: #fff; font-size: .85rem; min-height: 42px; }
.app-whatsapp { background: #128C3E; } .app-facebook { background: #1659C6; } .app-messenger { background: #6A3CD6; }
.app-line { background: #06A33F; } .app-telegram { background: #1B7FB5; } .app-viber { background: #6B4AA8; }
.app-x { background: #111; } .app-bluesky { background: #0A66D8; } .app-reddit { background: #C83A00; }
.app-email, .app-sms { background: #4A4F5C; }
.share .btn { color: var(--ink); }

/* sections */
section { padding: 26px 0 8px; border-bottom: 1px solid var(--line); scroll-margin-top: 64px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sec-share { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card); color: var(--indigo); font-size: 1.1rem; cursor: pointer; }
.intro { font-size: 1.02rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 12px; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--gold-line); border-radius: 12px; color: var(--ink); text-decoration: none; }
.card b { font-family: var(--head); font-size: 1.08rem; color: var(--indigo); }
.card span { color: var(--muted); font-size: .92rem; }
.toc { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin: 22px 0 0; }
.toc h2 { font-size: 1.05rem; }
.toc ol { columns: 2 220px; margin: 8px 0 0; padding-left: 1.3em; }
.toc li { margin: 3px 0; }
.group { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px 10px; margin: 12px 0; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { padding: 6px 0; border-top: 1px dashed var(--line); }
.checks li:first-child { border-top: 0; }
.checks label { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.checks input { width: 26px; height: 26px; flex: none; margin-top: 2px; accent-color: var(--celadon); }
.checks input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--celadon); }
.callout { background: var(--celadon-soft); border-left: 6px solid var(--celadon); padding: 12px 16px; border-radius: 8px; margin: 14px 0; }
.callout h3 { margin-top: .2em; }
.steps-list li, .lines li, .care li { margin: 8px 0; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--card); border-radius: 10px; font-size: .95rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
thead th { background: var(--chip); color: var(--chip-ink); }
@media (max-width: 560px) {
  table, thead, tbody, tr, th, td { display: block; } thead { display: none; }
  tr { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; background: var(--card); }
  td, th { border: 0; padding: 6px 12px; } tbody th { font-size: 1.05rem; color: var(--indigo); padding-top: 12px; }
}
.steps { list-style: none; padding: 0; counter-reset: s; }
.steps li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px 8px; margin: 10px 0; }
details { background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; }
details > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; min-height: 46px; }
details > p { margin: 0; padding: 0 16px 14px; }
details[open] > summary { color: var(--indigo); }
.block { border-left: 4px solid var(--gold-line); padding: 2px 0 2px 14px; margin: 14px 0; }
.routes { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.route { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px 12px; }
.route dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 8px 0; }
.route dt { font-weight: 700; color: var(--muted); font-size: .85rem; padding-top: 2px; }
.route dd { margin: 0; }
.addr { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
.mini { font: inherit; font-family: var(--body); font-size: .75rem; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; margin-left: 4px; }
.flag { display: inline-block; font-size: .78rem; background: var(--chip); color: var(--chip-ink); padding: 1px 8px; border-radius: 999px; }
.src a { font-size: .8rem; color: var(--muted); }
.lines { list-style: none; padding: 0; }
.lines li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.tel { font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.hours { display: block; color: var(--muted); font-size: .88rem; }
.hours b.on { color: var(--celadon); } .hours b.off { color: var(--alert); }
.alert h2 { color: var(--alert); }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.signs { padding-left: 1.2em; } .signs li::marker { content: "⚠ "; color: var(--alert); }
.do li { margin: 8px 0; }
.alert .two > div { background: var(--alert-soft); border-radius: 12px; padding: 4px 16px 10px; }
.care { font-size: 1.05rem; }
.care .intro { font-size: 1.08rem; }
section.care { background: var(--celadon-soft); margin: 18px -16px 0; padding: 22px 16px 10px; border-radius: 12px; border: 0; }
.qr-print { display: none; }
.bots p { color: var(--muted); }
.sources { font-size: .85rem; }

.foot { background: var(--indigo-deep); color: #F7F4EC; padding: 24px 0 40px; margin-top: 30px; font-size: .9rem; }
.foot a { color: #F4E7CE; }
.lang-foot { display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 0; }
.lang-foot a { color: #F7F4EC; border: 1px solid #F7F4EC44; }
.foot details { background: transparent; border-color: #F7F4EC44; color: #F7F4EC; }

.qr-dialog { border: 0; border-radius: 16px; padding: 24px; text-align: center; background: #fff; color: #14161C; max-width: 92vw; }
.qr-dialog img { width: min(300px, 76vw); height: auto; }
.qr-dialog::backdrop { background: #000a; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #14161C; color: #fff; padding: 10px 18px; border-radius: 999px; z-index: 20; font-size: .9rem; }

@media print {
  :root { --size: 12pt; }
  .top, .kit, .sec-share, .suggest, .toc, .foot nav, .foot details, .qr-dialog, .skip { display: none !important; }
  body { background: #fff; color: #000; }
  .hero { background: #fff; color: #000; padding: 0; }
  .kicker, .free { color: #000; }
  details { border: 0; } details > summary { padding: 4px 0; } details > p { padding: 0 0 6px; }
  section { break-inside: auto; border: 0; }
  .route, .group, .steps li { break-inside: avoid; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; word-break: break-all; }
  .apps a::after, .lang-foot a::after { content: none; }
  .qr-print { display: block; text-align: center; }
  .foot { background: #fff; color: #000; }
}
.langs[open] > summary { color: #F7F4EC; }
