/* ==========================================================================
   PRICING (หน้าแพ็กเกจ)
   ย้ายจาก Frontend/design/mockups/packages.html ที่ผู้ใช้อนุมัติ ส่วนกลางอยู่ใน public-site-kit.css
   ประวัติ: Frontend/PRICING_PAGE_COPY_BUG_HISTORY.md
   ========================================================================== */

/* ---------- พื้นฐานของหน้า ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

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

/* Layout: หัวหน้าสั้นขายผลลัพธ์ → แถบทดลองฟรี → การ์ด 4 แพ็กเรียงตามระดับ (Basic ยกสูงเป็นแพ็กแนะนำ) → ตารางเทียบ → ความมั่นใจก่อนจ่าย → คำถาม */

/* ---------- Hero ---------- */
.hero {
  position: relative;
  isolation: isolate;
  margin-top: -86px;
  padding-block: 140px 40px;
  overflow: hidden;
  text-align: center;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.aurora {
  position: absolute;
  border-radius: 50%;
  animation: drift 22s ease-in-out infinite alternate;
}

.a1 {
  width: 780px;
  height: 780px;
  left: -260px;
  top: -320px;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.28), rgba(124, 92, 255, 0) 65%);
}

.a2 {
  width: 720px;
  height: 720px;
  right: -240px;
  top: -200px;
  background: radial-gradient(circle, rgba(16, 179, 200, 0.2), rgba(16, 179, 200, 0) 65%);
  animation-duration: 27s;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    transform: translate3d(40px, 30px, 0) scale(1.08);
  }
}

.dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(106, 76, 245, 0.2) 1px, transparent 1.3px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 30%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 70% at 50% 30%, #000 20%, transparent 75%);
}

.hero h1 {
  margin-top: 18px;
  font-size: clamp(36px, 5.6vw, 72px);
  line-height: 1.14;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.hero .lead {
  margin: 20px auto 0;
  max-width: 38em;
  font-size: clamp(16.5px, 1.5vw, 19px);
  color: var(--site-muted);
}

.assure {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  margin-top: 22px;
  font-size: 14.5px;
  color: var(--site-muted);
}

.assure span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.assure svg {
  width: 16px;
  height: 16px;
  color: var(--site-ok);
}

/* ---------- Trial ---------- */
.trial {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  margin-top: 44px;
  padding: 30px 34px;
  border-radius: var(--site-r-lg);
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.9), rgba(240, 250, 252, 0.85));
  border: 1px solid #fff;
  box-shadow: var(--site-shadow);
  text-align: left;
}

.trial .label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--site-cyan-soft);
  color: var(--site-cyan);
  font-size: 13px;
  font-weight: 600;
}

.trial h2 {
  margin-top: 12px;
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.3;
  font-weight: 600;
}

.trial ul {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  font-size: 15px;
}

.trial li {
  display: flex;
  gap: 8px;
}

.trial li::before {
  content: "✓";
  color: var(--site-cyan);
  font-weight: 700;
}

.trial-act {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding-left: 32px;
  border-left: 1px solid var(--site-line);
}

.trial-act .big {
  font: 700 44px/1 var(--site-font-display);
}

.trial-act small {
  font-size: 13.5px;
  color: var(--site-faint);
}

/* ---------- Plans ---------- */
.plans {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
  margin-top: 56px;
}

.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px 24px;
  border-radius: var(--site-r-lg);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid #fff;
  box-shadow: var(--site-shadow-sm);
  min-width: 0;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-align: left;
}

.plan.hot {
  background: #fff;
  box-shadow: var(--site-shadow-xl);
  transform: translateY(-14px);
}

.ribbon {
  position: absolute;
  top: -14px;
  left: 50%;
  translate: -50% 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--site-grad);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 10px 20px -10px rgba(90, 70, 240, 0.8);
}

.who {
  font-size: 13px;
  font-weight: 600;
  color: var(--site-violet);
}

.plan h3 {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.1;
}

.plan .outcome {
  font-size: 15px;
  color: var(--site-muted);
  min-height: 4.8em;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.price-row b {
  font: 700 40px/1 var(--site-font-display);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.price-row span {
  font-size: 14.5px;
  color: var(--site-muted);
}

.quota {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--site-surface-sunk);
  font-size: 12.5px;
  color: var(--site-muted);
}

.plan .site-btn {
  width: 100%;
  height: 48px;
}

.plan .site-btn--ghost {
  background: #fff;
}

.inherit {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--site-ink);
  padding-top: 14px;
  border-top: 1px solid var(--site-line);
}

.feat {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  font-size: 14.5px;
  line-height: 1.5;
}

