/* Budgy — คู่มือการใช้งาน.
   Shares the landing tokens (tri-leaf teal / gold / purple) and the blog's
   nav + footer, adds documentation furniture: sticky TOC, numbered steps,
   phone frames, tier pills, callouts. */

:root {
  --teal: #14B8A6;
  --teal-d: #0D9488;
  --gold: #F5A623;
  --gold-d: #D97706;
  --purple: #A855F7;
  --purple-d: #7C3AED;
  --pink: #EC4899;
  --ink: #0F172A;
  --ink-soft: #334155;
  --ink-mute: #64748B;
  --bg: #F8FAFC;
  --line: #E2E8F0;
  --card: #FFFFFF;
  --radius: 16px;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Noto Sans Thai', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

/* ── Top nav (matches blog.css) ───────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.nav .logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.nav .logo img { height: 32px; width: auto; }
.nav .logo span { font-weight: 800; font-size: 20px; }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { color: var(--ink-soft); text-decoration: none; font-weight: 500; font-size: 15px; }
.nav-links a:hover { color: var(--purple-d); }
.nav-links a[aria-current="page"] { color: var(--purple-d); font-weight: 700; }
.nav-cta {
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-d) 100%);
  color: white !important;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
}

/* ── Hero ─────────────────────────────────────────────────────── */
.guide-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(60% 120% at 12% 0%, rgba(20, 184, 166, 0.14), transparent 60%),
    radial-gradient(50% 110% at 88% 10%, rgba(168, 85, 247, 0.16), transparent 62%),
    radial-gradient(40% 90% at 50% 100%, rgba(245, 166, 35, 0.12), transparent 65%),
    #FFFFFF;
}
.guide-hero-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 68px 24px 56px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--purple-d);
  background: rgba(168, 85, 247, 0.10);
  border: 1px solid rgba(168, 85, 247, 0.22);
  padding: 6px 14px;
  border-radius: 999px;
}
.guide-hero h1 {
  font-size: clamp(32px, 5.2vw, 52px);
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin: 18px 0 12px;
  max-width: 18ch;
}
.guide-hero .lede {
  font-size: clamp(17px, 2.1vw, 20px);
  color: var(--ink-soft);
  max-width: 60ch;
  margin: 0 0 28px;
}
.hero-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.jump-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  transition: border-color .15s, transform .15s, color .15s;
}
.jump-chip:hover { border-color: var(--purple); color: var(--purple-d); transform: translateY(-2px); }
.jump-chip svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ── Layout: sidebar + article ────────────────────────────────── */
.guide-layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 88px;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}
.toc {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
  padding-right: 8px;
}
.toc-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 12px;
}
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: flex;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 9px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14.5px;
  line-height: 1.45;
  border-left: 2px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  color: var(--ink-mute);
  font-size: 11px;
  font-weight: 800;
  padding-top: 3px;
  font-variant-numeric: tabular-nums;
}
.toc a:hover { background: rgba(168, 85, 247, 0.07); color: var(--ink); }
.toc a.active {
  color: var(--purple-d);
  font-weight: 700;
  background: rgba(168, 85, 247, 0.09);
  border-left-color: var(--purple);
}
.toc a.active::before { color: var(--purple); }

.guide-body { min-width: 0; }

