/* ==========================================================================
   Shared site layer — tokens, base, header, cards, tables, footer.
   Used by BOTH the app (src/main.ts imports it) and the static guide pages
   (scripts/build-guides.mjs concatenates it into public/guides.css).
   Rules: ../../Skills/frontend-design-system/SKILL.md
   ========================================================================== */

:root {
  /* neutrals — cool grey, tool-like */
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fbfcfd;
  --border: #e3e6ea;
  --border-strong: #cdd3da;
  --text: #0f1720;
  --text-2: #5a6672;
  --text-3: #8a95a1;

  /* brand + semantics */
  --brand: #0e6e63;
  --brand-ink: #0a544c;
  --brand-soft: #e6f2f0;
  --pos: #0f7a4a;
  --pos-soft: #e7f5ee;
  --neg: #b3261e;
  --neg-soft: #fdeceb;
  --warn: #8a5a00;
  --warn-soft: #fdf3e0;
  --info: #0b5cad;
  --info-soft: #e8f0fa;

  /* platforms — identification only */
  --shopee: #ee4d2d;
  --tiktok: #111827;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);

  --ff: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ff-num: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ff);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }
a { color: var(--brand-ink); }
h1, h2, h3 { line-height: 1.3; margin: 0; }
.num { font-variant-numeric: tabular-nums; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 58px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 650; color: var(--text); text-decoration: none; font-size: 15px; letter-spacing: -.01em; }
.brand .mark {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  background: linear-gradient(150deg, var(--brand), var(--brand-ink));
  position: relative;
}
.brand .mark::after {
  content: ""; position: absolute; inset: 6px 6px auto 6px; height: 2px; border-radius: 2px;
  background: #fff; box-shadow: 0 4px 0 rgba(255,255,255,.75), 0 8px 0 rgba(255,255,255,.45);
}
.site-header nav { display: flex; gap: 4px; }
.site-header nav a {
  color: var(--text-2); text-decoration: none; font-size: 14px;
  padding: 6px 10px; border-radius: var(--r-sm);
}
.site-header nav a:hover { color: var(--text); background: var(--surface-2); }
.site-header nav a[aria-current] { color: var(--brand-ink); background: var(--brand-soft); font-weight: 600; }

/* ---------- page head ---------- */
.page { padding: 28px 0 8px; }
.page-title { font-size: 28px; letter-spacing: -.02em; }
.page-sub { color: var(--text-2); margin: 8px 0 0; max-width: 68ch; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-2);
  border: 1px solid var(--border); background: var(--surface);
  padding: 3px 10px; border-radius: 999px;
}
.chip b { color: var(--text); font-weight: 600; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--pos); flex: none; }

/* ---------- cards, notes, badges ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; }
.card-head h2 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.note {
  display: flex; gap: 10px; font-size: 13px; line-height: 1.5;
  padding: 9px 12px; border-radius: var(--r-sm);
  background: var(--brand-soft); color: var(--text-2);
  border-left: 3px solid var(--brand);
}
.note--warn { background: var(--warn-soft); border-left-color: var(--warn); }
.note--info { background: var(--info-soft); border-left-color: var(--info); }
.badge {
  display: inline-block; font-size: 12px; font-weight: 650;
  padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.badge--pos { background: var(--pos-soft); color: var(--pos); border-color: color-mix(in srgb, var(--pos) 25%, transparent); }
.badge--neg { background: var(--neg-soft); color: var(--neg); border-color: color-mix(in srgb, var(--neg) 25%, transparent); }
.badge--warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }

/* ---------- tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); font-weight: 650; padding: 0 0 7px; border-bottom: 1px solid var(--border);
}
.tbl th:last-child, .tbl td:last-child { text-align: right; white-space: nowrap; }
.tbl td { padding: 9px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl td.amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.tbl .fee-name { font-weight: 550; }
.tbl .fee-note { display: block; font-size: 12.5px; color: var(--text-3); font-weight: 400; margin-top: 1px; }
.tbl tr.waived td { color: var(--text-3); }
.tbl tr.waived td.amount { font-weight: 400; }
.tbl tr.sum td { border-bottom: 0; padding: 8px 0; color: var(--text-2); font-size: 13.5px; }
.tbl tr.net td { border-bottom: 0; border-top: 2px solid var(--text); padding-top: 10px; font-weight: 700; font-size: 15px; }

/* ---------- content sections ---------- */
.section { padding: 34px 0 6px; }
.section > h2 { font-size: 20px; letter-spacing: -.015em; margin-bottom: 6px; }
.section > p { color: var(--text-2); margin: 6px 0 0; max-width: 68ch; }
.layers { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 16px; }
.layer { border: 1px solid var(--border); border-radius: var(--r); padding: 14px; background: var(--surface); }
.layer h3 { font-size: 14px; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.layer .n { font-size: 11px; font-weight: 700; color: var(--brand-ink); background: var(--brand-soft); border-radius: 4px; padding: 1px 6px; }
.layer p { margin: 0; font-size: 13.5px; color: var(--text-2); }
.layer .rate { display: inline-block; margin-top: 8px; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-3); }

