/* =====================================================================
   www.chaiwang.co.th — site stylesheet (single file, no framework).
   Brand tokens:
   same brand red / neutrals / type scale, so the site and the app read as one brand.
   Mobile-first: base = 360–430px, then 600px / 960px breakpoints.
   ===================================================================== */

/* ---------- Fonts: IBM Plex Sans Thai Looped (OFL 1.1), self-hosted, no CDN ---------- */
@font-face { font-family: "Plex Thai"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/ibm-plex-sans-thai-looped-thai-400-normal.woff2") format("woff2");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Plex Thai"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/ibm-plex-sans-thai-looped-thai-600-normal.woff2") format("woff2");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Plex Thai"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/ibm-plex-sans-thai-looped-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Thai"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/ibm-plex-sans-thai-looped-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --cw-brand-red: #ED1F24;   /* logo; decorative only */
  --cw-gold: #B9892F; --cw-purple: #6C52A2; --cw-blue: #1B4994; --cw-brick: #9C2420;

  --c-primary: #D0141B;        /* white on it 5.53:1 */
  --c-primary-pressed: #AE1117;
  --c-primary-soft: #FDECEC;
  --c-primary-ink: #9E1015;

  --c-bg: #F5F5F3;
  --c-surface: #FFFFFF;
  --c-surface-2: #EEEEEC;
  --c-ink-dark: #1C1D1F;       /* hero / footer background */
  --c-text: #1C1D1F;
  --c-text-2: #4A4B4D;
  --c-muted: #6B6C6E;
  --c-border: #D6D6D3;
  --c-border-strong: #8C8D8F;
  --c-on-dark: #FFFFFF;
  --c-on-dark-2: #C9CACC;      /* 11.0:1 on #1C1D1F */
  --c-focus: #1B4994; --c-info: #1B4994;
  --c-warn-soft: #FFF3D6; --c-warn-ink: #8A4B00;

  --font: "Plex Thai", "Noto Sans Thai Looped", "Sarabun", "Leelawadee UI", Tahoma, system-ui, sans-serif;
  --fs-xs: 14px; --fs-sm: 15px; --fs-md: 17px; --fs-lg: 20px; --fs-xl: 24px; --fs-2xl: 30px; --fs-3xl: 34px;
  --lh-body: 1.65; --lh-tight: 1.3;

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;
  --gutter: 16px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  --sh-1: 0 1px 2px rgba(28, 29, 31, .06), 0 1px 1px rgba(28, 29, 31, .04);
  --sh-2: 0 6px 20px rgba(28, 29, 31, .08);
  --tap: 48px; --tap-lg: 56px;
  --header-h: 64px; --cta-bar-h: 72px;
  --max: 1120px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
@media (min-width: 600px) { :root { --gutter: 24px; --fs-2xl: 34px; --fs-3xl: 44px; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body { margin: 0; background: var(--c-bg); color: var(--c-text); font-family: var(--font); font-size: var(--fs-md);
  line-height: var(--lh-body); -webkit-font-smoothing: antialiased; padding-bottom: calc(var(--cta-bar-h) + var(--safe-b)); }
@media (min-width: 960px) { body { padding-bottom: 0; } }
img, svg { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { line-height: var(--lh-tight); margin: 0; font-weight: 600; }
h1, h2 { text-wrap: balance; }
p { margin: 0; }
a { color: var(--c-info); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; border-radius: var(--r-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--c-surface); padding: 12px 16px; border-radius: var(--r-sm); }
.skip:focus { top: 8px; }
.icon { width: 24px; height: 24px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- Header + nav ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--c-surface); border-bottom: 1px solid var(--c-border); }
.site-header .wrap { display: flex; align-items: center; gap: var(--s-3); min-height: var(--header-h); }
.brand { display: flex; align-items: center; gap: var(--s-3); text-decoration: none; color: var(--c-text); min-height: var(--tap); flex: 1; min-width: 0; }
.brand img { width: 40px; height: 40px; border-radius: 6px; }
.brand-name { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-name strong { font-size: 17px; white-space: nowrap; }
.brand-name span { font-size: 12px; letter-spacing: .08em; color: var(--c-muted); white-space: nowrap; }
.nav-desktop { display: none; }
.nav-desktop a, .nav-mobile a { color: var(--c-text-2); text-decoration: none; font-weight: 600; }
.nav-desktop a[aria-current="page"], .nav-mobile a[aria-current="page"] { color: var(--c-primary); }
.nav-desktop a.btn-primary, .nav-mobile a.btn-primary { color: #fff; }

.nav-mobile { position: static; }
.nav-mobile summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 14px;
  border: 2px solid var(--c-border-strong); border-radius: var(--r-md); font-weight: 600; cursor: pointer; user-select: none; }
.nav-mobile summary::-webkit-details-marker { display: none; }
.nav-mobile summary > span { display: inline-flex; align-items: center; gap: 6px; }
.nav-mobile .close { display: none; }
.nav-mobile[open] .open { display: none; }
.nav-mobile[open] .close { display: inline-flex; }
.nav-mobile nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--c-surface); border-bottom: 1px solid var(--c-border);
  box-shadow: var(--sh-2); padding: var(--s-2) var(--gutter) var(--s-4); }
.nav-mobile nav a { display: flex; align-items: center; min-height: var(--tap-lg); border-bottom: 1px solid var(--c-surface-2); font-size: 18px; }
.nav-mobile nav a[aria-current="page"] { box-shadow: inset 4px 0 0 var(--c-primary); padding-left: 12px; }
.nav-mobile nav .btn { margin-top: var(--s-4); }

@media (min-width: 960px) {
  .nav-mobile { display: none; }
  .nav-desktop { display: flex; align-items: center; gap: var(--s-1); }
  .nav-desktop a:not(.btn) { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 12px; border-radius: var(--r-sm); }
  .nav-desktop a:not(.btn):hover { background: var(--c-surface-2); color: var(--c-text); }
  .nav-desktop a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--c-primary); border-radius: 0; }
  .nav-desktop .btn { margin-left: var(--s-3); }
}

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: var(--tap-lg);
  padding: var(--s-3) var(--s-6); border-radius: var(--r-md); border: 2px solid var(--c-border-strong); background: var(--c-surface);
  color: var(--c-text); font: inherit; font-size: 18px; font-weight: 600; line-height: 1.3; text-decoration: none; cursor: pointer;
  transition: background 120ms var(--ease), transform 120ms var(--ease); -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--c-primary); border-color: transparent; color: #fff; }
