/* Bunchee — website styles. Mirrors the app's design tokens (src/constants/colors.ts). */
:root {
  --primary: #10b981;
  --primary-dark: #059669;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #243049;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: #334155;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 16px;
  --maxw: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Sukhumvit Set",
    "Noto Sans Thai", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* ---------- Animated background ---------- */
/* canvas lives inside the hero only and is clipped to it */
#bg-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}
.hero::before { z-index: 1; }          /* central glow above the squares */
.hero .container { position: relative; z-index: 2; }  /* content above both */

/* ---------- Section dividers ---------- */
.divider {
  position: relative; z-index: 1;
  height: 2px; max-width: calc(var(--maxw) - 48px);
  margin: 4px auto; border-radius: 2px;
  background: linear-gradient(90deg, transparent, currentColor, transparent);
  opacity: 0.55;
}
.divider::before {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 9px; height: 9px; border-radius: 2px; background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
  box-shadow: 0 0 14px currentColor;
}
.divider-mint   { color: #10b981; }
.divider-blue   { color: #3b82f6; }
.divider-amber  { color: #f59e0b; }
.divider-purple { color: #8b5cf6; }
.divider-pink   { color: #ec4899; }

@media (prefers-reduced-motion: reduce) {
  #bg-canvas { display: none; }
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 17px;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- i18n visibility (legacy bilingual blocks on legal pages) ---------- */
[data-lang] { display: none; }
[data-lang].i18n-show { display: revert; }
/* no-JS fallback: show th/en by the html lang attribute */
html[lang="th"] [data-lang="th"],
html[lang="en"] [data-lang="en"] { display: revert; }

/* ---------- Icons ---------- */
.icon {
  width: 1em; height: 1em; display: inline-block; vertical-align: -0.125em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.brand .wordmark { font-style: italic; letter-spacing: -0.2px; }
.nav { display: flex; align-items: center; gap: 8px; }
.nav a { color: var(--muted); font-size: 15px; padding: 8px 12px; border-radius: 10px; }
.nav a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.lang-btn {
  cursor: pointer; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: 999px; padding: 7px 14px; font-size: 14px;
  font-weight: 600; font-family: var(--font);
}
.lang-btn:hover { border-color: var(--primary); }
.lang-select {
  cursor: pointer; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: 999px; padding: 7px 30px 7px 14px; font-size: 14px;
  font-weight: 600; font-family: var(--font); -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.lang-select:hover { border-color: var(--primary); }
.lang-select option { color: #0f172a; background: #fff; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  background: var(--primary); color: #04221a; font-weight: 700; font-size: 16px;
  padding: 13px 22px; border-radius: 999px; border: none; cursor: pointer;
  font-family: var(--font); transition: transform .12s ease, background .12s ease;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; transform: translateY(-1px); }
.btn-ghost {
  background: transparent; color: var(--text); border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface); border-color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

/* ---------- Hero ---------- */
.hero {
  position: relative; padding: 88px 0 72px; text-align: center; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: -40% 0 auto 0; height: 600px;
  background: radial-gradient(ellipse at 50% 0%, rgba(16,185,129,0.22), transparent 60%);
  pointer-events: none;
}
.hero .icon-badge {
  width: 96px; height: 96px; border-radius: 24px; margin: 0 auto 24px;
  box-shadow: 0 12px 40px rgba(16,185,129,0.25); display: block;
}
.hero h1 { font-size: clamp(36px, 6vw, 60px); line-height: 1.05; letter-spacing: -1px; margin-bottom: 18px; }
.hero h1 .accent { color: var(--primary); font-style: italic; }
.hero .sub { color: var(--muted); font-size: clamp(17px, 2.4vw, 21px); max-width: 620px; margin: 0 auto 36px; }
.hero .cta-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.store-badges { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.store-badge {
  display: inline-flex; align-items: center; gap: 10px; background: #000;
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 18px; color: #fff;
  min-width: 180px;
}
.store-badge:hover { text-decoration: none; border-color: var(--primary); }
.store-badge svg { width: 26px; height: 26px; flex-shrink: 0; }
.store-badge .sb-top { font-size: 11px; color: var(--muted); line-height: 1.1; }
.store-badge .sb-main { font-size: 18px; font-weight: 600; line-height: 1.2; }

/* ---------- Sections ---------- */
section { padding: 64px 0; }
.section-title { font-size: clamp(26px, 4vw, 36px); text-align: center; margin-bottom: 12px; letter-spacing: -0.5px; }
.section-sub { color: var(--muted); text-align: center; max-width: 560px; margin: 0 auto 48px; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 24px;
}
.feature .ico {
  width: 48px; height: 48px; border-radius: 12px; background: rgba(16,185,129,0.14);
  display: flex; align-items: center; justify-content: center; font-size: 26px; margin-bottom: 16px;
  color: var(--primary);
}
.feature h3 { font-size: 19px; margin-bottom: 8px; }
.feature p { color: var(--muted); font-size: 15px; }

/* ---------- AI showcase ---------- */
.ai-showcase { background:
  radial-gradient(ellipse at 80% 0%, rgba(16,185,129,0.10), transparent 55%); }
.ai-split { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
.ai-copy .eyebrow {
  display: inline-block; color: var(--primary); font-weight: 700; font-size: 13px;
  letter-spacing: 1px; text-transform: uppercase; margin-bottom: 14px;
}
.ai-copy h2 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.5px; margin-bottom: 14px; line-height: 1.1; }
.ai-copy > p { color: var(--muted); font-size: 18px; margin-bottom: 28px; }
.steps { list-style: none; padding: 0; margin: 0 0 28px; }
.steps li { display: flex; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.steps li:last-child { border-bottom: none; }
.steps .n {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 999px;
  background: rgba(16,185,129,0.15); color: var(--primary); font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.steps .st-title { font-weight: 700; font-size: 17px; margin-bottom: 2px; }
.steps .st-desc { color: var(--muted); font-size: 15px; }
.ai-tags { display: flex; flex-wrap: wrap; gap: 10px; }
.ai-tag {
  display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px;
}
.ai-tag b { color: var(--primary); font-weight: 700; font-size: 17px; display: inline-flex; }

/* Phone mockup */
.phone-wrap { display: flex; justify-content: center; }
.phone {
  width: 320px; max-width: 100%; background: var(--bg); border: 10px solid #0a1120;
  border-radius: 44px; box-shadow: 0 30px 80px rgba(0,0,0,0.55), 0 0 0 1px var(--border);
  overflow: hidden; position: relative;
}
.phone .notch {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 130px; height: 26px; background: #0a1120; border-radius: 0 0 16px 16px; z-index: 3;
}
.phone-screen { padding: 40px 14px 18px; }
.mock-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.mock-head .badge {
  width: 30px; height: 30px; border-radius: 9px; background: rgba(16,185,129,0.13);
  display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--primary);
}
.mock-head .ttl { font-weight: 700; font-size: 15px; }
.mock-date {
  display: flex; align-items: center; gap: 10px; background: rgba(16,185,129,0.10);
  border: 1px solid rgba(16,185,129,0.30); border-radius: 14px; padding: 10px 12px; margin-bottom: 12px;
}
.mock-date .di { width: 38px; height: 38px; border-radius: 19px; background: rgba(16,185,129,0.16);
  display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--primary); }
.mock-date .dl { font-size: 9px; letter-spacing: 1px; text-transform: uppercase; color: var(--primary); font-weight: 700; }
.mock-date .dv { font-size: 17px; font-weight: 800; }
.mock-group { border: 1px solid var(--border); border-radius: 13px; overflow: hidden; margin-bottom: 12px; }
.mock-ghead { display: flex; align-items: center; gap: 9px; padding: 10px 11px; background: var(--surface); }
.mock-ico { width: 32px; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.mock-ghead .gname { font-weight: 700; font-size: 14px; flex: 1; }
.mock-ghead .gtot { font-weight: 700; font-size: 13px; }
.mock-check { width: 19px; height: 19px; border-radius: 6px; background: var(--primary); display: flex; align-items: center; justify-content: center; color: #04221a; font-size: 12px; font-weight: 900; }
.mock-row { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-top: 1px solid var(--border); }
.mock-row .rname { flex: 1; font-size: 13px; color: var(--text); }
.mock-row .ramt { font-size: 13px; font-weight: 700; }
.mock-save { background: var(--primary); color: #04221a; font-weight: 800; text-align: center; border-radius: 13px; padding: 13px; font-size: 14px; }

@media (max-width: 820px) {
  .ai-split { grid-template-columns: 1fr; gap: 40px; }
  .ai-copy { order: 1; }
  .phone-wrap { order: 2; }
}

/* ---------- BYOD / import ---------- */
.byod { background: radial-gradient(ellipse at 15% 0%, rgba(16,185,129,0.09), transparent 55%); }
.byod .ai-copy .eyebrow .pill-byod {
  background: var(--primary); color: #04221a; border-radius: 6px; padding: 2px 8px; margin-right: 8px; letter-spacing: 0;
}
/* Spreadsheet mock */
.sheet-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.4);
}
.sheet-file { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.sheet-file .xls { width: 30px; height: 30px; border-radius: 8px; background: rgba(16,185,129,0.16); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; }
.sheet { width: 100%; border-collapse: collapse; font-size: 13px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.sheet th { background: var(--bg); padding: 0; }
.sheet th .col-tag {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.sheet th .col-orig { color: var(--muted); font-weight: 600; font-size: 12px; }
.sheet th .col-ai { color: var(--primary); font-size: 10px; font-weight: 700; display: flex; align-items: center; gap: 3px; }
.sheet td { padding: 8px 10px; color: var(--text); border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); }
.sheet tr:last-child td { border-bottom: none; }
.sheet td:first-child { border-left: none; }
.sheet .num { color: var(--muted); }
.sheet-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-size: 13px; }
.sheet-foot .imported { color: var(--primary); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.sheet-foot .arrow-into { color: var(--muted); }

/* ---------- Languages band ---------- */
.lang-band { text-align: center; }
.lang-band .big-num { font-size: clamp(44px, 8vw, 72px); font-weight: 800; color: var(--primary); line-height: 1; letter-spacing: -2px; }
.lang-pills { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 760px; margin: 32px auto 0; }
.lang-pill {
  display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 9px 16px;
}
.lang-pill .flag { font-size: 18px; line-height: 1; }
.lang-pill.more { color: var(--primary); border-color: var(--primary); font-weight: 700; }

/* ---------- Feature request band ---------- */
.request-band {
  background: linear-gradient(135deg, rgba(16,185,129,0.10), rgba(30,41,59,0.6));
  border: 1px solid rgba(16,185,129,0.35); border-radius: 24px; padding: 44px 32px; text-align: center;
}
.request-band .ico-big { font-size: 40px; margin-bottom: 14px; color: var(--primary); line-height: 0; }
.request-band h2 { font-size: clamp(24px, 4vw, 32px); margin-bottom: 12px; }
.request-band p { color: var(--muted); max-width: 540px; margin: 0 auto 26px; }

/* ---------- Feature-request form ---------- */
.req-form { max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.req-input {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 15px; color: var(--text); font-size: 15px; font-family: var(--font);
}
.req-input:focus { outline: none; border-color: var(--primary); }
.req-input::placeholder { color: var(--muted); }
.req-textarea { resize: vertical; min-height: 84px; }
.req-honey { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.req-form .btn { margin-top: 2px; }
.req-status { text-align: center; font-size: 14px; min-height: 18px; margin: 0; }
.req-status.ok { color: var(--primary); font-weight: 600; }
.req-status.err { color: var(--danger); }
.req-form.sent .req-input,
.req-form.sent button { display: none; }

/* ---------- CTA band ---------- */
.cta-band {
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border); border-radius: 24px; padding: 48px 32px; text-align: center;
}
.cta-band h2 { font-size: clamp(24px, 4vw, 34px); margin-bottom: 12px; }
.cta-band p { color: var(--muted); margin-bottom: 28px; }

/* ---------- Legal / doc pages ---------- */
.doc { padding: 56px 0 80px; }
.doc .container { max-width: 800px; }
.doc h1 { font-size: clamp(30px, 5vw, 42px); margin-bottom: 8px; letter-spacing: -0.5px; }
.doc .updated { color: var(--muted); font-size: 14px; margin-bottom: 36px; }
.doc h2 { font-size: 22px; margin: 36px 0 12px; padding-top: 8px; }
.doc h3 { font-size: 18px; margin: 24px 0 8px; color: var(--text); }
.doc p, .doc li { color: #cbd5e1; margin-bottom: 12px; }
.doc ul, .doc ol { padding-left: 22px; margin-bottom: 16px; }
.doc li { margin-bottom: 8px; }
.doc strong { color: var(--text); }
.doc .lede { font-size: 18px; color: var(--muted); }
.callout {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--primary);
  border-radius: 12px; padding: 18px 20px; margin: 20px 0;
}
.callout.warn { border-left-color: var(--warning); }
.callout.danger { border-left-color: var(--danger); }
.data-table { width: 100%; border-collapse: collapse; margin: 16px 0 24px; font-size: 15px; }
.data-table th, .data-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table th { color: var(--text); font-weight: 700; background: var(--surface); }
.data-table td { color: var(--muted); }

/* ---------- Support form ---------- */
.support-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 16px; }
.support-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px;
}
.support-card h3 { font-size: 19px; margin-bottom: 8px; display: flex; align-items: center; gap: 9px; color: var(--primary); }
.support-card h3 span { color: var(--text); }
.support-card p { color: var(--muted); font-size: 15px; margin-bottom: 16px; }
.faq { border-top: 1px solid var(--border); }
.faq details { border-bottom: 1px solid var(--border); padding: 18px 0; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 17px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--primary); font-size: 22px; }
.faq details[open] summary::after { content: "\2013"; }
.faq p { color: var(--muted); margin-top: 12px; }

/* ---------- Coming-soon modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center; padding: 24px;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
}
.modal-overlay.open { display: flex; }
.modal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 22px; padding: 34px 28px; max-width: 380px; width: 100%;
  text-align: center; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  animation: modalIn 0.22s ease;
}
@keyframes modalIn {
  from { transform: translateY(10px) scale(0.97); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.modal-card .m-ico {
  width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 18px;
  background: rgba(16, 185, 129, 0.14); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 30px;
}
.modal-card h3 { font-size: 23px; margin-bottom: 10px; }
.modal-card p { color: var(--muted); font-size: 15px; margin-bottom: 24px; line-height: 1.6; }
.modal-card .btn { width: 100%; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0; margin-top: 40px; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center; }
.site-footer .f-links { display: flex; flex-wrap: wrap; gap: 18px; }
.site-footer .f-links a { color: var(--muted); font-size: 14px; }
.site-footer .f-links a:hover { color: var(--text); }
.site-footer .copy { color: var(--muted); font-size: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .features { grid-template-columns: 1fr; }
  .support-grid { grid-template-columns: 1fr; }
  .nav a:not(.lang-btn):not(.btn) { display: none; }
}
