/* FAFA828 — theme: deep purple + gold | prefix ff- | font: Chakra Petch */
:root {
  --ff-bg: #0d0a1a;
  --ff-bg-2: #15102a;
  --ff-card: #1b1435;
  --ff-line: #2f2557;
  --ff-purple: #7c3aed;
  --ff-purple-deep: #2e1065;
  --ff-purple-text: #c4b5fd;   /* links on dark: contrast ~9:1 */
  --ff-gold: #f5b301;
  --ff-gold-soft: #fcd34d;
  --ff-text: #ece8f7;          /* ~15:1 on bg */
  --ff-muted: #b9b0d4;         /* ~9:1 on bg */
  --ff-todo: #ffe08a;
  --ff-radius: 14px;
  --ff-wrap: 1120px;
  --ff-read: 760px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Chakra Petch', 'Noto Sans Thai', Tahoma, sans-serif;
  font-size: 17px;
  line-height: 1.75;
  color: var(--ff-text);
  background: var(--ff-bg);
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--ff-purple-text); text-underline-offset: 3px; }
a:hover { color: var(--ff-gold-soft); }
:focus-visible { outline: 3px solid var(--ff-gold); outline-offset: 3px; border-radius: 4px; }
strong { color: #fff; font-weight: 700; }
.ff-skip { position: absolute; left: -999px; top: 0; background: var(--ff-gold); color: #1a1033; padding: 8px 14px; z-index: 100; }
.ff-skip:focus { left: 8px; top: 8px; }
.ff-wrap { width: 100%; max-width: var(--ff-wrap); margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.ff-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(13, 10, 26, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ff-line);
}
.ff-header .ff-wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.ff-logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; font-size: 26px; letter-spacing: .5px; color: #fff; }
.ff-logo b { color: var(--ff-gold); font-weight: 700; }
.ff-logo svg { width: 34px; height: 34px; }
.ff-nav { display: none; }
.ff-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.ff-nav a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--ff-text); text-decoration: none; font-weight: 600; font-size: 16px; }
.ff-nav a:hover { background: var(--ff-card); color: var(--ff-gold-soft); }
.ff-menu { position: relative; }
.ff-menu summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--ff-line); color: #fff; }
.ff-menu summary::-webkit-details-marker { display: none; }
.ff-menu[open] .ff-menu-panel { display: block; }
.ff-menu-panel { display: none; position: absolute; right: 0; top: 52px; width: 240px; background: var(--ff-bg-2); border: 1px solid var(--ff-line); border-radius: var(--ff-radius); padding: 8px; box-shadow: 0 16px 40px rgba(0,0,0,.5); }
.ff-menu-panel a { display: block; padding: 12px 14px; border-radius: 10px; color: var(--ff-text); text-decoration: none; font-weight: 600; }
.ff-menu-panel a:hover { background: var(--ff-card); }
.ff-btn.ff-head-cta { display: none; }

/* ---------- buttons ---------- */
.ff-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 24px; border-radius: 999px;
  font: inherit; font-weight: 700; font-size: 17px; text-decoration: none; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.ff-btn:hover { transform: translateY(-1px); }
