/*
 * SimonLive website styles.
 * Plain CSS: no build step, no web fonts, no external files.
 * Light and dark follow the visitor's system setting (prefers-color-scheme).
 * Language switching: html.lang-en hides [data-lang="th"], html.lang-th hides
 * [data-lang="en"]. Without JavaScript neither class is set and both show.
 */

/* ------------------------------------------------------------- tokens */

:root {
  color-scheme: light dark;
  /* Thai comes from Noto Sans Thai when installed, otherwise Leelawadee UI
     (Windows); Latin falls through to Leelawadee UI / the system font. */
  --font-sans: "Noto Sans Thai", "Leelawadee UI", system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;

  --bg: #ffffff;
  --bg-soft: #f6f4fb;
  --surface: #ffffff;
  --surface-2: #faf9fd;
  --text: #17151f;
  --muted: #4a4658;
  --border: #e4e0ee;
  --border-strong: #c9c2da;
  --accent: #6d28d9;
  --accent-hover: #5b21b6;
  --on-accent: #ffffff;
  --link: #5b21b6;
  --focus: #b5179e;
  --badge-bg: #efe9ff;
  --badge-text: #4c1d95;
  --ok-bg: #e5f6ec;
  --ok-text: #0b5a35;
  --ok-border: #8fd3ae;
  --warn-bg: #fff4d1;
  --warn-text: #3f2e00;
  --warn-border: #d9a520;
  --error-bg: #fdecec;
  --error-text: #8a1c1c;
  --error-border: #f1a3a3;
  --ph-bg: #fff0a3;
  --ph-text: #2e2500;
  --review-bg: #ffe3ec;
  --review-text: #7a0f35;
  --shadow: 0 1px 2px rgba(23, 21, 31, 0.05), 0 8px 24px rgba(23, 21, 31, 0.06);
  --brand-gradient: linear-gradient(120deg, #ff5f8f 0%, #d946ef 50%, #7c3aed 100%);
  --step-gradient: linear-gradient(135deg, #be185d 0%, #7e22ce 60%, #5b21b6 100%);
  --hero-glow-1: rgba(217, 70, 239, 0.14);
  --hero-glow-2: rgba(124, 58, 237, 0.12);
  --checker-a: #ffffff;
  --checker-b: #1f1b2b;
  --radius: 14px;
  --radius-sm: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0c14;
    --bg-soft: #15121e;
    --surface: #1a1724;
    --surface-2: #1e1a2a;
    --text: #f2f0f7;
    --muted: #bdb6cf;
    --border: #2e2940;
    --border-strong: #4a4263;
    --accent: #a78bfa;
    --accent-hover: #c4b5fd;
    --on-accent: #160d29;
    --link: #c4b5fd;
    --focus: #f0abfc;
    --badge-bg: #2b2050;
    --badge-text: #ddd3ff;
    --ok-bg: #0f3324;
    --ok-text: #a7f3d0;
    --ok-border: #1f6b4a;
    --warn-bg: #3a2c05;
    --warn-text: #ffe9a8;
    --warn-border: #a37a0e;
    --error-bg: #3b1212;
    --error-text: #fecaca;
    --error-border: #8a2e2e;
    --ph-bg: #4d3f00;
    --ph-text: #fff3b5;
    --review-bg: #4a1328;
    --review-text: #ffc6d8;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 10px 28px rgba(0, 0, 0, 0.35);
    --hero-glow-1: rgba(217, 70, 239, 0.16);
    --hero-glow-2: rgba(124, 58, 237, 0.18);
  }
}

/* --------------------------------------------------------------- base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

[hidden] {
  display: none !important;
}

html.lang-en [data-lang="th"],
html.lang-th [data-lang="en"] {
  display: none !important;
}

html:not(.js) .lang-switch {
  display: none;
}

img,
svg {
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: var(--link);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

main:focus {
  outline: none;
}

h1,
h2,
h3 {
  margin: 0 0 0.5em;
  font-weight: 700;
  line-height: 1.3;
}

html.lang-th h1,
html.lang-th h2,
html.lang-th h3 {
  line-height: 1.45;
}

h1 {
  font-size: clamp(1.8rem, 1.25rem + 2.4vw, 2.8rem);
}

h2 {
  font-size: clamp(1.35rem, 1.15rem + 1vw, 1.8rem);
}

h3 {
  font-size: 1.125rem;
}

p,
ul,
ol,
dl {
  margin: 0 0 1em;
}

/* Keeps a Thai loanword that the browser's word breaker may split badly
   (the Thai word for "comment") on one line. */
.nw {
  white-space: nowrap;
}

ul,
ol {
  padding-left: 1.3em;
}

/* ------------------------------------------------------------- layout */

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

.narrow {
  max-width: 820px;
}

@media (min-width: 720px) {
  .wrap {
    padding-left: 24px;
    padding-right: 24px;
  }
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

/* ------------------------------------------------------------- header */

.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  padding-bottom: 6px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 22%;
}

.lang-switch {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
}

.lang-switch button {
  min-width: 44px;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.lang-switch button:hover {
  background: var(--bg-soft);
  color: var(--text);
}

html.lang-en .lang-switch [data-set-lang="en"],
html.lang-th .lang-switch [data-set-lang="th"] {
  background: var(--accent);
  color: var(--on-accent);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
  margin: 0 -10px;
  padding: 2px 0 10px;
  list-style: none;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  background: var(--badge-bg);
  color: var(--badge-text);
  font-weight: 700;
}

/* --------------------------------------------------------------- hero */

.hero {
  padding: 40px 0 36px;
  background:
    radial-gradient(900px 360px at 90% -10%, var(--hero-glow-1), transparent 65%),
    radial-gradient(700px 320px at -10% 0%, var(--hero-glow-2), transparent 65%);
}

.hero-grid {
  display: grid;
  gap: 28px;
  align-items: center;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 14px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.875rem;
  font-weight: 600;
}

.lead {
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.125rem;
}

.hero-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.hero-art {
  display: flex;
  justify-content: center;
}

.race-art {
  display: block;
  width: 100%;
  max-width: 460px;
  height: auto;
  filter: drop-shadow(0 18px 36px rgba(76, 29, 149, 0.16));
}

.art-card {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 1.5;
}

.art-dot {
  fill: var(--border-strong);
}

.art-line {
  fill: var(--border);
}

.art-track {
  fill: var(--bg-soft);
  stroke: var(--border);
  stroke-width: 1.5;
}

.art-lane {
  stroke: var(--border-strong);
  stroke-width: 2;
  stroke-dasharray: 6 10;
  stroke-linecap: round;
}

.art-check-a {
  fill: var(--checker-a);
}

.art-check-b {
  fill: var(--checker-b);
}

.art-speed {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 3;
  stroke-linecap: round;
}

.art-chat {
  fill: var(--surface-2);
  stroke: var(--border);
  stroke-width: 1.5;
}

.art-bubble {
  fill: var(--bg-soft);
  stroke: var(--border);
}

.art-text {
  fill: var(--border-strong);
}

.art-join {
  fill: none;
  stroke: #d946ef;
  stroke-width: 2.5;
  stroke-dasharray: 2 7;
  stroke-linecap: round;
}

@media (min-width: 900px) {
  .hero {
    padding: 64px 0 56px;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 48px;
  }
}

/* ------------------------------------------------------------ buttons */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 22px 0 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

/* ----------------------------------------------------------- sections */

.section {
  padding: 44px 0;
}

.section-tight {
  padding-top: 16px;
}

.section-alt {
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* A grey section at the end of a page meets the (grey) footer directly:
   the negative margin cancels the footer's top margin. */
main > .section-alt:last-child {
  margin-bottom: -48px;
  border-bottom: 0;
}

.section-head {
  max-width: 720px;
  margin-bottom: 24px;
}

.section-head p {
  color: var(--muted);
}

.section-head > :last-child {
  margin-bottom: 0;
}

.page-head {
  padding: 36px 0 4px;
}

.page-head .lead {
  margin-bottom: 0.5em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 16px;
}

.card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card h3 {
  margin-bottom: 0.35em;
}

.card p {
  color: var(--muted);
}

.card > :last-child {
  margin-bottom: 0;
}

.grid + p {
  margin-top: 16px;
}

.card-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--badge-bg);
  color: var(--badge-text);
}

.card-icon svg {
  width: 22px;
  height: 22px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps > li {
  position: relative;
  padding: 18px 18px 18px 66px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  counter-increment: step;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  top: 18px;
  left: 18px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--step-gradient);
  color: #ffffff;
  font-weight: 700;
}

.steps h3 {
  margin-bottom: 0.25em;
  font-size: 1.05rem;
}

.steps p {
  margin: 0;
  color: var(--muted);
}

@media (min-width: 560px) {
  .steps-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.not-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.not-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.not-list-stack {
  grid-template-columns: minmax(0, 1fr);
}

.not-list svg {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  color: var(--error-text);
}

.check-list {
  display: grid;
  gap: 10px;
  margin: 0 0 1em;
  padding: 0;
  list-style: none;
}

.check-list li {
  position: relative;
  padding-left: 34px;
}

.check-list li::before {
  content: "";
  position: absolute;
  top: 0.2em;
  left: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--badge-bg);
}

.check-list li::after {
  content: "";
  position: absolute;
  top: calc(0.2em + 5px);
  left: 8px;
  width: 6px;
  height: 11px;
  border: solid var(--badge-text);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

/* ------------------------------------------------------------ pricing */

.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 18px;
  margin-bottom: 20px;
}

.plan {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.plan-featured {
  border: 2px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--brand-gradient) border-box;
}

.plan h2,
.plan h3 {
  margin: 0;
  font-size: 1.3rem;
}

.plan-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.8rem;
  font-weight: 700;
}

