/*
 * Corehex: ตัวอย่างการใช้งาน, ตัวจัดชุดโมดูล, ตารางเปรียบเทียบ และส่วนปิดท้าย
 * ธีมน้ำเงินกรมท่า แยกจากหน้าหลักของสตูดิโอ ใช้โทนเรียบ เส้นบาง ไม่ใช้แสงเรือง
 */
.corehex-page {
  --cx-ink: #0c1b2e;
  --cx-navy: #0f2238;
  --cx-panel: #16314e;
  --cx-blue: #1683df;
  --cx-blue-dark: #0b3f74;
  --cx-sky: #e8f2fb;
  --cx-line: #d3e1ee;
  --cx-paper: #f7fafd;
  --cx-muted: #5b7288;
  --cx-soft: #b7cbe0;
  --cx-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ฟอนต์: ทับกฎฟอนต์ของสตูดิโอที่บังคับกับ h2/h3/button/span */
.corehex-page :is(.cx-demo, .cx-planner, .cx-closing, .cx-table) :is(h2, h3, button, span, em, b, p, a, li) {
  font-family: Anuphan, "Segoe UI", Arial, sans-serif !important;
  letter-spacing: normal;
}
html body .cx-eyebrow,
html body .cx-eyebrow span,
html body .cx-kicker,
html body .cx-kicker span,
html body .cx-bar span,
html body .cx-headrow .cx-cell,
html body .cx-headrow .cx-cell span,
html body .cx-caption,
html body .cx-caption span,
html body .cx-chart small,
html body .cx-chart small span {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace !important;
}

.cx-wrap {
  max-width: 1180px;
  margin: 0 auto;
}
.cx-eyebrow,
.cx-kicker {
  margin: 0 0 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em !important;
  color: var(--cx-blue);
}
.cx-eyebrow span,
.cx-kicker span {
  letter-spacing: 0.14em !important;
}
.cx-head h2,
.cx-planner h2,
.cx-closing h2 {
  margin: 0;
  font-size: clamp(32px, 4.2vw, 54px);
  font-weight: 800;
  line-height: 1.16;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

/* =====================================================
   ตัวอย่างการใช้งาน
   ===================================================== */
.cx-demo {
  position: relative;
  padding: 110px 6% 120px;
  color: #fff;
  background: var(--cx-navy);
  background-image:
    linear-gradient(#ffffff08 1px, transparent 1px), linear-gradient(90deg, #ffffff08 1px, transparent 1px);
  background-size: 56px 56px;
}
.cx-demo .cx-eyebrow,
.cx-demo .cx-kicker {
  color: #6db8f5;
}
.cx-head {
  max-width: 920px;
  margin-bottom: 44px;
}
.cx-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 5px;
  background: #0b1a2c;
  border: 1px solid #ffffff14;
  border-radius: 999px;
}
.cx-tab {
  padding: 11px 24px;
  font-size: 15px;
  font-weight: 600;
  color: #9fb8d0;
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition:
    color 0.25s,
    background 0.25s;
}
.cx-tab:hover {
  color: #fff;
}
.cx-tab[aria-selected="true"] {
  color: var(--cx-ink);
  background: #fff;
}
.cx-tab:focus-visible,
.cx-chip:focus-visible {
  outline: 3px solid #6db8f5;
  outline-offset: 3px;
}
.cx-panels {
  margin-top: 52px;
}
.cx-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(36px, 6vw, 84px);
  align-items: center;
  animation: cx-fade 0.45s var(--cx-ease);
}
.cx-panel[hidden] {
  display: none;
}
@keyframes cx-fade {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}
.cx-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  min-height: 540px;
  padding: 44px 32px 28px;
  background: radial-gradient(ellipse 80% 70% at 50% 40%, #1f4268, var(--cx-panel));
  border: 1px solid #ffffff14;
  border-radius: 26px;
}
.cx-caption {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.06em !important;
  color: #86a3c0;
}
.cx-info h3 {
  margin: 0 0 18px;
  font-size: clamp(28px, 3.2vw, 42px);
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.02em;
  color: #fff;
}
.cx-info > p:not(.cx-kicker) {
  max-width: 520px;
  margin: 0;
  font-size: 17px;
  line-height: 1.85;
  color: var(--cx-soft);
}
.cx-points {
  margin: 34px 0 0;
  padding: 0;
  list-style: none;
  max-width: 520px;
}
.cx-points li {
  position: relative;
  padding: 16px 0 16px 38px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  color: #fff;
  border-top: 1px solid #ffffff1c;
}
.cx-points li:last-child {
  border-bottom: 1px solid #ffffff1c;
}
.cx-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  width: 22px;
  height: 22px;
  background: var(--cx-blue);
  border-radius: 50%;
}
.cx-points li::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 23px;
  width: 8px;
  height: 4px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}

