/* =========================================================
   Deay Bypass — effects & interactions
   ========================================================= */

section[id] { scroll-margin-top: 72px; }

/* ---------- Preloader ---------- */
.preloader {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity .6s ease, visibility .6s;
  animation: plFailsafe 0s 3.2s forwards;
}
.preloader.done { opacity: 0; visibility: hidden; }
.pl-inner { display: flex; flex-direction: column; align-items: center; }
.pl-logo { width: 58px; height: 58px; filter: drop-shadow(0 0 22px rgba(99, 102, 241, .55)); animation: plPulse 1.2s ease-in-out infinite; }
.pl-bar { width: 150px; height: 2px; margin-top: 24px; border-radius: 2px; overflow: hidden; background: rgba(255, 255, 255, .08); }
.pl-bar i { display: block; width: 100%; height: 100%; transform-origin: left; background: linear-gradient(90deg, var(--accent), #22d3ee); animation: plLoad .9s cubic-bezier(.6, 0, .2, 1) both; }
.is-loading .hero *, .is-loading .dl * { animation-play-state: paused !important; }

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed; left: 0; right: 0; top: 0; z-index: 60;
  height: 2px; transform: scaleX(0); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--accent), #22d3ee);
  box-shadow: 0 0 10px rgba(99, 102, 241, .7);
  pointer-events: none;
}

/* ---------- Cursor ring (เฉพาะเมาส์) ---------- */
.cursor-ring {
  position: fixed; left: 0; top: 0; z-index: 250;
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .35);
  pointer-events: none; opacity: 0;
  transition: width .25s, height .25s, margin .25s, background .25s, border-color .25s, opacity .3s, scale .15s;
}
.has-cursor .cursor-ring { opacity: 1; }
.cursor-ring.grow { width: 58px; height: 58px; margin: -29px 0 0 -29px; background: rgba(99, 102, 241, .12); border-color: rgba(129, 140, 248, .75); }
.cursor-ring.press { scale: .8; }

/* ---------- Grain texture ---------- */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Nav: sliding pill + active link ---------- */
.nav-pill {
  position: absolute; left: 0; top: 0; width: 0; height: 0;
  border-radius: 8px; background: rgba(255, 255, 255, .07);
  opacity: 0; pointer-events: none;
  transition: transform .35s cubic-bezier(.4, 0, .2, 1), width .35s cubic-bezier(.4, 0, .2, 1), opacity .25s;
}
.nav-pill.on { opacity: 1; }
.nav-pill.jump { transition: opacity .25s; }
.nav-links a { position: relative; z-index: 1; }
.nav-links a.active { color: #fff; }
.nav-links a.active::after {
  content: ""; position: absolute; left: 50%; bottom: 1px;
  width: 4px; height: 4px; margin-left: -2px; border-radius: 50%;
  background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2);
}
@media (min-width: 901px) {
  .nav-links a:hover { background: transparent; }
}
@media (max-width: 900px) {
  .nav-pill { display: none; }
}

/* ---------- Hero ---------- */
.hero > .container { z-index: 1; }
.hero-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 30%, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 55% at 50% 30%, #000 25%, transparent 75%);
}
.hero-glow {
  position: absolute; left: 0; top: 0;
  width: 720px; height: 720px; margin: -360px 0 0 -360px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(99, 102, 241, .2), transparent 62%);
  transform: translate(var(--gx, 50vw), var(--gy, 300px));
  opacity: 0;
  transition: transform .9s cubic-bezier(.2, .8, .2, 1), opacity .6s;
}
.hero:hover .hero-glow { opacity: 1; }

