/* ToolSiam — hand-written, no framework, no CSS build step. These are SEO
   landing pages and load speed is part of ranking. */

:root {
  --ink: #1B2A3D;
  --ink-soft: #40566F;
  --muted: #6B7C8F;
  --accent: #1F3A5F;
  --accent-2: #2E6FB7;
  --line: #DCE5EF;
  --tint: #F4F8FC;
  --ok: #1E7A4D;
  --warn: #B45309;
  --bad: #B02A37;
  --radius: 12px;
  --max: 1120px;
  --sans: "Noto Sans Thai", "Sarabun", "Leelawadee UI", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: #fff;
  line-height: 1.65;
  font-size: 17px;
}

.wrap { width: min(100% - 2.5rem, var(--max)); margin-inline: auto; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: .7rem 1.1rem;
}
.skip:focus { left: 0; }

a { color: var(--accent-2); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 { line-height: 1.28; color: var(--accent); font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.6rem); margin: 0 0 .5rem; }
h2 { font-size: clamp(1.3rem, 1.05rem + 1vw, 1.75rem); margin: 2.4rem 0 .8rem; }
h3 { font-size: 1.15rem; margin: 1.6rem 0 .5rem; }
p { margin: 0 0 1rem; }

/* ── Bilingual strategy ──────────────────────────────────────────────────
   Both languages ship in the HTML so each is indexable; CSS shows one.
   Toggling flips [data-lang] on <html>, never a JS re-render.            */
html[data-lang="th"] [lang="en"],
html[data-lang="en"] [lang="th"] { display: none !important; }
html[data-lang="th"] .bi, html[data-lang="en"] .bi { display: contents; }

.lang-toggle {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: .28rem; display: inline-flex; gap: .15rem; cursor: pointer;
  font: inherit; font-size: .82rem;
}
.lang-toggle .lg { padding: .25rem .7rem; border-radius: 999px; color: var(--muted); }
html[data-lang="th"] .lang-toggle .lg-th,
html[data-lang="en"] .lang-toggle .lg-en { background: var(--accent); color: #fff; }

/* ── Header ── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 1.5rem; height: 64px; }
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--accent); }
.brand .logo { font-size: 1.3rem; color: var(--accent-2); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-size: 1.06rem; letter-spacing: -.02em; }
.brand-text em { font-style: normal; font-size: .76rem; color: var(--muted); }
.nav { display: flex; gap: 1.35rem; margin-left: auto; }
.nav a { text-decoration: none; color: var(--ink-soft); font-size: .95rem; font-weight: 500; }
.nav a:hover { color: var(--accent); }

/* ── Hero ── */
.hero { padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(1.5rem, 4vw, 3rem); }
.hero p.lede { font-size: clamp(1.02rem, .95rem + .4vw, 1.2rem); color: var(--ink-soft); max-width: 62ch; }
.hero .badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.2rem; }
.badge {
  font-size: .8rem; background: var(--tint); border: 1px solid var(--line);
  color: var(--ink-soft); padding: .32rem .7rem; border-radius: 999px;
}

/* ── Cards / grids ── */
.grid { display: grid; gap: 1.1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }

.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.15rem 1.2rem; background: #fff; text-decoration: none;
  color: inherit; display: flex; flex-direction: column; gap: .4rem;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
a.card:hover { transform: translateY(-3px); border-color: var(--accent-2); box-shadow: 0 8px 24px -14px rgba(31,58,95,.45); }
.card .ico { font-size: 1.35rem; color: var(--accent-2); }
.card h3 { margin: 0; font-size: 1.03rem; color: var(--accent); }
.card p { margin: 0; font-size: .9rem; color: var(--muted); }
.card .meta { font-size: .78rem; color: var(--accent-2); font-weight: 600; margin-top: auto; padding-top: .4rem; }
/* Covers ship at 1200×1200 (Polar's required size) — never let them render
   at intrinsic width inside a card; that pushes a 1200px image into a
   280px column and gives the whole page a horizontal scrollbar. */
.card img { display: block; width: 100%; max-width: 100%; height: auto; }