/* ---- ภาพประกอบแอปบนมือถือ ---- */
.cx-phone {
  width: 252px;
  height: 500px;
  padding: 9px;
  background: #060f1b;
  border-radius: 40px;
  box-shadow:
    0 40px 60px -24px #000c,
    0 0 0 1px #ffffff22;
}
.cx-phone-screen {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  padding: 36px 18px 18px;
  color: var(--cx-ink);
  background: #fff;
  border-radius: 32px;
}
.cx-phone-screen small {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--cx-muted);
}
.cx-phone-screen strong {
  margin-top: -6px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.cx-hero-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 118px;
  padding: 16px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
  background: linear-gradient(150deg, #1d8ff0, #0b4f93);
  border-radius: 18px;
}
.cx-hero-card i {
  position: absolute;
  bottom: 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffffcc;
}
.cx-hero-card i:nth-of-type(1) {
  left: 16px;
}
.cx-hero-card i:nth-of-type(2) {
  left: 36px;
  background: #ffd9a0;
}
.cx-hero-card i:nth-of-type(3) {
  left: 56px;
  background: #a9f0ad;
}
.cx-hero-card > span {
  padding-bottom: 26px;
}
.cx-note {
  display: grid;
  gap: 6px;
  padding: 14px;
  font-size: 12px;
  background: var(--cx-sky);
  border-radius: 14px;
}
.cx-note b {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--cx-blue-dark);
}
.cx-note > span {
  position: relative;
  padding-left: 16px;
  color: #2a4560;
}
.cx-note > span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 7px;
  height: 7px;
  border: 2px solid var(--cx-blue);
  border-radius: 50%;
}
.cx-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: auto;
}
.cx-tiles img {
  width: 100%;
  aspect-ratio: 1;
  padding: 6px;
  object-fit: contain;
  background: #f0f6fb;
  border-radius: 12px;
}