.feat li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.scope {
  margin-top: auto;
  padding: 14px;
  border-radius: 14px;
  background: var(--site-surface-sunk);
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--site-muted);
}

.scope b {
  color: var(--site-ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.scope .h {
  font: 500 11px/1 var(--site-font-mono);
  letter-spacing: 0.1em;
  color: var(--site-faint);
  margin-bottom: 2px;
}

.scope div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

/* ---------- Compare table ---------- */
section.block {
  padding-block: 112px 0;
}

.sec-head {
  max-width: 760px;
  margin: 0 auto 40px;
  text-align: center;
}

.sec-head h2 {
  margin-top: 16px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.2;
  font-weight: 600;
}

.sec-head p {
  margin-top: 16px;
  font-size: 17px;
  color: var(--site-muted);
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--site-r-lg);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #fff;
  box-shadow: var(--site-shadow);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  padding: 15px 18px;
  text-align: center;
  border-bottom: 1px solid var(--site-line);
}

th:first-child,
td:first-child {
  text-align: left;
}

thead th {
  position: sticky;
  top: 0;
  background: #fff;
  font: 600 16px/1.3 var(--site-font-display);
}

thead th.hl {
  color: var(--site-violet);
}

tbody tr.grp td {
  background: var(--site-surface-sunk);
  font: 500 12px/1 var(--site-font-mono);
  letter-spacing: 0.1em;
  color: var(--site-faint);
  text-align: left;
  padding-block: 11px;
}

td.hl {
  background: rgba(106, 76, 245, 0.04);
}

.y {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--site-grad);
  color: #fff;
}

.y svg {
  width: 13px;
  height: 13px;
  stroke-width: 3;
}

.n {
  color: #c3c0d4;
}

.num {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* ---------- Trust + CTA ---------- */
.trust {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.trust div {
  padding: 22px;
  border-radius: var(--site-r-md);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid #fff;
  box-shadow: var(--site-shadow-sm);
}

.trust .ti {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--site-violet-soft);
  color: var(--site-violet);
  margin-bottom: 12px;
}

.trust .ti svg {
  width: 20px;
  height: 20px;
}

.trust b {
  display: block;
  font: 600 16.5px/1.35 var(--site-font-display);
}

.trust span {
  font-size: 14px;
  color: var(--site-muted);
}

.cta {
  position: relative;
  overflow: hidden;
  margin-top: 112px;
  padding: 72px 32px;
  border-radius: 40px;
  text-align: center;
  background: linear-gradient(160deg, #fff, #f2eeff 55%, #e8f8fb);
  border: 1px solid #fff;
  box-shadow: var(--site-shadow-xl);
}

.cta h2 {
  font-size: clamp(30px, 4.2vw, 54px);
  line-height: 1.18;
  font-weight: 600;
}

.cta p {
  margin: 16px auto 0;
  max-width: 34em;
  font-size: 17.5px;
  color: var(--site-muted);
}

.cta .row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 30px;
}

/* ---------- การ์ดลอยเมื่อชี้ เฉพาะเครื่องที่มีเมาส์ ---------- */
@media (hover: hover) {
  .plan:hover {
    transform: translateY(-4px);
    box-shadow: var(--site-shadow);
  }

  .plan.hot:hover {
    transform: translateY(-18px);
  }
}

/* ---------- ชิ้นที่มีเฉพาะหน้าจริง: ข้อมูลจาก package API ---------- */

/* ไอคอนตามเรื่องของฟีเจอร์ (PRICING_PAGE_COPY_BUG_HISTORY.md: ห้ามใช้เช็กแบบเดียวกันทุกบรรทัด) */
.feat-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--site-violet-soft);
  color: var(--site-violet);
}

.feat-ic svg {
  width: 13px;
  height: 13px;
}

.trial-act .scope {
  align-self: stretch;
  margin-top: 0;
}

.trial-act .site-btn {
  margin-top: 2px;
}

.plan-connect {
  display: grid;
  gap: 3px;
  padding: 11px 13px;
  border-radius: 14px;
  background: var(--site-violet-soft);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--site-muted);
}

.plan-connect b {
  font-size: 13px;
  color: var(--site-ink);
}

.plan-connect-limits {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.plan-connect-limits span {
  padding: 2px 9px;
  border-radius: 999px;
  background: #fff;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--site-violet);
}

.package-details {
  padding-top: 10px;
  border-top: 1px dashed var(--site-line-strong);
}

.package-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  list-style: none;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--site-violet);
  cursor: pointer;
}

.package-details summary::-webkit-details-marker {
  display: none;
}