/* ── Product page: peek-inside + trust + sticky buy ── */
.peek { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; background: var(--tint); margin: .6rem 0 1.4rem; }
.peek-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.chip { display: inline-block; font-size: .78rem; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .18rem .65rem; color: var(--ink-soft); }
.peek-scroll { overflow-x: auto; margin: .55rem 0; border: 1px solid var(--line); border-radius: 8px; }
.peek-table { border-collapse: collapse; font-size: .84rem; background: #fff; min-width: 100%; }
.peek-table th { background: var(--accent); color: #fff; padding: .4rem .7rem; text-align: left; white-space: nowrap; font-weight: 600; }
.peek-table td { border: 1px solid var(--line); padding: .34rem .7rem; white-space: nowrap; color: var(--ink-soft); }
.peek-list { margin: .3rem 0 .2rem; padding-left: 1.15rem; font-size: .9rem; }
.peek-list li { margin: .18rem 0; }
.peek-when { color: var(--muted); font-size: .8rem; }
.peek-note { font-size: .82rem; color: var(--muted); margin: .5rem 0 0; }
.lic-links { margin: .5rem 0 0; font-size: .82rem; }
.lic-links a { color: var(--accent-2); text-decoration: underline; }
.hero-cta { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.2rem; }
.buy-sticky { display: none; }
@media (max-width: 640px) {
  .buy-sticky { display: flex; position: fixed; inset: auto 0 0 0; z-index: 60; gap: .9rem; align-items: center; justify-content: space-between;
    background: #fff; border-top: 1px solid var(--line); padding: .65rem 1rem; box-shadow: 0 -8px 24px -16px rgba(31,58,95,.5); }
  .buy-sticky .amt { font-size: 1.25rem; font-weight: 700; color: var(--accent); }
  .buy-sticky .buy { margin: 0; padding: .6rem 1.3rem; }
  body:has(.buy-sticky) { padding-bottom: 66px; }
}

/* ── Tool panel ── */
.tool {
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; margin: 1.5rem 0;
}
.tool-head { background: var(--tint); border-bottom: 1px solid var(--line); padding: .75rem 1.1rem; font-size: .85rem; color: var(--muted); }
.tool-body { padding: 1.3rem; }
.tool-foot { border-top: 1px solid var(--line); padding: .8rem 1.1rem; font-size: .82rem; color: var(--muted); background: #FCFDFE; }

label { display: block; font-size: .84rem; font-weight: 600; color: var(--ink-soft); margin: .8rem 0 .3rem; }
label:first-child { margin-top: 0; }

input[type="text"], input[type="number"], input[type="url"], input[type="password"],
select, textarea {
  width: 100%; font: inherit; font-size: 1rem; padding: .6rem .7rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; border-color: var(--accent-2); }
textarea { min-height: 170px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; }

.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  padding: .62rem 1.15rem; border-radius: 8px; font-size: .95rem;
  transition: background .12s ease;
}
.btn:hover { background: #17304c; }
.btn.ghost { background: #fff; color: var(--accent); }
.btn.ghost:hover { background: var(--tint); }
.btn.sm { padding: .42rem .8rem; font-size: .85rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1rem; }

.out {
  margin-top: 1.1rem; padding: 1rem; background: var(--tint);
  border: 1px solid var(--line); border-radius: 8px;
}
.out .big { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); font-weight: 700; color: var(--accent); line-height: 1.2; }
.out .sub { font-size: .9rem; color: var(--muted); margin-top: .3rem; }
.out .lines { font-size: .93rem; }
.out .lines div { display: flex; justify-content: space-between; padding: .22rem 0; border-bottom: 1px dashed var(--line); }
.out .lines div:last-child { border-bottom: 0; }
.out .lines b { color: var(--accent); }

.pill { display: inline-block; font-size: .78rem; font-weight: 700; padding: .16rem .55rem; border-radius: 999px; }
.pill.ok { background: #E4F4EC; color: var(--ok); }
.pill.warn { background: #FDF1E3; color: var(--warn); }
.pill.bad { background: #FBE9EB; color: var(--bad); }

.meter { height: 9px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: .55rem; }
.meter i { display: block; height: 100%; background: var(--ok); transition: width .2s ease; }

canvas { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* ── Content sections ── */
.prose { max-width: 74ch; }
.prose ul { padding-left: 1.15rem; }
.prose li { margin-bottom: .4rem; }
.prose code { background: var(--tint); padding: .1rem .35rem; border-radius: 4px; font-size: .9em; }

.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); padding: .85rem 0; }
.faq summary { cursor: pointer; font-weight: 600; color: var(--accent); list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--accent-2); font-size: 1.2rem; }
.faq details[open] summary::after { content: '−'; }
.faq p { margin: .6rem 0 0; color: var(--ink-soft); font-size: .96rem; }

.callout {
  border-left: 3px solid var(--accent-2); background: var(--tint);
  padding: .9rem 1.1rem; border-radius: 0 8px 8px 0; margin: 1.5rem 0;
}
.callout h4 { margin: 0 0 .35rem; font-size: .98rem; }
.callout p { margin: 0; font-size: .93rem; color: var(--ink-soft); }

/* ── Product page ── */
.product-hero { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 2rem; align-items: start; }
.product-hero img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); display: block; }
.price-tag { display: flex; align-items: baseline; gap: .6rem; margin: .6rem 0 1rem; }
.price-tag .amt { font-size: 2.1rem; font-weight: 700; color: var(--accent); }
.price-tag .note { font-size: .84rem; color: var(--muted); }
.buy {
  display: inline-block; background: var(--accent); color: #fff; text-decoration: none;
  padding: .8rem 1.6rem; border-radius: 8px; font-weight: 600; font-size: 1.02rem;
}
.buy:hover { background: #17304c; color: #fff; }
.buy.disabled { background: var(--muted); cursor: not-allowed; }
.lic { font-size: .86rem; color: var(--muted); margin-top: .9rem; }
.bullets { list-style: none; padding: 0; margin: 1rem 0; }
.bullets li { padding-left: 1.5rem; position: relative; margin-bottom: .45rem; }
.bullets li::before { content: '✓'; position: absolute; left: 0; color: var(--ok); font-weight: 700; }

/* ── Conversion (programmatic SEO) ── */
.calc-box { background: var(--tint); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; margin: 1.4rem 0; }
.calc-box .result { font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem); font-weight: 700; color: var(--accent); margin-top: .7rem; }
.conv-table { width: 100%; border-collapse: collapse; font-size: .93rem; margin: 1rem 0; }
.conv-table th, .conv-table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.conv-table th { background: var(--tint); color: var(--accent); font-weight: 700; }
.conv-table tr:nth-child(even) td { background: #FCFDFE; }

/* ── Footer ── */
.site-footer { border-top: 1px solid var(--line); background: var(--tint); margin-top: 3.5rem; padding: 2.5rem 0 1.5rem; }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1.6rem; }
.foot-grid h4 { margin: 0 0 .5rem; font-size: .92rem; }
.foot-grid a { display: block; text-decoration: none; color: var(--ink-soft); font-size: .9rem; padding: .16rem 0; }
.foot-grid a:hover { color: var(--accent); }
.foot-grid p { font-size: .9rem; color: var(--ink-soft); }
.foot-bottom { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 1.8rem; padding-top: 1.1rem; font-size: .84rem; color: var(--muted); }

/* ── Misc ── */
.crumbs { font-size: .84rem; color: var(--muted); margin-bottom: .9rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.tag { display: inline-block; font-size: .76rem; background: var(--tint); border: 1px solid var(--line); border-radius: 5px; padding: .12rem .5rem; color: var(--ink-soft); margin: 0 .25rem .25rem 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.empty { color: var(--muted); font-size: .9rem; font-style: italic; }

@media (max-width: 720px) {
  body { font-size: 16px; }
  .site-header .wrap { height: auto; padding: .6rem 0; flex-wrap: wrap; gap: .8rem; }
  .nav { order: 3; width: 100%; margin-left: 0; gap: 1rem; }
  .product-hero { grid-template-columns: 1fr; }
  .lang-toggle { margin-left: auto; }
}

@media print {
  .site-header, .site-footer, .lang-toggle, .btn-row { display: none; }
  body { font-size: 12pt; }
}
