:root {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #6b7280;
  --surface: #f5f5f5;
  --border: #e5e7eb;
  --btn: #0a0a0a;
  --btn-fg: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --fg: #ffffff;
    --muted: #a3a3a3;
    --surface: #111111;
    --border: #1f2937;
    --btn: #ffffff;
    --btn-fg: #000000;
  }
}

/* Force variables for toggled themes to avoid disappearing elements */
.theme-dark {
  --bg: #000000 !important;
  --fg: #ffffff !important;
  --muted: #a3a3a3 !important;
  --surface: #111111 !important;
  --border: #1f2937 !important;
  --btn: #ffffff !important;
  --btn-fg: #000000 !important;
}
.theme-light {
  --bg: #ffffff !important;
  --fg: #0a0a0a !important;
  --muted: #6b7280 !important;
  --surface: #f5f5f5 !important;
  --border: #e5e7eb !important;
  --btn: #0a0a0a !important;
  --btn-fg: #ffffff !important;
}

* { box-sizing: border-box; }
html, body { height: 100%; transition: background-color 0.4s ease, color 0.4s ease; }
body {
  margin: 0;
  font-family: "Kanit", system-ui, -apple-system, Segoe UI, Roboto, Noto Sans Thai, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

.header { position: fixed; inset-inline: 0; top: 0; z-index: 50; backdrop-filter: saturate(180%) blur(6px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 76px; }
.brand { font-weight: 800; letter-spacing: 0.02em; font-size: 22px; }

nav { display: none; gap: 28px; align-items: center; }
nav a { color: var(--fg); text-decoration: none; font-weight: 600; opacity: .85; }
nav a:hover { opacity: 1; }

.right-actions { display:flex; gap:10px; align-items:center; }

.cta { display: inline-flex; align-items: center; gap: 10px; border-radius: 999px; padding: 10px 18px; background: var(--surface); color: var(--fg); border: 1px solid var(--border); font-weight: 700; text-decoration: none; }
.cta:hover { transform: translateY(-1px); filter: brightness(0.98); }

.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--fg); transition: transform .3s ease; }
.icon-btn:hover { transform: rotate(10deg); }
.icon-btn svg { display:block; }

.hero { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 120px 0 72px; }
.hero h1 { font-size: clamp(40px, 6vw, 84px); margin: 0 0 16px; font-weight: 900; letter-spacing: .02em; animation: fadeInUp 1s ease forwards; }
.lead { font-size: clamp(18px, 2vw, 28px); line-height: 1.35; color: var(--fg); opacity: .95; animation: fadeInUp 1.2s ease forwards; }

.actions { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 28px; flex-wrap: wrap; animation: fadeInUp 1.4s ease forwards; }
.btn-primary { background: var(--btn); color: var(--btn-fg); border: 1px solid var(--btn); padding: 14px 22px; border-radius: 999px; font-weight: 800; text-decoration: none; transition: transform .25s ease, filter .25s ease; }
.btn-primary:hover { filter: brightness(0.95); transform: translateY(-1px) scale(1.03); }
.btn-ghost { background: transparent; color: var(--fg); border: 2px solid var(--fg); padding: 12px 22px; border-radius: 999px; font-weight: 800; text-decoration: none; transition: transform .25s ease, opacity .25s ease; }
.btn-ghost:hover { opacity: .9; transform: translateY(-1px) scale(1.03); }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Preloader ===== */
#preloader {
  position: fixed;
  inset: 0;
  background: #0f1115; /* fixed dark like sample */
  display: grid;
  place-items: center;
  z-index: 9999;
  transition: opacity .6s ease, visibility .6s ease;
}
#preloader.hide { opacity: 0; visibility: hidden; }

.spinner { position: relative; width: 120px; height: 120px; }
.ring {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  border: 10px solid rgba(255,255,255,.16);
  border-right-color: #ffffff;
  animation: spin 1.1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.dots { position: absolute; inset: 0; list-style: none; margin: 0; padding: 0; }
.dots li {
  position: absolute;
  top: 50%; left: 50%;
  width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: #60f0c2;
  box-shadow: 0 0 10px rgba(96,240,194,.7);
}
/* place 5 dots around the circle and rotate container */
.dots li:nth-child(1) { transform: rotate(0deg) translate(34px); opacity:.95; }
.dots li:nth-child(2) { transform: rotate(36deg) translate(34px); opacity:.9; }
.dots li:nth-child(3) { transform: rotate(72deg) translate(34px); opacity:.8; }
.dots li:nth-child(4) { transform: rotate(108deg) translate(34px); opacity:.7; }
.dots li:nth-child(5) { transform: rotate(144deg) translate(34px); opacity:.6; }
.dots { animation: orbit 1.1s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }

@media (min-width: 720px) {
  nav { display: flex; }
}