.badge-estimate {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.badge-live {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.price {
  margin: 8px 0 0;
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.2;
}

.price .per {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
}

.price-where {
  margin: 0;
  color: var(--muted);
}

.price-secondary {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.plan-billing {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.breakdown {
  margin: 10px 0 0;
}

.breakdown > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--border);
}

.breakdown dt {
  color: var(--muted);
}

.breakdown dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.price-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
  padding: 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ------------------------------------------------------ notes & boxes */

.note,
.summary-box {
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.note > :last-child,
.summary-box > :last-child,
.mor > :last-child {
  margin-bottom: 0;
}

.mor {
  margin: 0 0 1em;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
}

.mor p {
  margin-bottom: 0.6em;
}

.mor-label {
  margin-bottom: 0.3em;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fine {
  color: var(--muted);
  font-size: 0.95rem;
}

.status-card {
  margin-bottom: 24px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.status-card > div > :last-child {
  margin-bottom: 0;
}

.status-ok {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok-text);
}

.status-ok > :last-child {
  margin-bottom: 0;
}

.status-title {
  margin-bottom: 0.5em;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.45;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0.6em;
}

.status-row .status-title {
  margin: 0;
}

.spinner {
  flex: none;
  width: 22px;
  height: 22px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 3s;
  }
}

/* -------------------------------------------------------- legal pages */

.draft-banner {
  margin: 28px 0 8px;
  padding: 16px 18px;
  background: var(--warn-bg);
  border: 2px solid var(--warn-border);
  border-radius: var(--radius-sm);
  color: var(--warn-text);
}

.draft-banner p {
  margin: 0;
}

.draft-banner p + p {
  margin-top: 0.6em;
}

.prose {
  max-width: 760px;
  padding-top: 12px;
}

.prose h1 {
  margin-top: 0.6em;
}

.prose h2 {
  margin-top: 1.9em;
  font-size: 1.3rem;
}

.prose h3 {
  margin-top: 1.4em;
}

.prose li {
  margin-bottom: 0.45em;
}

.meta {
  color: var(--muted);
}

.ph {
  padding: 0 0.25em;
  border-radius: 4px;
  background: var(--ph-bg);
  color: var(--ph-text);
  font-weight: 600;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.review {
  padding: 0 0.3em;
  border-radius: 4px;
  background: var(--review-bg);
  color: var(--review-text);
  font-size: 0.92em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ------------------------------------------------------ support & faq */

.contact-list {
  display: grid;
  gap: 10px;
  margin: 0 0 1em;
}

.card > .contact-list:last-child {
  margin-bottom: 0;
}

.contact-list > div {
  display: grid;
  grid-template-columns: minmax(84px, max-content) minmax(0, 1fr);
  gap: 4px 16px;
}

.contact-list dt {
  color: var(--muted);
  font-weight: 600;
}

.contact-list dd {
  margin: 0;
}

.faq details {
  max-width: 820px;
  margin-bottom: 10px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.faq summary {
  padding: 14px 0;
  font-weight: 600;
  cursor: pointer;
}

.faq details[open] summary {
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.faq details > :last-child {
  margin-bottom: 14px;
}

/* ------------------------------------------------------------- footer */

.site-footer {
  margin-top: 48px;
  padding: 32px 0 40px;
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.925rem;
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 16px;
}

.brand-small {
  font-size: 1rem;
}

.brand-small img {
  width: 28px;
  height: 28px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  color: var(--text);
}

.site-footer p {
  margin: 0 0 10px;
}

.disclaimer {
  margin: 16px 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.site-footer .disclaimer p {
  margin: 0;
  color: var(--text);
}

.site-footer .disclaimer p + p {
  margin-top: 6px;
}

.copyright {
  font-size: 0.875rem;
}

/* -------------------------------------------------------------- print */

@media print {
  .skip-link,
  .lang-switch,
  .site-nav,
  .hero-art {
    display: none !important;
  }

  body {
    background: #ffffff;
    color: #000000;
  }
}