.btn-primary:hover { background: var(--c-primary-pressed); }
.btn-line { background: #05873A; border-color: transparent; color: #fff; }   /* white on it 4.63:1 (LINE green #06C755 fails AA) */
.btn-ondark { background: transparent; color: #fff; border-color: rgba(255,255,255,.7); }
.btn-ondark:hover { background: rgba(255,255,255,.1); }
.btn-sm { min-height: var(--tap); padding: var(--s-2) var(--s-4); font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.btn-row .btn { flex: 1 1 200px; }
@media (min-width: 600px) { .btn-row .btn { flex: 0 0 auto; } }

.ph { background: var(--c-warn-soft); color: var(--c-warn-ink); border-radius: 4px; padding: 0 4px; font-weight: 600; }
.btn .ph { background: rgba(255,255,255,.22); color: inherit; }

/* ---------- Sections ---------- */
.section { padding: var(--s-12) 0; }
.section-alt { background: var(--c-surface); }
@media (min-width: 960px) { .section { padding: var(--s-16) 0; } }
.eyebrow { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--c-primary-ink); font-size: var(--fs-sm); font-weight: 600; letter-spacing: .02em; }
.eyebrow::before { content: ""; width: 24px; height: 3px; border-radius: 2px; background: var(--c-primary); }
.section-head { max-width: 720px; margin-bottom: var(--s-8); }
.section-head h2 { font-size: var(--fs-2xl); margin-top: var(--s-2); }
.section-head p { margin-top: var(--s-3); color: var(--c-text-2); }
.lead { font-size: var(--fs-lg); color: var(--c-text-2); }

/* page title band (inner pages) */
.page-hero { background: var(--c-surface); border-bottom: 1px solid var(--c-border); padding: var(--s-8) 0 var(--s-10); position: relative; overflow: hidden; }
.page-hero h1 { font-size: var(--fs-2xl); margin-top: var(--s-2); }
.page-hero p { margin-top: var(--s-3); max-width: 680px; color: var(--c-text-2); }
.page-hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; opacity: .14;
  background: linear-gradient(var(--cw-gold), var(--cw-gold)) 0 0 / 50% 50% no-repeat, linear-gradient(var(--cw-purple), var(--cw-purple)) 100% 0 / 50% 50% no-repeat,
  linear-gradient(var(--cw-brick), var(--cw-brick)) 0 100% / 50% 50% no-repeat, linear-gradient(var(--cw-blue), var(--cw-blue)) 100% 100% / 50% 50% no-repeat; }
.crumbs { font-size: var(--fs-xs); color: var(--c-muted); }
.crumbs a { color: var(--c-muted); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 var(--s-2); padding: 0; }
.crumbs li + li::before { content: "/"; margin-right: 6px; }

/* ---------- Home hero ---------- */
.hero { background: var(--c-ink-dark); color: var(--c-on-dark); position: relative; overflow: hidden; }
.hero .wrap { display: grid; gap: var(--s-8); padding-top: var(--s-10); padding-bottom: var(--s-12); }
.hero .eyebrow { color: #FFB3B5; }        /* 9.9:1 on dark */
.hero h1 { font-size: var(--fs-3xl); margin-top: var(--s-3); }
.hero h1 em { font-style: normal; color: #FF6B70; }  /* 5.9:1 on #1C1D1F */
.hero p { margin-top: var(--s-4); color: var(--c-on-dark-2); font-size: var(--fs-lg); max-width: 560px; }
.hero .btn-row { margin-top: var(--s-6); }
.hero-media { border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 4 / 3; background: #2A2B2E; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-bar { height: 6px; display: grid; grid-template-columns: repeat(4, 1fr); }
.hero-bar span:nth-child(1) { background: var(--cw-gold); } .hero-bar span:nth-child(2) { background: var(--cw-purple); }
.hero-bar span:nth-child(3) { background: var(--cw-brick); } .hero-bar span:nth-child(4) { background: var(--cw-blue); }
@media (min-width: 960px) {
  .hero .wrap { grid-template-columns: 1.1fr 1fr; align-items: center; padding-top: var(--s-16); padding-bottom: var(--s-16); }
}

/* ---------- Highlights ---------- */
.highlights { display: grid; gap: var(--s-3); grid-template-columns: 1fr 1fr; }
.highlight { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: var(--s-4); }
.highlight .icon { color: var(--c-primary); width: 28px; height: 28px; }
.highlight strong { display: block; margin-top: var(--s-2); font-size: var(--fs-md); line-height: 1.35; }
.highlight span { display: block; margin-top: var(--s-1); color: var(--c-text-2); font-size: var(--fs-sm); line-height: 1.5; }
@media (min-width: 960px) { .highlights { grid-template-columns: repeat(4, 1fr); gap: var(--s-4); } .highlight { padding: var(--s-6); } }

/* ---------- Cards ---------- */
.grid { display: grid; gap: var(--s-4); grid-template-columns: 1fr; }
@media (min-width: 600px) { .grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); } }
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: var(--s-5); box-shadow: var(--sh-1);
  display: flex; flex-direction: column; gap: var(--s-2); position: relative; }
.card h3 { font-size: var(--fs-lg); }
.card p { color: var(--c-text-2); font-size: var(--fs-md); }
.card-icon { width: 52px; height: 52px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--c-primary-soft); color: var(--c-primary-ink); margin-bottom: var(--s-2); }
.card-icon .icon { width: 28px; height: 28px; }
.card-link { margin-top: auto; padding-top: var(--s-2); font-weight: 600; color: var(--c-primary-ink); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); }
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-lg); }  /* whole card clickable */
.card:has(.card-link):hover { border-color: var(--c-border-strong); box-shadow: var(--sh-2); }