.hero-title {
  background-image:
    linear-gradient(110deg, transparent 38%, rgba(165, 180, 252, .95) 50%, transparent 62%),
    linear-gradient(180deg, #3f3f46 0%, #fff 52%, #fff 100%);
  background-size: 250% 100%, 100% 100%;
  background-repeat: no-repeat;
  background-position: 150% 0, 0 0;
  animation: rise .9s ease both, shimmer 6s 1.6s ease-in-out infinite;
}
.hero-type {
  min-height: 1.7em; margin-top: 12px;
  font-size: clamp(15px, 2vw, 17px); font-weight: 600;
  animation: rise .9s .15s ease both;
}
.ht-text { background: linear-gradient(90deg, #a5b4fc, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ht-caret { display: inline-block; width: 2px; height: 1.1em; margin-left: 3px; vertical-align: -.18em; background: #a5b4fc; animation: caretBlink 1s steps(1) infinite; }

.showcase {
  transform: rotateX(calc(var(--tilt, 20deg) + var(--mrx, 0deg))) rotateY(var(--mry, 0deg));
  transition: transform .3s ease-out;
}
.play::before {
  content: ""; position: absolute; inset: -1px; border-radius: 50%;
  border: 1px solid rgba(165, 180, 252, .6);
  animation: ping 2.2s cubic-bezier(0, 0, .2, 1) infinite;
}

/* magnetic buttons */
.hero-cta, .btn-signin { transition: background .2s, translate .35s cubic-bezier(.2, .8, .2, 1); }

/* ---------- Stats band ---------- */
.stats { padding: 40px 0 10px; }
.stats-grid {
  display: grid; grid-template-columns: repeat(var(--n, 4), 1fr);
  border: 1px solid var(--line); border-radius: 20px; overflow: hidden;
  background: linear-gradient(180deg, #111214, #0b0c0e);
}
.stat { position: relative; padding: 30px 20px; text-align: center; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat b {
  display: block; font-size: clamp(30px, 4vw, 42px); font-weight: 700; letter-spacing: -.02em; line-height: 1.2;
  background: linear-gradient(180deg, #fff, #9ca3af); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat > span { font-size: 14px; color: var(--muted); }
.ticker {
  margin-top: 26px; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.ticker-track { display: flex; width: max-content; animation: marquee 45s linear infinite reverse; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker span {
  display: inline-flex; align-items: center; gap: 8px; margin-right: 12px;
  padding: 8px 15px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--line); background: #101114;
  font-size: 13.5px; color: var(--text-2);
}
.ticker span i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }

/* seamless marquee: ใช้ margin แทน gap เพื่อให้วนต่อกันพอดี */
.marquee-track { gap: 0; }
.exe { margin-right: 56px; }

/* ---------- Section headings: word blur-in ---------- */
.section-head h2 .w { display: inline-block; opacity: 0; }
.section-head.in h2 .w { animation: wordIn .8s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 70ms + .1s); }
.section-icon { animation: floaty 4s ease-in-out infinite; }

/* ---------- Card spotlight + glowing border ---------- */
.fx-spot { position: relative; }
.fx-spot::before, .fx-spot::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none; opacity: 0; transition: opacity .35s;
}
.fx-spot::before { background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .06), transparent 45%); }
.fx-spot::after {
  padding: 1px;
  background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 50%), rgba(129, 140, 248, .9), transparent 45%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
.fx-spot:hover::before, .fx-spot:hover::after { opacity: 1; }

/* rotating border on the popular plan */
@property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
.plan-border {
  position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--angle), transparent 0 55%, #818cf8 72%, #22d3ee 82%, transparent 94%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: spinAngle 4s linear infinite;
}

/* ---------- Buttons: ripple ---------- */
.btn, .btn-signin, .billing-toggle button { position: relative; overflow: hidden; }
.billing-toggle button { z-index: 1; }
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: rgba(255, 255, 255, .35);
  transform: scale(0); animation: ripple .65s ease-out forwards;
}
.btn-signin .ripple, .btn-ghost .ripple { background: rgba(99, 102, 241, .3); }

/* ---------- Reviews: scrolling columns ---------- */
.reviews-wall {
  columns: auto;
  display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 16px;
  height: 720px; max-height: none;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 10%, #000 42%, transparent 74%);
  mask-image: linear-gradient(180deg, transparent, #000 10%, #000 42%, transparent 74%);
}
.wall-col { min-width: 0; overflow: hidden; }
.wall-track { animation: wallUp var(--dur, 40s) linear infinite; }
.wall-col[data-reverse] .wall-track { animation-direction: reverse; }
.reviews-wall:hover .wall-track { animation-play-state: paused; }
.wall-group { display: flex; flex-direction: column; gap: 16px; padding-bottom: 16px; }
.wall-group .review { margin: 0; }

/* ---------- Terminal caret ---------- */
.term::after { content: "▋"; color: var(--accent-2); animation: caretBlink 1s steps(1) infinite; }

/* ---------- FAQ search ---------- */
.faq-search {
  max-width: 780px; margin: 0 auto 18px;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  border-radius: 12px; background: #101114; border: 1px solid var(--line);
  cursor: text; transition: border-color .2s, box-shadow .2s;
}
.faq-search:focus-within { border-color: rgba(129, 140, 248, .6); box-shadow: 0 0 0 4px rgba(99, 102, 241, .15); }
.faq-search svg { width: 18px; height: 18px; flex: none; color: var(--dim); }
.faq-search input { flex: 1; min-width: 0; padding: 14px 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 15px; }
.faq-search input::placeholder { color: var(--dim); }
.faq-search input::-webkit-search-cancel-button { filter: invert(1); opacity: .5; }
.faq-search kbd { padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line-2); font-family: var(--mono); font-size: 12px; color: var(--muted); }
.faq-item[hidden] { display: none; }
.faq mark { padding: 0 2px; border-radius: 3px; background: rgba(99, 102, 241, .4); color: #fff; }
.faq-empty { margin-top: 20px; text-align: center; color: var(--muted); }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 45;
  width: 50px; height: 50px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(20, 21, 24, .9); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  opacity: 0; transform: translateY(16px) scale(.9); pointer-events: none;
  transition: opacity .3s, transform .3s, translate .35s cubic-bezier(.2, .8, .2, 1);
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.tt-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.tt-ring circle { fill: none; stroke-width: 2.5; }
.tt-track { stroke: rgba(255, 255, 255, .07); }
.tt-bar { stroke: var(--accent-2); stroke-linecap: round; }
.tt-arrow { width: 18px; height: 18px; transition: transform .2s; }
.to-top:hover .tt-arrow { transform: translateY(-3px); }

/* ---------- Floating notice + confetti + party ---------- */
.fx-notice {
  position: fixed; left: 50%; top: 84px; z-index: 160;
  max-width: calc(100vw - 32px); padding: 10px 18px; border-radius: 999px;
  background: rgba(20, 21, 24, .94); border: 1px solid rgba(129, 140, 248, .5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 0 30px rgba(99, 102, 241, .3);
  font-size: 14px; font-weight: 600; text-align: center;
  opacity: 0; transform: translate(-50%, -10px); pointer-events: none;
  transition: opacity .35s, transform .35s;
}
.fx-notice.show { opacity: 1; transform: translate(-50%, 0); }
.confetti-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 150; pointer-events: none; }
.party main { animation: partyHue 1.4s linear infinite; }

/* ---------- Keyframes ---------- */
@keyframes plPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.9); opacity: .7; } }
@keyframes plLoad { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes plFailsafe { to { opacity: 0; visibility: hidden; } }
@keyframes shimmer { 0% { background-position: 150% 0, 0 0; } 35%, 100% { background-position: -60% 0, 0 0; } }
@keyframes caretBlink { 50% { opacity: 0; } }
@keyframes ping { 0% { transform: scale(1); opacity: .8; } 80%, 100% { transform: scale(1.6); opacity: 0; } }
@keyframes wordIn { from { opacity: 0; filter: blur(10px); transform: translateY(14px); } to { opacity: 1; filter: blur(0); transform: none; } }
@keyframes floaty { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
@keyframes spinAngle { to { --angle: 360deg; } }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
@keyframes wallUp { to { transform: translateY(-50%); } }
@keyframes partyHue { to { filter: hue-rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stat { padding: 22px 12px; }
  .reviews-wall { height: 620px; }
}
@media (max-width: 600px) {
  .faq-search kbd { display: none; }
  .to-top { right: 10px; bottom: 10px; width: 44px; height: 44px; }
  .fx-notice { top: 76px; font-size: 13px; }
}

/* ---------- Admin preview / uploaded logo / video file ---------- */
.is-preview .preloader { display: none; }
.logo-img { display: block; object-fit: contain; border-radius: 6px; }
/* โลโก้ที่อัปโหลดอาจเป็นภาพแนวนอน: ล็อกความสูง ให้ความกว้างตามสัดส่วนจริง */
.brand .logo-img { width: auto; height: 26px; max-width: 76px; }
.comm-logo:has(.logo-img) { width: auto; min-width: 64px; padding: 0 12px; }
.comm-logo .logo-img { width: auto; height: 36px; max-width: 120px; }
.dl-file-icon .logo-img { width: 28px; height: 28px; }
.modal-video video { width: 100%; height: 100%; background: #000; }

/* ---------- Motion switch (footer) ---------- */
.motion-toggle { display: inline-flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 13.5px; color: var(--muted); }
.motion-toggle:hover { color: var(--text-2); }
.motion-toggle:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 4px; border-radius: 6px; }
.mt-track { position: relative; width: 36px; height: 20px; flex: none; border-radius: 999px; background: #26272b; border: 1px solid var(--line-2); transition: background .25s; }
.mt-thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #a1a1aa; transition: transform .25s, background .25s; }
.motion-toggle[aria-checked="true"] .mt-track { background: var(--accent); }
.motion-toggle[aria-checked="true"] .mt-thumb { transform: translateX(16px); background: #fff; }

.reduce-motion .preloader { display: none; }
.reduce-motion .section-head h2 .w { opacity: 1; }
.reduce-motion .hero-canvas, .reduce-motion .hero-glow, .reduce-motion .cursor-ring { display: none; }