.package-details summary::after {
  content: "+";
  font-size: 16px;
  line-height: 1;
}

.package-details[open] summary::after {
  content: "\2013";
}

.package-details-count {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--site-faint);
}

.package-details .feat {
  margin-top: 12px;
}

.pricing-next-note {
  margin-top: 28px;
  text-align: center;
  font-size: 14px;
  color: var(--site-muted);
}

.package-error {
  grid-column: 1/-1;
  padding: 36px 28px;
  border: 1px solid #fff;
  border-radius: var(--site-r-lg);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--site-shadow-sm);
  text-align: center;
}

.package-error h2 {
  font-size: 22px;
  font-weight: 600;
}

.package-error p {
  margin-top: 8px;
  color: var(--site-muted);
}

.package-error .site-btn {
  margin-top: 18px;
}

/* โครงโหลด: แสดงในตำแหน่งการ์ดจริง ไม่บังทั้งหน้า */
.skeleton-line {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--site-surface-sunk) 25%, #fff 50%, var(--site-surface-sunk) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-line.short {
  width: 42%;
}

.skeleton-line.medium {
  width: 72%;
}

.skeleton-line.price {
  width: 55%;
  height: 34px;
  border-radius: 12px;
}

.plan-skeleton {
  min-height: 420px;
}

.trial-skeleton .skeleton-line + .skeleton-line {
  margin-top: 12px;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ---------- ทางเข้าเก่า packages.html: เลือกแพ็กหลังกรอกข้อมูลสมัคร (การ์ด 5 ใบรวม Trial) ---------- */
.legacy-packages {
  padding-block: 24px 80px;
}

/* แถบขั้นตอนใช้ .site-steps ของ kit ตรงนี้ตั้งแค่ระยะห่างในหน้านี้ */
.legacy-packages > .site-steps {
  margin-top: 8px;
}

.legacy-packages-head {
  margin-top: 26px;
  text-align: center;
}

.legacy-packages-head h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.2;
  font-weight: 600;
}

.legacy-packages-head p {
  margin: 12px auto 0;
  max-width: 36em;
  color: var(--site-muted);
}

.legacy-packages .plans {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(247, 246, 253, 0.92);
}

.loading-overlay.show {
  display: flex;
}

.premium-loader-container {
  position: relative;
  width: 96px;
  height: 96px;
}

.loader-ring {
  position: absolute;
  inset: 0;
  border: 3px solid transparent;
  border-radius: 50%;
}

.loader-ring-1 {
  border-top-color: var(--site-violet);
  border-right-color: var(--site-cyan);
  animation: spin 1.1s linear infinite;
}

.loader-ring-2 {
  inset: 10px;
  border-bottom-color: rgba(106, 76, 245, 0.35);
  animation: spin 1.6s linear infinite reverse;
}

.loader-logo {
  position: absolute;
  inset: 28px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.loading-text-container {
  width: 100%;
  max-width: 440px;
  text-align: center;
}

.loading-text {
  font-size: 18px;
  font-weight: 600;
}

.loading-subtext {
  margin-top: 4px;
  font-size: 14px;
  color: var(--site-muted);
}

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

@media (max-width: 1100px) {
  .legacy-packages .plans {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .plans {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 16px;
  }

  .plan.hot {
    transform: none;
  }

  .plan .outcome {
    min-height: 0;
  }

  .trust {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .trial {
    grid-template-columns: minmax(0, 1fr);
  }

  .trial-act {
    padding-left: 0;
    padding-top: 20px;
    border-left: 0;
    border-top: 1px solid var(--site-line);
  }
}

@media (max-width: 640px) {
  /* แสงพื้นหลังอยู่นิ่งบนมือถือ */
  .aurora {
    animation: none;
  }

  .legacy-packages .plans {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero {
    padding-block: 120px 24px;
  }

  .trial {
    padding: 24px 20px;
  }

  .trial ul {
    grid-template-columns: minmax(0, 1fr);
  }

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

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

  section.block {
    padding-block: 80px 0;
  }

  .cta {
    margin-top: 80px;
    padding: 52px 20px;
    border-radius: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* รวม ::before / ::after ด้วย (mockup ใช้แค่ * ) */
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ล็อกคำไทยที่เบราว์เซอร์ชอบตัดกลางคำ หรือวลีท้ายที่ตกบรรทัดเดี่ยว (2026-10-03) */
.nw {
  white-space: nowrap;
}

/* คำถาม FAQ สั้น 1–2 บรรทัด: เกลี่ยบรรทัดกันคำเดี่ยวตกบรรทัด */
#faq summary {
  text-wrap: balance;
}