/* ---- ภาพประกอบหน้าต่างระบบ ---- */
.cx-window {
  width: min(100%, 500px);
  overflow: hidden;
  color: var(--cx-ink);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 40px 60px -26px #000b;
}
.cx-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  height: 40px;
  background: #edf3f9;
  border-bottom: 1px solid var(--cx-line);
}
.cx-bar i {
  width: 10px;
  height: 10px;
  background: #c4d3e2;
  border-radius: 50%;
}
.cx-bar span {
  margin-left: 10px;
  font-size: 11px;
  letter-spacing: 0.04em !important;
  color: #4f6a84;
}
.cx-split {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  min-height: 280px;
}
.cx-menu {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 84px;
  gap: 10px;
  padding: 18px;
}
.cx-item {
  display: flex;
  align-items: flex-end;
  padding: 10px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.25;
  background: #f2f7fc;
  border: 2px solid transparent;
  border-radius: 12px;
}
.cx-item.on {
  background: var(--cx-sky);
  border-color: var(--cx-blue);
}
.cx-order {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  font-size: 13px;
  background: #f8fbfe;
  border-left: 1px solid var(--cx-line);
}
.cx-order b {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--cx-blue-dark);
}
.cx-order > span {
  padding-bottom: 9px;
  border-bottom: 1px dashed var(--cx-line);
}
.cx-queue {
  display: grid;
  gap: 8px;
  margin-top: auto;
}
.cx-queue em {
  padding: 8px 10px;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  color: #7a5200;
  background: #fff1cf;
  border-radius: 8px;
}
.cx-queue em.ok {
  color: #0d5a2b;
  background: #d8f5e2;
}
.cx-chart {
  padding: 22px 24px 24px;
}
.cx-chart > p {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 20px;
  font-size: 14px;
  font-weight: 700;
}
.cx-chart small {
  padding: 4px 9px;
  font-size: 10px;
  font-weight: 400;
  color: #4f6a84;
  background: var(--cx-sky);
  border-radius: 99px;
}
.cx-bars {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  height: 230px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--cx-line);
  background: repeating-linear-gradient(to top, transparent 0 56px, #e6eef6 56px 57px);
}
.cx-bars span {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  position: relative;
}
.cx-bars i {
  display: block;
  width: 100%;
  height: var(--h);
  background: var(--cx-blue);
  border-radius: 8px 8px 0 0;
}
.cx-bars span:nth-child(4) i {
  background: var(--cx-blue-dark);
}
.cx-bars em {
  position: absolute;
  bottom: -26px;
  font-size: 12px;
  font-style: normal;
  color: var(--cx-muted);
}
.cx-bars {
  margin-bottom: 30px;
}
.cx-shelf {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 7px;
}
.cx-shelf i,
.cx-legend i {
  display: block;
  aspect-ratio: 1.25;
  border-radius: 6px;
}
.cx-shelf .f,
.cx-legend .f {
  background: var(--cx-blue);
}
.cx-shelf .p,
.cx-legend .p {
  background: #9cc9ee;
}
.cx-shelf .e,
.cx-legend .e {
  background: #e3ecf5;
}
.cx-legend {
  display: flex;
  gap: 18px;
  margin-top: 18px;
  font-size: 12px;
  color: var(--cx-muted);
}
.cx-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.cx-legend i {
  width: 14px;
  aspect-ratio: 1;
}

/* =====================================================
   จัดชุดโมดูล
   ===================================================== */
.cx-planner {
  padding: 110px 6%;
  color: var(--cx-ink);
  background: var(--cx-paper);
}
.cx-planner-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.8fr);
  gap: clamp(36px, 6vw, 84px);
  align-items: start;
}
.cx-lead {
  max-width: 560px;
  margin: 22px 0 36px;
  font-size: 17px;
  line-height: 1.85;
  color: var(--cx-muted);
}
.cx-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.cx-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 52px 12px 14px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  color: var(--cx-ink);
  background: #fff;
  border: 1.5px solid var(--cx-line);
  border-radius: 16px;
  cursor: pointer;
  transition:
    border-color 0.25s,
    background 0.25s,
    transform 0.25s var(--cx-ease);
}
.cx-chip img {
  flex: none;
  width: 48px;
  height: 48px;
  object-fit: contain;
  padding: 6px;
  background: var(--cx-sky);
  border-radius: 12px;
}
.cx-chip:hover {
  border-color: var(--cx-blue);
  transform: translateY(-2px);
}
.cx-chip::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  border: 1.5px solid var(--cx-line);
  border-radius: 50%;
  transition:
    background 0.25s,
    border-color 0.25s;
}
.cx-chip[aria-pressed="true"] {
  background: var(--cx-sky);
  border-color: var(--cx-blue);
}
.cx-chip[aria-pressed="true"]::after {
  background: var(--cx-blue);
  border-color: var(--cx-blue);
}
.cx-chip[aria-pressed="true"]::before {
  content: "";
  position: absolute;
  right: 22px;
  top: 50%;
  width: 9px;
  height: 5px;
  margin-top: -5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
  z-index: 1;
}
.cx-summary {
  position: sticky;
  top: 110px;
  padding: 36px 34px 32px;
  color: #fff;
  background: var(--cx-navy);
  border-radius: 26px;
}
.cx-count {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 22px;
}
.cx-count b {
  font-size: 76px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: #fff;
}
.cx-count span {
  font-size: 16px;
  color: var(--cx-soft);
}
.cx-picks {
  margin: 0;
  padding: 0;
  list-style: none;
}
.cx-picks li {
  padding: 12px 0;
  font-size: 15px;
  font-weight: 600;
  border-top: 1px solid #ffffff1c;
}
.cx-picks li[hidden] {
  display: none;
}
.cx-msg {
  margin: 20px 0 0;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--cx-soft);
}
.cx-msg[hidden] {
  display: none;
}
.cx-reset {
  margin-top: 20px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: transparent;
  border: 1px solid #ffffff44;
  border-radius: 99px;
  cursor: pointer;
}
.cx-reset[hidden] {
  display: none;
}
.cx-reset:hover {
  background: #ffffff14;
}

