/* Polysia — dark tech theme. No external fonts / images; CSP style-src 'self'.
   Text contrast on --bg / --card: fg 16.6, muted 9.0, dim 6.5, link 8.6, cyan 10.9 (WCAG AA ≥ 4.5).
   #8247E5 (Polygon purple) is used only for borders, glows and gradients — never for body text. */
:root {
  color-scheme: dark;
  --bg: #070b16;
  --bg2: #0a1020;
  --card: #111a33;
  --glass: rgba(17, 26, 51, .62);
  --line: rgba(148, 163, 214, .16);
  --fg: #e8ecf6;
  --muted: #a6b0c8;
  --dim: #8b95ad;
  --purple: #8247e5;
  --violet: #a78bfa;
  --link: #b69cff;
  --cyan: #22d3ee;
  --teal: #5eead4;
  --amber: #f0b429;
  --pink: #ff7a90;
  --grad: linear-gradient(110deg, #a78bfa 0%, #7dd3fc 55%, #22d3ee 100%);
  --grad-line: linear-gradient(90deg, rgba(130, 71, 229, .9), rgba(34, 211, 238, .9));
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", "Noto Sans Myanmar", "Myanmar Text", Padauk, Pyidaungsu, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Myanmar", "Myanmar Text", Padauk, Pyidaungsu, sans-serif;
  --radius: 16px;
  --glow: 0 0 0 1px rgba(167, 139, 250, .22), 0 10px 40px -12px rgba(130, 71, 229, .45);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; min-height: 100vh; color: var(--fg); font: 16px/1.65 var(--sans);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 500px at 85% -10%, rgba(130, 71, 229, .22), transparent 60%),
    radial-gradient(700px 420px at -10% 20%, rgba(34, 211, 238, .10), transparent 60%),
    radial-gradient(rgba(148, 163, 214, .11) 1px, transparent 1.2px);
  background-size: auto, auto, 24px 24px;
  background-attachment: scroll;
}
:lang(my) body, body:lang(my) { line-height: 1.9; }
:lang(my) h1, :lang(my) h2, :lang(my) h3 { line-height: 1.5; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: #d6c8ff; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }
::selection { background: rgba(130, 71, 229, .55); color: #fff; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--card); color: var(--fg); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 16px; }
.mono, code, kbd, pre { font-family: var(--mono); }

/* ---------------------------------------------------------------- header / footer */
header.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(7, 11, 22, .78); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.top-in { max-width: 1180px; margin: 0 auto; padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; font-weight: 700; font-size: 19px; letter-spacing: .2px; }
.brand svg { width: 28px; height: 28px; filter: drop-shadow(0 0 8px rgba(130, 71, 229, .7)); }
.brand small { font-weight: 500; color: var(--muted); font-size: 13px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; }
nav.main { display: flex; flex-wrap: wrap; gap: 4px 6px; }
nav.main a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 999px; transition: color .2s, background .2s; }
nav.main a:hover, nav.main a[aria-current="page"] { color: var(--fg); background: rgba(167, 139, 250, .12); }
nav.main a.lang { border: 1px solid var(--line); }
footer.foot { border-top: 1px solid var(--line); margin-top: 64px; }
.foot-in { max-width: 1180px; margin: 0 auto; padding: 28px 16px; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; color: var(--dim); font-size: 14px; }
.foot-in a { color: var(--muted); }

/* ---------------------------------------------------------------- shared pieces */
main.site { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.glass {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--glow);
}
.chip, article code, .doc code {
  display: inline-block; font-size: .86em; line-height: 1.45; padding: 1px 8px; border-radius: 7px;
  background: rgba(34, 211, 238, .07); border: 1px solid rgba(34, 211, 238, .22); color: #c9f4fb;
  overflow-wrap: anywhere; vertical-align: baseline;
}
.chip.p { background: rgba(167, 139, 250, .09); border-color: rgba(167, 139, 250, .3); color: #ddd3ff; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.button {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 12px;
  font-weight: 650; text-decoration: none; color: #070b16; background: var(--grad);
  box-shadow: 0 8px 30px -8px rgba(130, 71, 229, .8), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .2s, box-shadow .2s, filter .2s;
}
.button:hover { color: #070b16; transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 14px 40px -8px rgba(34, 211, 238, .6); }
.button.ghost { color: var(--fg); background: rgba(17, 26, 51, .6); border: 1px solid rgba(167, 139, 250, .45); box-shadow: none; }
.button.ghost:hover { color: #fff; border-color: var(--cyan); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 600 13px/1 var(--mono); letter-spacing: .4px; color: var(--teal); padding: 7px 12px; border-radius: 999px; border: 1px solid rgba(94, 234, 212, .3); background: rgba(94, 234, 212, .06); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 10px var(--teal); display: inline-block; }
.section-title { font-size: clamp(24px, 3.4vw, 34px); margin: 0 0 8px; line-height: 1.25; }
.section-sub { color: var(--muted); margin: 0 0 24px; max-width: 760px; }
section.block { margin: 72px 0; }

/* ---------------------------------------------------------------- hero */
.hero { position: relative; display: grid; grid-template-columns: 1.1fr .9fr; gap: 24px; align-items: center; padding: 56px 0 24px; }
.hero h1 { font-size: clamp(32px, 5.4vw, 58px); line-height: 1.08; letter-spacing: -.5px; margin: 18px 0; }
:lang(my) .hero h1 { font-size: clamp(26px, 4.2vw, 44px); line-height: 1.45; letter-spacing: 0; }
.hero .lead { font-size: 18px; color: var(--muted); max-width: 620px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 18px; }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.hero-art { position: relative; aspect-ratio: 4 / 3; }
.hero-art::before { content: ""; position: absolute; inset: 10% 8%; background: radial-gradient(closest-side, rgba(130, 71, 229, .35), transparent); filter: blur(10px); }
svg.net { position: relative; width: 100%; height: 100%; }
.net .ln { stroke-width: 1.1; opacity: .55; }
.net .ln.flow { stroke-width: 1.6; opacity: .95; stroke-dasharray: 3 9; }
.net .node { fill: #e9ddff; }
.net .node.c { fill: #b8f5ff; }
.net .halo { transform-box: fill-box; transform-origin: center; opacity: .8; }

/* ---------------------------------------------------------------- payment flow */
.flow-card { padding: 22px 22px 18px; margin-top: 18px; }
.flow-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.flow-head h2 { margin: 0; font-size: 20px; }
.flow-head .note { color: var(--dim); font-size: 13px; font-family: var(--mono); }
svg.flow { width: 100%; height: auto; display: block; }
svg.flow.v { display: none; max-width: 420px; margin: 0 auto; }
.flow .box { fill: #0e1630; stroke-width: 1.4; }
.flow .box.hot { fill: #0b1c26; }
.flow .box.fee { fill: #1a1430; }
.flow .bt { fill: var(--fg); font: 650 15.5px var(--sans); }
.flow .bs { fill: var(--muted); font: 13px var(--mono); }
.flow .bs.s { font-family: var(--sans); }
.flow .el { fill: var(--teal); font: 600 12px var(--mono); }
.flow .edge { fill: none; stroke: rgba(148, 163, 214, .28); stroke-width: 2; }
.flow .comet { fill: none; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 8 200; stroke-dashoffset: 8; }
.flow .ic { fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ticker { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.ticker li { display: inline-flex; align-items: center; gap: 8px; font: 13px var(--mono); color: var(--muted); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(10, 16, 32, .7); }
.ticker li b { color: var(--fg); font-weight: 600; }
.ticker .dot { width: 7px; height: 7px; }
.ticker li:nth-child(2) .dot { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.ticker li:nth-child(3) .dot { background: var(--violet); box-shadow: 0 0 10px var(--violet); }
.ticker li:nth-child(4) .dot { background: var(--amber); box-shadow: 0 0 10px var(--amber); }

/* ---------------------------------------------------------------- feature cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.card { padding: 22px; transition: transform .25s, box-shadow .25s, border-color .25s; }
.card:hover { transform: translateY(-4px); border-color: rgba(34, 211, 238, .45); box-shadow: 0 0 0 1px rgba(34, 211, 238, .25), 0 18px 50px -16px rgba(34, 211, 238, .45); }
.card h3 { margin: 12px 0 6px; font-size: 18px; }
.card p { margin: 0; color: var(--muted); }
.card .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: rgba(130, 71, 229, .16); border: 1px solid rgba(167, 139, 250, .35); }
.card .ico svg { width: 22px; height: 22px; fill: none; stroke: #d6c8ff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stat { font: 700 32px/1.1 var(--sans); }

/* ---------------------------------------------------------------- steps */
ol.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
ol.steps li { counter-increment: s; position: relative; padding: 22px 20px 20px; }
ol.steps li::before { content: counter(s, decimal-leading-zero); display: block; font: 700 14px var(--mono); color: var(--cyan); margin-bottom: 8px; letter-spacing: 1px; }
ol.steps li p { margin: 0; color: var(--muted); }
ol.steps li b { color: var(--fg); }

/* ---------------------------------------------------------------- fee tiers */
.fees { padding: 26px; }
.tiers { list-style: none; padding: 0; margin: 8px 0 18px; display: grid; gap: 12px; }
.tier { display: grid; grid-template-columns: minmax(150px, 220px) 1fr 64px; gap: 14px; align-items: center; }
.tier .range { font: 14px var(--mono); color: var(--muted); }
.tier .rate { font: 700 17px var(--mono); text-align: right; color: var(--fg); }
.bar { height: 12px; border-radius: 999px; background: rgba(148, 163, 214, .1); overflow: hidden; border: 1px solid var(--line); }
.bar span { display: block; height: 100%; border-radius: 999px; background: var(--grad-line); box-shadow: 0 0 14px rgba(130, 71, 229, .7); transform-origin: left; }
.w100 { width: 100%; } .w75 { width: 75%; } .w50 { width: 50%; } .w25 { width: 25%; } .w15 { width: 15%; }
.example { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 14px 16px; border-radius: 12px; background: rgba(7, 11, 22, .6); border: 1px dashed rgba(94, 234, 212, .35); font: 14px var(--mono); color: var(--muted); }
.example b { color: var(--teal); }
.small { font-size: 14px; color: var(--dim); }

/* ---------------------------------------------------------------- code blocks (site + docs) */
.code { position: relative; margin: 16px 0; border-radius: 12px; border: 1px solid var(--line); background: #0a1122; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03); }
.code .lang { position: absolute; top: 8px; left: 14px; font: 600 11px var(--mono); letter-spacing: .8px; text-transform: uppercase; color: var(--dim); }
.code pre { margin: 0; padding: 34px 16px 16px; overflow-x: auto; font-size: 14px; line-height: 1.6; color: #dbe2f3; tab-size: 4; }
.code pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; display: block; overflow-wrap: normal; white-space: pre; }
.copy { position: absolute; top: 6px; right: 8px; font: 600 12px var(--sans); color: var(--muted); background: rgba(17, 26, 51, .9); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; cursor: pointer; transition: color .2s, border-color .2s; }
.copy:hover { color: var(--fg); border-color: rgba(34, 211, 238, .5); }
.copy.ok { color: var(--teal); border-color: rgba(94, 234, 212, .6); }
.t-c { color: #8b95ad; font-style: italic; }
.t-s { color: #a5f3c4; }
.t-n { color: #fbbf77; }
.t-k { color: #c4b5fd; font-weight: 600; }
.t-p { color: #7dd3fc; }
.t-v { color: #f9a8d4; }
.t-f { color: #5eead4; }

/* ---------------------------------------------------------------- tables / callouts */
.scroll { overflow-x: auto; margin: 16px 0; border-radius: 12px; border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
th { background: rgba(130, 71, 229, .12); color: var(--fg); font-weight: 650; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, table tr:hover td { background: rgba(148, 163, 214, .04); }
blockquote.callout { margin: 18px 0; padding: 10px 18px; border-radius: 12px; border: 1px solid rgba(167, 139, 250, .35); background: rgba(130, 71, 229, .08); }
blockquote.callout.warning { border-color: rgba(240, 180, 41, .5); background: rgba(240, 180, 41, .07); }
blockquote.callout.warning::before { content: "⚠ Warning"; display: block; font: 700 13px var(--mono); color: var(--amber); margin-top: 6px; }

/* ---------------------------------------------------------------- docs layout */
.docs-wrap { max-width: 1340px; margin: 0 auto; padding: 0 16px; display: grid; grid-template-columns: 240px minmax(0, 1fr) 210px; gap: 40px; }
nav.side { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 88px); overflow-y: auto; padding: 24px 0; }
nav.side h2 { font: 700 12px var(--mono); letter-spacing: 1.2px; text-transform: uppercase; color: var(--dim); margin: 18px 0 6px; }
nav.side h2:first-child { margin-top: 0; }
nav.side a { display: block; padding: 6px 12px; margin: 1px 0; border-radius: 8px; color: var(--muted); text-decoration: none; border-left: 2px solid transparent; transition: color .15s, background .15s; }
nav.side a:hover { color: var(--fg); background: rgba(148, 163, 214, .07); }
nav.side a[aria-current="page"] { color: #fff; background: rgba(130, 71, 229, .18); border-left-color: var(--cyan); }
main.doc { min-width: 0; padding: 28px 0 0; }
main.doc article { max-width: 820px; }
main.doc h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.2; margin: 0 0 18px; }
main.doc h1 + p { font-size: 17px; color: var(--muted); }
main.doc h2 { margin-top: 44px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 24px; }
main.doc h3 { margin-top: 28px; font-size: 19px; }
main.doc h2 a.anchor, main.doc h3 a.anchor { color: var(--dim); text-decoration: none; margin-left: 8px; opacity: 0; transition: opacity .15s; }
main.doc h2:hover a.anchor, main.doc h3:hover a.anchor { opacity: 1; }
main.doc li { margin: 4px 0; }
aside.toc { position: sticky; top: 72px; align-self: start; padding: 28px 0; font-size: 14px; }
aside.toc h2 { font: 700 12px var(--mono); letter-spacing: 1.2px; text-transform: uppercase; color: var(--dim); margin: 0 0 8px; }
aside.toc a { display: block; color: var(--muted); text-decoration: none; padding: 4px 0 4px 12px; border-left: 1px solid var(--line); }
aside.toc a:hover { color: var(--fg); border-left-color: var(--cyan); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin: 48px 0 0; }
.pager a { flex: 1; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); text-decoration: none; color: var(--fg); background: var(--glass); transition: border-color .2s; }
.pager a:hover { border-color: rgba(34, 211, 238, .5); }
.pager a span { display: block; font-size: 12px; color: var(--dim); }
.pager a.next { text-align: right; }

/* ---------------------------------------------------------------- 404 */
.notfound { text-align: center; padding: 100px 0; }
.notfound .code404 { font: 800 96px/1 var(--mono); }

/* ---------------------------------------------------------------- motion (CSS only; off for reduced motion) */
@media (prefers-reduced-motion: no-preference) {
  .net .halo { animation: pulse 4.2s ease-in-out infinite; }
  .net .ln.flow { animation: dash 2.6s linear infinite; }
  .d1 { animation-delay: -.7s !important; } .d2 { animation-delay: -1.5s !important; }
  .d3 { animation-delay: -2.2s !important; } .d4 { animation-delay: -3s !important; }
  .flow .comet { animation: comet 3.2s cubic-bezier(.45, .05, .55, .95) infinite both; }
  .flow .comet.e2 { animation-delay: .8s; } .flow .comet.e3 { animation-delay: 1.6s; }
  .eyebrow .dot, .ticker .dot { animation: blink 2s ease-in-out infinite; }
  .ticker li:nth-child(2) .dot { animation-delay: .5s; } .ticker li:nth-child(3) .dot { animation-delay: 1s; } .ticker li:nth-child(4) .dot { animation-delay: 1.5s; }
  .hero-text > * { animation: fadein .7s ease-out both; }
  .hero-text > :nth-child(2) { animation-delay: .08s; } .hero-text > :nth-child(3) { animation-delay: .16s; }
  .hero-text > :nth-child(4) { animation-delay: .24s; } .hero-text > :nth-child(5) { animation-delay: .32s; }
  .bar span { animation: grow 1.2s cubic-bezier(.2, .8, .2, 1) both; }
  @supports (animation-timeline: view()) {
    .reveal { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% cover 22%; }
    .bar span { animation: grow linear both; animation-timeline: view(); animation-range: entry 10% cover 35%; }
  }
}
@keyframes pulse { 0%, 100% { transform: scale(.75); opacity: .35; } 50% { transform: scale(1.25); opacity: .95; } }
@keyframes dash { to { stroke-dashoffset: -24; } }
@keyframes comet { 0% { stroke-dashoffset: 8; } 45%, 100% { stroke-dashoffset: -100; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes rise { from { transform: translateY(22px) scale(.985); } to { transform: none; } }
@keyframes fadein { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
  .flow .comet { display: none; }
  .flow .edge { stroke: rgba(167, 139, 250, .6); }
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) { .docs-wrap { grid-template-columns: 220px minmax(0, 1fr); } aside.toc { display: none; } }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 36px; }
  .hero-art { order: -1; max-width: 460px; width: 100%; margin: 0 auto -20px; aspect-ratio: 16 / 10; }
}
@media (max-width: 760px) {
  svg.flow.h { display: none; } svg.flow.v { display: block; }
  .tier { grid-template-columns: 1fr 56px; gap: 6px 10px; }
  .tier .bar { grid-column: 1 / -1; grid-row: 2; }
  .docs-wrap { display: block; }
  nav.side { position: static; max-height: none; padding: 14px 0 0; display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 6px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
  nav.side h2 { display: none; }
  nav.side a { white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 14px; }
  nav.side a[aria-current="page"] { border-color: var(--cyan); }
  .code pre { font-size: 13px; }
  section.block { margin: 52px 0; }
  .fees, .flow-card { padding: 18px 14px; }
}

/* ---------------------------------------------------------------- small additions */
.bar { display: block; }
.hero.single { grid-template-columns: 1fr; padding-bottom: 0; }
.fees > p { color: var(--muted); }
.fees > p b, .fees > p a { color: var(--fg); }
.tier .bar { min-width: 0; }
@media (max-width: 520px) {
  .top-in { padding: 10px 16px; }
  nav.main a { padding: 4px 9px; font-size: 15px; }
  .brand small { display: none; }
}