/* portfolio */
.work { padding: 0; overflow: hidden; }
.work figure { margin: 0; aspect-ratio: 4 / 3; background: var(--c-surface-2); }
.work figure img { width: 100%; height: 100%; object-fit: cover; }
.work .body { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-2); }
.tag { align-self: flex-start; font-size: var(--fs-xs); font-weight: 600; padding: 2px 10px; border-radius: var(--r-pill); background: var(--c-surface-2); color: var(--c-text-2); }
.note { margin-top: var(--s-6); font-size: var(--fs-xs); color: var(--c-muted); }

/* service detail list */
.svc { display: grid; gap: var(--s-4); padding: var(--s-6) 0; border-top: 1px solid var(--c-border); }
.svc:first-of-type { border-top: 0; padding-top: 0; }
.svc h2 { font-size: var(--fs-xl); display: flex; align-items: center; gap: var(--s-3); }
.svc ul { margin: 0; padding-left: 1.2em; color: var(--c-text-2); }
.svc li + li { margin-top: var(--s-1); }
@media (min-width: 960px) { .svc { grid-template-columns: 1fr 1fr; gap: var(--s-10); padding: var(--s-10) 0; } }

/* steps */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-4); counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 44px 1fr; gap: var(--s-3); align-items: start; }
.steps li::before { content: counter(step); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--c-ink-dark); color: #fff; font-weight: 600; }
.steps strong { display: block; font-size: var(--fs-md); }
.steps span { color: var(--c-text-2); font-size: var(--fs-sm); }
@media (min-width: 960px) { .steps { grid-template-columns: repeat(5, 1fr); } .steps li { grid-template-columns: 1fr; } }