/* =====================================================
   ตารางเปรียบเทียบ
   ===================================================== */
.cx-table {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--cx-line);
  border-radius: 22px;
  box-shadow: 0 24px 50px -34px #0f223899;
}
.cx-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) minmax(0, 1.1fr);
  border-top: 1px solid var(--cx-line);
}
.cx-row:first-child {
  border-top: 0;
}
.cx-cell {
  padding: 24px 28px;
  font-size: 16px;
  line-height: 1.6;
}
.cx-headrow {
  color: #a9c1d8;
  background: var(--cx-navy);
}
.cx-headrow .cx-cell {
  padding-block: 16px;
  font-size: 11px;
  letter-spacing: 0.1em !important;
}
.cx-headrow .cx-ansh {
  color: #fff;
  background: var(--cx-blue);
}
.cx-what {
  font-weight: 800;
  color: var(--cx-ink);
}
.cx-ask {
  color: var(--cx-muted);
}
.cx-ans {
  position: relative;
  padding-left: 66px;
  font-weight: 600;
  color: var(--cx-ink);
  background: #f1f8fe;
}
.cx-ans i {
  position: absolute;
  left: 28px;
  top: 27px;
  width: 22px;
  height: 22px;
  background: var(--cx-blue);
  border-radius: 50%;
}
.cx-ans i::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  width: 8px;
  height: 4px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}
.comparison .comparison-note {
  margin-top: 26px;
}

/* =====================================================
   ปิดท้ายแบบไม่เร่ง
   ===================================================== */
.cx-closing {
  padding: 120px 6% 130px;
  color: #fff;
  background: #0b1626;
}
.cx-closing .cx-wrap {
  max-width: 880px;
}
.cx-closing .cx-eyebrow {
  color: #6db8f5;
}
.cx-closing h2 {
  max-width: 760px;
}
.cx-closing p:not(.cx-eyebrow) {
  margin: 28px 0 0;
  font-size: 18px;
  line-height: 1.9;
  color: var(--cx-soft);
}
.cx-quiet {
  margin-left: 6px;
  color: #6db8f5;
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1.5px;
  transition: color 0.2s;
}
.cx-quiet:hover {
  color: #fff;
}

/* ---- มือถือ/แท็บเล็ต ---- */
@media (max-width: 960px) {
  .cx-panel,
  .cx-planner-grid {
    grid-template-columns: 1fr;
  }
  .cx-stage {
    min-height: 0;
    padding: 36px 20px 24px;
  }
  .cx-summary {
    position: static;
  }
}
@media (max-width: 700px) {
  .cx-demo,
  .cx-planner {
    padding: 80px 6%;
  }
  .cx-closing {
    padding: 90px 6%;
  }
  .cx-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-radius: 22px;
  }
  .cx-chips {
    grid-template-columns: 1fr;
  }
  .cx-split {
    grid-template-columns: 1fr;
  }
  .cx-order {
    border-left: 0;
    border-top: 1px solid var(--cx-line);
  }
  .cx-row {
    grid-template-columns: 1fr;
  }
  .cx-headrow {
    display: none;
  }
  .cx-cell {
    padding: 14px 22px;
  }
  .cx-what {
    padding-top: 22px;
    font-size: 18px;
  }
  .cx-ans {
    padding-left: 58px;
  }
  .cx-ans i {
    left: 22px;
    top: 17px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cx-panel {
    animation: none;
  }
  .cx-chip,
  .cx-tab {
    transition: none;
  }
}