/* ---------- footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: 40px; padding: 8px 0 48px; }
.faq h2 { font-size: 18px; margin: 28px 0 6px; letter-spacing: -.015em; }
.faq details { border-bottom: 1px solid var(--border); padding: 12px 0; }
.faq details:last-of-type { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 14.5px; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--text-3); font-weight: 400; }
.faq details[open] summary::after { content: "–"; }
.faq p { color: var(--text-2); font-size: 13.5px; margin: 8px 0 0; max-width: 76ch; }
.rates-meta { font-size: 13px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px; }
.rates-meta b { font-weight: 600; }
.sources { font-size: 13px; padding-left: 18px; color: var(--text-2); }
.sources li { margin: 4px 0; }
.disclaimer { font-size: 12.5px; color: var(--text-3); margin-top: 16px; line-height: 1.6; }

/* ==========================================================================
   Article typography — for /guides/* pages (static HTML)
   ========================================================================== */
.article { max-width: 74ch; padding: 30px 0 10px; }
.article .crumb { font-size: 13px; color: var(--text-3); margin-bottom: 10px; }
.article .crumb a { color: var(--text-2); }
.article h1 { font-size: 27px; letter-spacing: -.02em; margin-bottom: 8px; }
.article .lede { color: var(--text-2); font-size: 15.5px; margin: 0 0 6px; }
.article h2 { font-size: 19px; margin: 30px 0 8px; letter-spacing: -.012em; }
.article h3 { font-size: 16px; margin: 22px 0 6px; }
.article p { margin: 10px 0; }
.article ul, .article ol { padding-left: 22px; margin: 10px 0; }
.article li { margin: 5px 0; }
.article strong { font-weight: 650; }
.article hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }
.article blockquote {
  margin: 16px 0; padding: 10px 14px; border-left: 3px solid var(--brand);
  background: var(--brand-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--text-2);
}
.article code {
  font-family: var(--ff-num); font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 1px 5px; border-radius: 4px;
}
/* markdown tables → scrollable, tabular figures */
.article table {
  width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 16px 0;
  display: block; overflow-x: auto; white-space: nowrap;
}
.article thead th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-3); font-weight: 650; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--border-strong);
}
.article tbody td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.article tbody tr:last-child td { border-bottom: 0; }
.article .cta {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin: 26px 0 6px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow);
}
.article .cta p { margin: 0; font-size: 14px; color: var(--text-2); max-width: 46ch; }
.article .cta .btn { width: auto; }
.article .verified { font-size: 12.5px; color: var(--text-3); margin-top: 18px; }
.article .related { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--border); }
.article .related h2 { font-size: 15px; margin: 0 0 8px; }
.article .related ul { margin: 0; padding-left: 18px; font-size: 14px; }

/* guides index */
.guide-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-top: 18px; }
.guide-card { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); padding: 14px; }
.guide-card a { text-decoration: none; color: var(--text); }
.guide-card h3 { font-size: 15px; margin-bottom: 6px; }
.guide-card p { margin: 0; font-size: 13.5px; color: var(--text-2); }
.guide-card .tag { display: inline-block; margin-top: 8px; font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media (max-width: 480px) {
  .wrap { padding: 0 14px; }
  .page-title { font-size: 24px; }
  .article h1 { font-size: 23px; }
}