/* facts table (about) */
.facts { margin: 0; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); overflow: hidden; }
.facts div { padding: var(--s-4) var(--s-5); border-top: 1px solid var(--c-surface-2); }
.facts div:first-child { border-top: 0; }
.facts dt { font-size: var(--fs-sm); color: var(--c-muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; }
@media (min-width: 600px) { .facts div { display: grid; grid-template-columns: 220px 1fr; gap: var(--s-4); } .facts dd { margin: 0; } }

.two-col { display: grid; gap: var(--s-8); }
@media (min-width: 960px) { .two-col { grid-template-columns: 1fr 1fr; gap: var(--s-12); align-items: start; } }
.prose > * + * { margin-top: var(--s-4); }
.prose h2 { font-size: var(--fs-xl); margin-top: var(--s-8); }



/* ---------- Contact ---------- */
.contact-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: var(--s-6); display: grid; gap: var(--s-5); }
.contact-row { display: grid; grid-template-columns: 24px 1fr; gap: var(--s-3); }
.contact-row .icon { color: var(--c-primary); margin-top: 3px; }
.contact-row strong { display: block; }
.contact-row span, .contact-row address { color: var(--c-text-2); font-style: normal; }
.contact-actions { display: grid; gap: var(--s-3); }
.map { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--c-border); background: var(--c-surface-2); aspect-ratio: 4 / 3; }
.map iframe { width: 100%; height: 100%; border: 0; display: block; }
@media (min-width: 960px) { .map { aspect-ratio: auto; height: 100%; min-height: 420px; } }

/* ---------- CTA band ---------- */
.cta-band { background: var(--c-primary); color: #fff; border-radius: var(--r-lg); padding: var(--s-8) var(--s-6); display: grid; gap: var(--s-5); }
.cta-band h2 { font-size: var(--fs-2xl); }
.cta-band p { color: #FFF1F1; }
.cta-band .btn-primary { background: #fff; color: var(--c-primary-ink); }
@media (min-width: 960px) { .cta-band { grid-template-columns: 1fr auto; align-items: center; padding: var(--s-10) var(--s-12); } }

/* ---------- Footer ---------- */
.site-footer { background: var(--c-ink-dark); color: var(--c-on-dark-2); padding: var(--s-10) 0 var(--s-8); font-size: var(--fs-sm); }
.site-footer .wrap { display: grid; gap: var(--s-8); }
.site-footer strong { color: #fff; font-size: var(--fs-md); }
.site-footer address { font-style: normal; margin-top: var(--s-2); line-height: 1.7; }
.site-footer nav { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s-4); }
.site-footer nav a { color: var(--c-on-dark-2); text-decoration: none; min-height: var(--tap); display: flex; align-items: center; }
.site-footer nav a:hover { color: #fff; text-decoration: underline; }
.footer-brand { display: flex; gap: var(--s-3); align-items: flex-start; }
.footer-brand img { width: 48px; height: 48px; border-radius: 6px; background: #fff; }
.copy { border-top: 1px solid #3A3B3E; padding-top: var(--s-5); font-size: var(--fs-xs); }
@media (min-width: 960px) { .site-footer .wrap { grid-template-columns: 2fr 1fr; } .copy { grid-column: 1 / -1; } }

/* ---------- Mobile CTA bar (fixed, thumb zone) ---------- */
.cta-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2);
  padding: var(--s-2) var(--s-3) calc(var(--s-2) + var(--safe-b)); background: var(--c-surface); border-top: 1px solid var(--c-border);
  box-shadow: 0 -4px 16px rgba(28, 29, 31, .08); }
.cta-bar .btn { min-height: var(--tap-lg); padding: var(--s-2); font-size: 17px; }
@media (min-width: 960px) { .cta-bar { display: none; } }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: var(--s-16) 0; }
.notfound .code { font-size: 64px; font-weight: 600; color: var(--c-primary); line-height: 1; }
.notfound h1 { font-size: var(--fs-xl); margin-top: var(--s-4); }
.notfound p { margin-top: var(--s-3); color: var(--c-text-2); }
.notfound .btn-row { justify-content: center; margin-top: var(--s-6); }

/* ---------- Round 2 (2569-11-17) ---------- */
.cta-bar { grid-template-columns: 1fr 1fr; }
.cta-2l { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.cta-2l small { font-size: var(--fs-xs); font-weight: 600; opacity: .95; }
.site-footer address a, .contact-row a { color: inherit; text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.tel-list { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); }
.tel-list a { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; color: var(--c-text); }
.site-footer address a[href^="tel:"] { white-space: nowrap; }
.nw { white-space: nowrap; }  /* keep words the Thai line-breaker splits (e.g. ซีลแลนท์) */
picture { display: contents; }
.svc-photo { margin: var(--s-4) 0 0; border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 4 / 3; background: var(--c-surface-2); }
.svc-photo img { width: 100%; height: 100%; object-fit: cover; }
.map-link { margin-top: var(--s-3); font-size: var(--fs-sm); color: var(--c-text-2); }
.map-link a { font-weight: 600; color: var(--c-primary-ink); display: inline-flex; align-items: center; min-height: var(--tap); }