/* ── Sections ─────────────────────────────────────────────────── */
.sec { padding-top: 8px; margin-bottom: 64px; }
.sec > h2 {
  font-size: clamp(24px, 3.2vw, 31px);
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin: 0 0 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}
.sec > h2 .num {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: var(--purple);
  background: rgba(168, 85, 247, 0.10);
  border-radius: 8px;
  padding: 3px 9px;
  letter-spacing: 0.04em;
  flex: none;
  transform: translateY(-3px);
}
.sec > .sec-lede { color: var(--ink-mute); margin: 0 0 24px; font-size: 16px; }
.sec h3 {
  font-size: 19px;
  margin: 34px 0 8px;
  letter-spacing: -0.01em;
}
.sec p { color: var(--ink-soft); margin: 0 0 16px; }
.sec ul { color: var(--ink-soft); padding-left: 22px; margin: 0 0 18px; }
.sec li { margin-bottom: 6px; }
.sec strong { color: var(--ink); font-weight: 700; }
.sec a:not(.jump-chip):not(.store-btn) {
  color: var(--purple-d);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.sec a:hover { color: var(--pink); }

/* Key path — "หน้าหลัก › ปุ่ม + › บันทึก" */
.path {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0 0 20px;
}
.path .sep { color: var(--ink-mute); font-weight: 400; }
.path b { color: var(--ink); font-weight: 700; }

/* Numbered steps */
.steps { list-style: none; counter-reset: step; margin: 0 0 24px; padding: 0; }
.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 22px 46px;
  color: var(--ink-soft);
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, var(--teal) 0%, var(--purple) 100%);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.22);
}
.steps > li::after {
  content: '';
  position: absolute;
  left: 14.5px;
  top: 34px;
  bottom: 4px;
  width: 1.5px;
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.35), rgba(168, 85, 247, 0.05));
}
.steps > li:last-child { padding-bottom: 0; }
.steps > li:last-child::after { display: none; }
.steps > li b { color: var(--ink); }

/* Method cards */
.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(248px, 1fr));
  gap: 14px;
  margin: 0 0 28px;
}
.method {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.method:hover {
  border-color: rgba(168, 85, 247, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.07);
}
.method .ico {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--teal) 0%, var(--purple) 100%);
}
.method .ico svg { width: 20px; height: 20px; stroke: white; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.method.gold .ico { background: linear-gradient(135deg, var(--gold) 0%, var(--gold-d) 100%); }
.method.teal .ico { background: linear-gradient(135deg, var(--teal) 0%, var(--teal-d) 100%); }
.method.purple .ico { background: linear-gradient(135deg, var(--purple) 0%, var(--purple-d) 100%); }
.method h4 { margin: 0 0 4px; font-size: 16.5px; }
.method p { margin: 0; font-size: 14.5px; color: var(--ink-mute); line-height: 1.6; }
.method .best { display: block; margin-top: 10px; font-size: 12.5px; font-weight: 700; color: var(--teal-d); }

/* Tier pills */
.tier {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 2px 9px;
  border-radius: 999px;
  vertical-align: middle;
  white-space: nowrap;
}
.tier.free { background: rgba(20, 184, 166, 0.13); color: var(--teal-d); }
.tier.pro { background: rgba(168, 85, 247, 0.13); color: var(--purple-d); }
.tier.premium { background: rgba(245, 166, 35, 0.16); color: #B45309; }

/* Callouts */
.note {
  border-left: 4px solid var(--teal);
  background: rgba(20, 184, 166, 0.07);
  border-radius: 0 14px 14px 0;
  padding: 16px 20px;
  margin: 0 0 24px;
  font-size: 15.5px;
  color: var(--ink-soft);
}
.note.warn { border-left-color: var(--gold); background: rgba(245, 166, 35, 0.09); }
.note.tip { border-left-color: var(--purple); background: rgba(168, 85, 247, 0.07); }
.note b { color: var(--ink); }
.note p { margin: 0 0 8px; }
.note p:last-child { margin: 0; }
.note-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--teal-d);
  margin-bottom: 4px;
}
.note.warn .note-label { color: var(--gold-d); }
.note.tip .note-label { color: var(--purple-d); }

/* Blocks with their own background must sit BESIDE the floated screenshot, not
   slide under it. Only inline content respects a float by default, so a .note or
   .steps box ran its full width behind the phone image and lost its right edge.
   flow-root gives each one its own block formatting context, which floats push. */
.sec .note,
.sec .steps,
.sec > ul,
.sec > ol,
.sec .says {
  display: flow-root;
}