.ff-btn-gold { background: linear-gradient(180deg, #ffc929, var(--ff-gold)); color: #1a1033; box-shadow: 0 6px 20px rgba(245,179,1,.25); }
.ff-btn-gold:hover { color: #1a1033; box-shadow: 0 8px 26px rgba(245,179,1,.4); }
.ff-btn-ghost { border: 2px solid var(--ff-purple); color: #fff; background: transparent; }
.ff-btn-ghost:hover { background: var(--ff-purple-deep); color: #fff; }

/* ---------- hero ---------- */
.ff-hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(124,58,237,.35), transparent 60%),
    radial-gradient(700px 380px at 95% 110%, rgba(245,179,1,.12), transparent 60%),
    var(--ff-bg);
  border-bottom: 1px solid var(--ff-line);
}
.ff-hero .ff-wrap > * { min-width: 0; }
.ff-hero .ff-wrap { display: grid; gap: 28px; padding-top: 32px; padding-bottom: 36px; }
.ff-kicker { display: inline-block; font-size: 14px; font-weight: 600; letter-spacing: 1.5px; color: var(--ff-gold); text-transform: uppercase; margin: 0 0 8px; }
.ff-hero h1 { font-size: clamp(30px, 6vw, 50px); line-height: 1.25; margin: 0 0 16px; color: #fff; }
.ff-hero h1 > span:first-child { color: var(--ff-gold); }
.ff-nw { white-space: nowrap; }
.ff-lead { font-size: 18px; color: var(--ff-text); margin: 0 0 14px; }
.ff-disclose { font-size: 15px; color: var(--ff-muted); border-left: 3px solid var(--ff-gold); padding: 6px 0 6px 12px; margin: 0 0 20px; }
.ff-hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.ff-byline { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--ff-muted); margin: 0; }
.ff-byline a { color: var(--ff-purple-text); }
.ff-hero-media { border-radius: 18px; overflow: hidden; border: 1px solid var(--ff-line); box-shadow: 0 20px 60px rgba(0,0,0,.45); }

/* ---------- category strip ---------- */
.ff-cats { padding: 28px 0 8px; }
.ff-cats ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.ff-cat { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 16px; border-radius: var(--ff-radius); background: var(--ff-card); border: 1px solid var(--ff-line); text-decoration: none; color: var(--ff-text); transition: border-color .15s ease; }
.ff-cat:hover { border-color: var(--ff-gold); color: var(--ff-text); }
.ff-cat svg { width: 44px; height: 44px; }
.ff-cat b { font-size: 18px; color: #fff; }
.ff-cat small { font-size: 14px; color: var(--ff-muted); line-height: 1.5; }

/* ---------- article body ---------- */
.ff-main { padding: 12px 0 40px; }
.ff-article { max-width: var(--ff-read); margin: 0 auto; }
.ff-article section { padding-top: 34px; }
.ff-article h2 { font-size: clamp(23px, 3.6vw, 30px); line-height: 1.35; margin: 0 0 14px; color: #fff; }
.ff-article h2::before { content: ""; display: block; width: 48px; height: 4px; border-radius: 2px; background: var(--ff-gold); margin-bottom: 14px; }
.ff-article h3 { font-size: 21px; line-height: 1.4; margin: 26px 0 10px; color: var(--ff-gold-soft); }
.ff-article p { margin: 0 0 14px; }
.ff-answer { font-size: 18px; background: linear-gradient(90deg, rgba(124,58,237,.18), transparent); border-left: 4px solid var(--ff-purple); padding: 12px 16px; border-radius: 0 10px 10px 0; }
.ff-article ul, .ff-article ol { padding-left: 1.3em; margin: 0 0 16px; }
.ff-article li { margin: 0 0 8px; }
.ff-article li::marker { color: var(--ff-gold); }
.ff-formula { font-size: 17px; background: var(--ff-bg-2); border: 1px dashed var(--ff-gold); border-radius: 12px; padding: 14px 16px; margin: 0 0 16px; color: #fff; }
.ff-note { font-size: 15px; color: var(--ff-muted); }
.ff-figure { margin: 6px 0 18px; padding: 16px; background: var(--ff-card); border: 1px solid var(--ff-line); border-radius: var(--ff-radius); }
.ff-fig-title { margin: 0 0 12px !important; font-weight: 700; color: #fff; }
.ff-bars { list-style: none; padding: 0 !important; margin: 0 !important; }
.ff-bars li { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "l v" "t t"; gap: 4px 10px; margin: 0 0 12px !important; }
.ff-bars li::marker { content: none; }
.ff-bar-l { grid-area: l; font-size: 15px; }
.ff-bar-v { grid-area: v; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.ff-bar-t { grid-area: t; height: 12px; border-radius: 6px; background: rgba(255,255,255,.06); overflow: hidden; }
.ff-bar { display: block; height: 100%; border-radius: 6px; }
.ff-bar-ok { background: #34d399; } .ff-bar-mid { background: #a78bfa; } .ff-bar-hi { background: var(--ff-gold); } .ff-bar-max { background: #f87171; }
@media (min-width: 720px) { .ff-bars li { grid-template-columns: 170px 1fr 70px; grid-template-areas: "l t v"; align-items: center; } }
.ff-figure figcaption { font-size: 14px; color: var(--ff-muted); margin-top: 10px; }
.ff-steps { counter-reset: ffstep; list-style: none; padding: 0 !important; }
.ff-steps li { counter-increment: ffstep; position: relative; padding: 14px 16px 14px 64px; margin-bottom: 10px; background: var(--ff-card); border: 1px solid var(--ff-line); border-radius: 12px; }
.ff-steps li::before { content: counter(ffstep); position: absolute; left: 14px; top: 14px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #1a1033; background: var(--ff-gold); }
.ff-two { display: grid; gap: 12px; margin-bottom: 16px; }
.ff-box { padding: 16px 18px; border-radius: var(--ff-radius); background: var(--ff-card); border: 1px solid var(--ff-line); }
.ff-box h4 { margin: 0 0 8px; font-size: 18px; color: #fff; }
.ff-box ul { margin: 0; }
.ff-box-good { border-top: 4px solid #34d399; }
.ff-box-warn { border-top: 4px solid var(--ff-gold); }
.ff-todo { background: rgba(255,224,138,.14); color: var(--ff-todo); border: 1px dashed var(--ff-todo); border-radius: 6px; padding: 0 6px; font-size: .92em; }

/* FAQ */
.ff-faq details { background: var(--ff-card); border: 1px solid var(--ff-line); border-radius: 12px; margin-bottom: 10px; }
.ff-faq summary { cursor: pointer; padding: 14px 48px 14px 16px; font-weight: 700; color: #fff; position: relative; list-style: none; }
.ff-faq summary::-webkit-details-marker { display: none; }
.ff-faq summary::after { content: "+"; position: absolute; right: 18px; top: 10px; font-size: 26px; color: var(--ff-gold); }
.ff-faq details[open] summary::after { content: "–"; }
.ff-faq details > div { padding: 0 16px 14px; }
.ff-faq details > div p:last-child { margin-bottom: 0; }

/* author + responsible */
.ff-author { display: flex; gap: 14px; align-items: flex-start; margin-top: 34px; padding: 18px; border-radius: var(--ff-radius); background: var(--ff-bg-2); border: 1px solid var(--ff-line); }
.ff-author svg { flex: 0 0 56px; width: 56px; height: 56px; }
.ff-author p { margin: 0 0 4px; font-size: 15px; color: var(--ff-muted); }
.ff-author b { color: #fff; }
.ff-rg { margin-top: 18px; padding: 18px; border-radius: var(--ff-radius); background: rgba(52, 211, 153, .07); border: 1px solid rgba(52, 211, 153, .35); font-size: 15px; }
.ff-rg b { color: #6ee7b7; }

/* CTA band */
.ff-band { margin-top: 34px; padding: 24px; border-radius: 18px; text-align: center; background: linear-gradient(135deg, var(--ff-purple-deep), #1b1040 60%, #2a1a05); border: 1px solid var(--ff-line); }
.ff-band p { margin: 0 0 14px; font-size: 18px; }

/* ---------- footer ---------- */
.ff-footer { border-top: 1px solid var(--ff-line); background: #09071299; padding: 36px 0 96px; font-size: 15px; color: var(--ff-muted); }
.ff-foot-grid { display: grid; gap: 24px; grid-template-columns: repeat(2, 1fr); }
.ff-footer h2 { font-size: 16px; color: #fff; margin: 0 0 10px; }
.ff-footer ul { list-style: none; margin: 0; padding: 0; }
.ff-footer li { margin-bottom: 6px; }
.ff-footer a { color: var(--ff-muted); text-decoration: none; }
.ff-footer a:hover { color: var(--ff-gold-soft); }
.ff-legal { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--ff-line); font-size: 14px; }
.ff-age { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--ff-gold); color: var(--ff-gold); font-weight: 700; margin-right: 8px; vertical-align: middle; }

/* mobile sticky CTA (small, never covers reading area much) */
.ff-sticky { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: rgba(13,10,26,.96); border-top: 1px solid var(--ff-line); }
.ff-sticky .ff-btn { flex: 1; min-height: 46px; padding: 10px 14px; font-size: 16px; }

/* ---------- larger screens ---------- */
@media (min-width: 720px) {
  .ff-cats ul { grid-template-columns: repeat(4, 1fr); }
  .ff-two { grid-template-columns: 1fr 1fr; }
  .ff-foot-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 980px) {
  .ff-nav { display: block; }
  .ff-menu { display: none; }
  .ff-btn.ff-head-cta { display: inline-flex; min-height: 44px; padding: 8px 20px; font-size: 16px; }
  .ff-hero .ff-wrap { grid-template-columns: 1.05fr 1fr; align-items: center; padding-top: 48px; padding-bottom: 52px; }
  .ff-sticky { display: none; }
  .ff-footer { padding-bottom: 36px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- inner pages (phase 2) ---------- */
.ff-crumbs { font-size: 14px; color: var(--ff-muted); margin: 0 0 10px; }
.ff-crumbs a { color: var(--ff-muted); }
.ff-crumbs a:hover { color: var(--ff-gold-soft); }
.ff-crumbs [aria-current] { color: var(--ff-text); }
.ff-hero-plain .ff-wrap { grid-template-columns: 1fr !important; max-width: 860px; }
.ff-hero-plain h1 { font-size: clamp(28px, 5vw, 42px); }
.ff-nav a[aria-current="page"], .ff-menu-panel a[aria-current="page"] { color: var(--ff-gold); background: var(--ff-card); }
.ff-related { max-width: var(--ff-read); margin: 40px auto 0; }
.ff-related-t { font-weight: 700; font-size: 20px; color: #fff; margin: 0 0 12px; }
.ff-related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ff-rel { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 16px; border-radius: var(--ff-radius); background: var(--ff-card); border: 1px solid var(--ff-line); text-decoration: none; color: var(--ff-text); }
.ff-rel:hover { border-color: var(--ff-gold); color: var(--ff-text); }
.ff-rel b { color: #fff; }
.ff-rel small { font-size: 14px; color: var(--ff-muted); line-height: 1.5; }
.ff-warnbox { padding: 14px 16px; border-radius: 12px; background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.4); margin: 0 0 16px; }
.ff-warnbox p:last-child { margin-bottom: 0; }
@media (min-width: 720px) { .ff-related ul { grid-template-columns: repeat(3, 1fr); } }

/* ---------- guide index (phase 3) ---------- */
.ff-guides { list-style: none; margin: 0 0 18px; padding: 0 !important; display: grid; gap: 14px; }
.ff-guides li { margin: 0 !important; }
.ff-guides li::marker { content: none; }
.ff-guide { display: flex; flex-direction: column; height: 100%; border-radius: var(--ff-radius); overflow: hidden; background: var(--ff-card); border: 1px solid var(--ff-line); text-decoration: none; color: var(--ff-text); }
.ff-guide:hover { border-color: var(--ff-gold); color: var(--ff-text); }
.ff-guide img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.ff-guide div { padding: 14px 16px 16px; }
.ff-guide b { display: block; color: #fff; font-size: 18px; line-height: 1.4; margin-bottom: 6px; }
.ff-guide small { display: block; font-size: 15px; color: var(--ff-muted); line-height: 1.55; }
@media (min-width: 720px) { .ff-guide { flex-direction: row; align-items: center; } .ff-guide img { width: 42%; flex: 0 0 42%; } }

/* ---------- turnover calculator (guide/bonus-turnover) ---------- */
.ff-calc { margin: 6px 0 18px; padding: 16px; background: var(--ff-card); border: 1px solid var(--ff-line); border-radius: var(--ff-radius); }
.ff-calc-grid { display: grid; gap: 12px; }
.ff-calc label { display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 600; color: #fff; }
.ff-calc input, .ff-calc select { font: inherit; font-size: 17px; min-height: 46px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--ff-line); background: var(--ff-bg-2); color: var(--ff-text); width: 100%; }
.ff-calc input:focus, .ff-calc select:focus { border-color: var(--ff-gold); outline: none; box-shadow: 0 0 0 3px rgba(245,179,1,.25); }
.ff-calc-out { display: block; margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: var(--ff-bg-2); border: 1px dashed var(--ff-gold); }
.ff-calc-out ul { margin: 0 0 10px; padding-left: 1.2em; }
.ff-calc-out li { margin: 0 0 4px; }
.ff-calc-out b { color: #fff; font-variant-numeric: tabular-nums; }
.ff-calc-out p { margin: 0; font-weight: 700; }
.ff-calc-ok { color: #6ee7b7; }
.ff-calc-bad { color: #fca5a5; }
.ff-calc .ff-note { margin: 12px 0 0; }
@media (min-width: 720px) { .ff-calc-grid { grid-template-columns: 1fr 1fr 1fr; } }