/* Screenshot */
.shot {
  float: right;
  width: 210px;
  margin: 4px 0 20px 28px;
}
.shot img {
  width: 100%;
  /* The <img> carries width/height attributes for CLS. Without height:auto the
     height attribute wins literally, so a 540x1200 screenshot rendered 208x1200
     — stretched 2.6x and taller than the viewport. */
  height: auto;
  display: block;
  border-radius: 22px;
  border: 1px solid var(--line);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.14);
  background: white;
}
.shot figcaption {
  font-size: 12.5px;
  color: var(--ink-mute);
  text-align: center;
  margin-top: 10px;
  line-height: 1.5;
}

/* Tables */
.sec table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 26px;
  font-size: 15px;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.sec th, .sec td { padding: 11px 15px; text-align: left; border-bottom: 1px solid var(--line); }
.sec th { background: var(--bg); font-weight: 700; font-size: 14px; }
.sec tbody tr:last-child td { border-bottom: none; }
.sec td:not(:first-child) { color: var(--ink-soft); }
.table-scroll { overflow-x: auto; margin: 0 0 10px; }
/* A wide table scrolls sideways on phones; without a hint the Premium column
   is simply invisible and reads as missing. */
.scroll-hint { display: none; }
.table-scroll table { margin: 0; min-width: 520px; }

/* Example phrases */
.says {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  margin: 0 0 24px;
}
.says span {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  color: var(--ink-soft);
  position: relative;
  padding-left: 34px;
}
.says span::before {
  content: '“';
  position: absolute;
  left: 13px;
  top: 8px;
  font-size: 26px;
  line-height: 1;
  color: var(--purple);
  font-weight: 800;
}

/* FAQ */
.faq details {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 10px;
}
.faq summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 16.5px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--purple-d); font-size: 20px; font-weight: 700; flex: none; }
.faq details[open] summary::after { content: '–'; }
.faq details p { margin: 12px 0 0; color: var(--ink-soft); font-size: 15.5px; }

/* CTA */
.cta-card {
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-d) 100%);
  color: white;
  padding: 30px;
  border-radius: 22px;
  margin: 48px 0 0;
  box-shadow: 0 16px 40px rgba(124, 58, 237, 0.26);
}
.cta-card h3 { color: white; margin: 0 0 8px; font-size: 23px; }
.cta-card p { color: rgba(255, 255, 255, 0.92); margin: 0 0 20px; font-size: 15.5px; }
.cta-card .stores { display: flex; gap: 12px; flex-wrap: wrap; }
.store-btn {
  background: white;
  color: var(--ink);
  padding: 12px 20px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  font-size: 14.5px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform .15s;
}
.store-btn:hover { transform: translateY(-2px); }

/* Footer */
.footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--ink-mute);
  font-size: 14px;
}
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--ink-mute); text-decoration: none; }
.footer-links a:hover { color: var(--purple-d); }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 980px) {
  .guide-layout { grid-template-columns: 1fr; gap: 0; }
  .toc {
    position: static;
    max-height: none;
    overflow: visible;
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 16px;
    margin-bottom: 40px;
  }
  .toc ol { columns: 2; column-gap: 20px; }
  .toc li { break-inside: avoid; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .scroll-hint {
    display: block;
    font-size: 13px;
    color: var(--ink-mute);
    margin: 0 0 22px;
  }
  /* See index.html: hiding these left no way to reach any section on a phone. */
  .nav-inner { gap: 10px; padding-left: 16px; padding-right: 16px; }
  .nav .logo span { display: none; }
  .nav-links {
    gap: 13px;
    flex: 1 1 auto;
    min-width: 0;
    /* auto margin, not flex-end — see index.html */
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links > :first-child { margin-left: auto; }
  .nav-links a { font-size: 13px; white-space: nowrap; flex: none; }
  .nav-cta { padding: 9px 15px; font-size: 12.5px; }
  .guide-hero-inner { padding: 44px 20px 40px; }
  .guide-layout { padding: 32px 20px 64px; }
  .toc ol { columns: 1; }
  .shot { float: none; width: min(210px, 62%); margin: 0 auto 24px; }
  .sec { margin-bottom: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
