/* 1. Variables */

@font-face {
  font-family: "Noto Serif Thai";
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url("/assets/fonts/noto-serif-thai.woff2") format("woff2");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

@font-face {
  font-family: "Noto Serif Thai";
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url("/assets/fonts/noto-serif-thai-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Noto Sans Thai";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/assets/fonts/noto-sans-thai.woff2") format("woff2");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

@font-face {
  font-family: "Noto Sans Thai";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/assets/fonts/noto-sans-thai-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f3eee6;
  --surface: #fffdf8;
  --surface-2: #e6dfd2;
  --ink: #1c1e22;
  --muted: #3e4654;
  --accent: #1a46c4;
  --accent-deep: #12348f;
  --silver: #c5cad3;
  --silver-deep: #8e95a1;
  --line: #d8d1c4;
  --pip: #8f303c;
  --shadow: 0 16px 36px rgba(28, 30, 34, 0.08);
  --radius: 14px;
  --container: 1120px;
  --header: 4.5rem;
  --serif: "Noto Serif Thai", "Leelawadee UI", Thonburi, serif;
  --sans: "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  color-scheme: light;
}

/* 2. Reset and base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header) + 0.75rem);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.8;
  line-break: strict;
  overflow-wrap: break-word;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
summary {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

p,
figure {
  margin: 0;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.35;
  text-wrap: balance;
}

a {
  color: var(--accent-deep);
}

a.text-link,
a.text-link:visited {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

a.text-link:hover,
a.text-link:focus-visible {
  color: var(--accent-deep);
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 80;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 0.65rem 1rem;
  border-radius: 10px;
}

.skip:focus {
  top: 0.75rem;
}

.wrap {
  width: min(var(--container), calc(100% - 2.5rem));
  margin-inline: auto;
}

main:focus {
  outline: none;
}

/* 3. Typography */

.kicker {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.5;
}

.prose {
  max-width: 46rem;
}

.prose p + p,
.stack > * + * {
  margin-top: 0.85rem;
}

.lead {
  font-size: 1.12rem;
  color: var(--muted);
}

h2 {
  font-size: clamp(1.7rem, 2.6vw, 2.3rem);
}

h3 {
  font-size: 1.22rem;
}

.subhead {
  margin-top: 1.6rem;
}

/* 4. Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(243, 238, 230, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  min-height: var(--header);
  width: min(var(--container), calc(100% - 2.5rem));
  margin-inline: auto;
  gap: 0.75rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  flex: 0 0 auto;
}

.logo:hover {
  color: var(--accent-deep);
}

.logo-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
}

.logo-word {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.12rem;
  line-height: 1.25;
  white-space: nowrap;
}

/* 5. Navigation */

.site-nav {
  display: flex;
  align-items: center;
  order: 2;
  margin-left: 0.5rem;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 0.15rem 0.85rem;
  list-style: none;
}

.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.4;
  padding: 0.4rem 0.1rem;
}

@media (min-width: 1024px) {
  .site-nav {
    margin-left: auto;
  }

  .site-nav a {
    white-space: nowrap;
  }
}

@media (min-width: 1024px) and (max-width: 1240px) {
  .site-nav ul {
    gap: 0.1rem 0.4rem;
  }

  .site-nav a {
    font-size: 0.84rem;
  }

  .logo-word {
    font-size: 1rem;
  }
}

.site-nav a:hover {
  color: var(--accent);
}

.header-cta {
  order: 3;
  margin-left: 1rem;
  flex: 0 0 auto;
}

.nav-cta {
  display: none;
}

.menu-toggle {
  display: none;
  order: 4;
  min-height: 44px;
  min-width: 44px;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
}

/* 6. Hero */

.hero {
  padding: 3.5rem 0 2.5rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 2.5rem;
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 4.1rem);
  letter-spacing: 0;
}

.hero-copy .lead {
  margin-top: 1rem;
  max-width: 38rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.4rem;
}

.hero-note {
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.hero-board {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem 1.2rem 1.1rem;
}

.photo {
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: #efeae2;
}

.hero-board .photo {
  border-radius: 10px;
  margin-bottom: 0.15rem;
}

.photo-frame {
  margin: 0;
}

.board-label {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 0.85rem;
}

.sides {
  display: grid;
  gap: 0.9rem;
}

.side-name {
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.math {
  margin-top: 0.35rem;
  color: var(--muted);
}

.hero-result {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  font-weight: 600;
}

.facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-top: 2rem;
  list-style: none;
}

.facts li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
  line-height: 1.55;
}

.facts strong {
  display: block;
  font-size: 0.95rem;
}

/* 7. Visual components */

.section {
  padding: 4.25rem 0;
}

.section-head {
  margin-bottom: 1.35rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.band .section-head {
  border-bottom-color: rgba(243, 238, 230, 0.18);
}

.surface {
  background: var(--surface);
}

.band {
  background: var(--ink);
  color: #f3eee6;
}

.band .kicker,
.band a {
  color: #d5def8;
}

.band .lead,
.band .math,
.band .muted {
  color: #d5d8df;
}

.band .panel {
  color: var(--ink);
}

.band .panel .math {
  color: var(--muted);
}

.panels,
.hands,
.variants,
.myths,
.glossary {
  display: grid;
  gap: 0.9rem;
}

.panels,
.variants {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panels-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hands,
.myths,
.glossary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel,
.hand,
.variant,
.myth,
.glossary div,
.step,
.plate {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.05rem 1.1rem;
  min-width: 0;
}

dt {
  font-weight: 600;
}

dd {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.hero-board .playing-card {
  width: 4.35rem;
  height: 6.1rem;
}

.panel h3,
.hand h3,
.variant h3,
.myth h3 {
  margin-bottom: 0.4rem;
}

.panel p:last-child,
.variant p:last-child,
.myth p:last-child,
.hand p:last-child {
  margin-bottom: 0;
}

.panel-player { border-top: 4px solid var(--accent); }
.panel-banker { border-top: 4px solid var(--ink); }
.panel-tie { border-top: 4px solid var(--silver-deep); }

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  list-style: none;
}

.step p {
  margin: 0;
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.split .prose {
  max-width: none;
}

.rule-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.plate strong {
  display: block;
  margin: 0.15rem 0 0.2rem;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 1.2;
  color: var(--accent-deep);
}

.plate span {
  color: var(--muted);
}

.playing-card {
  width: 4rem;
  height: 5.65rem;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.35rem 0.4rem 0.45rem;
  border-radius: 0.45rem;
  border: 1px solid #ddd6c8;
  background: #fffdfb;
  color: var(--ink);
  box-shadow: 0 8px 16px rgba(28, 30, 34, 0.06);
  line-height: 1;
}

.playing-card b {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  font-weight: 600;
  font-size: 1.02rem;
}

.playing-card .suit,
.playing-card .suit-lg {
  font-family: "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols 2", sans-serif;
  font-style: normal;
  font-weight: 400;
}

.playing-card .suit-lg {
  align-self: flex-end;
  font-size: 1.35rem;
}

.playing-card.is-red {
  color: var(--pip);
}

.playing-card.is-ten b {
  font-size: 0.86rem;
}

.card-back {
  width: 4rem;
  height: 5.65rem;
  border-radius: 0.45rem;
  border: 1px solid var(--accent-deep);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.16), transparent 42%),
    repeating-linear-gradient(135deg, #1a46c4 0 3px, #2450ce 3px 7px);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
}

.card-back.is-optional {
  background: transparent;
  color: var(--accent-deep);
  border-style: dashed;
}

.samples,
.equations {
  margin-top: 1.25rem;
}

.samples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.1rem;
  list-style: none;
}

.samples li,
.equation {
  display: grid;
  justify-items: start;
  gap: 0.35rem;
}

.equation {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}

.equations {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.deal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 0.85rem;
  list-style: none;
  margin-top: 1rem;
}

.deal li {
  width: 5.4rem;
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  text-align: center;
  line-height: 1.4;
  font-size: 0.92rem;
}

.total-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  margin-top: 0.8rem;
  font-weight: 600;
}

.total-chip b {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}

.outcome {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  margin: 0.35rem 0 0.8rem;
  padding: 0.15rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-weight: 600;
  line-height: 1.4;
}

.outcome.is-player { color: var(--accent-deep); border-color: #b9c7ef; }
.outcome.is-banker { color: var(--ink); border-color: #b7bdc8; }
.outcome.is-tie { color: var(--muted); }

.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  margin-top: 1rem;
}

.note {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
}

.band .note {
  background: #2a2d33;
  border-left-color: #9eb0e8;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 0.8rem 0;
  color: var(--muted);
}

.legend b {
  color: var(--ink);
  font-weight: 600;
}

.path {
  margin: 0.8rem 0 0;
  padding-left: 1.15rem;
}

.path li + li {
  margin-top: 0.25rem;
}

/* 8. Content sections */

.section .panels,
.section .hands,
.section .steps,
.section .rule-groups,
.section .variants,
.section .myths,
.section .glossary,
.section .table-wrap,
.section .split,
.section .deal {
  margin-top: 1.25rem;
}

.hand .side-name {
  margin-top: 0.2rem;
}

/* 9. Tables */

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.scroll-hint {
  display: none;
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 0.98rem;
  line-height: 1.55;
}

caption {
  caption-side: top;
  text-align: left;
  font-weight: 600;
  padding: 0.85rem 0.9rem 0.4rem;
}

th,
td {
  border-top: 1px solid var(--line);
  padding: 0.65rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: #ebe4d8;
  font-weight: 600;
}

.matrix {
  min-width: 48rem;
}

.wide {
  min-width: 40rem;
}

.matrix th,
.matrix td {
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.matrix th[scope="row"] {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  background: #ebe4d8;
  box-shadow: 1px 0 0 var(--line);
}

td.is-draw {
  color: var(--accent-deep);
  font-weight: 600;
}

/* 10. FAQ */

.faq {
  display: grid;
  gap: 0.6rem;
}

.faq details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.faq summary {
  min-height: 48px;
  padding: 0.8rem 1rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  color: var(--accent);
  font-weight: 600;
  flex: 0 0 auto;
}

.faq details[open] summary::after {
  content: "–";
}

.faq details div {
  padding: 0 1rem 1rem;
  color: var(--muted);
}

/* 11. Legal */

.legal {
  background: var(--surface-2);
  padding: 1.6rem 0;
}

#responsible-gambling {
  padding-top: 4rem;
}

#terms-of-use {
  padding-bottom: 4rem;
}

.legal .wrap {
  max-width: 48rem;
}

.legal h2 {
  font-size: 1.65rem;
  margin-bottom: 0.7rem;
}

.legal ul {
  margin: 0.6rem 0 0;
  padding-left: 1.15rem;
}

.legal li + li {
  margin-top: 0.35rem;
}

/* 12. CTA */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 1.15rem;
  border-radius: 999px;
  border: 1.5px solid var(--accent-deep);
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.btn-solid {
  background: var(--accent);
  border-color: var(--accent-deep);
  color: #fff;
}

.btn-solid:hover {
  background: var(--accent-deep);
  color: #fff;
}

.btn-solid:active {
  background: #0d2770;
}

.btn-ghost {
  background: transparent;
  color: var(--accent-deep);
}

.btn-ghost:hover {
  background: rgba(26, 70, 196, 0.08);
  color: var(--accent-deep);
}

.btn-ghost:active,
.menu-toggle:active,
.to-top:active {
  transform: translateY(1px);
}

@media (min-width: 1024px) {
  .nav-cta {
    display: none;
  }
}

.final-cta {
  padding: 4rem 0;
  text-align: center;
}

.final-cta .lead {
  margin: 0.7rem auto 0;
  max-width: 36rem;
}

.final-cta .btn {
  margin-top: 1.2rem;
}

.final-cta .hero-note {
  margin-top: 0.75rem;
}

/* 13. Footer */

.site-footer {
  background: var(--ink);
  color: #f3eee6;
  padding: 2.8rem 0 1.6rem;
}

.site-footer a {
  color: #f3eee6;
  text-decoration: none;
}

.site-footer a:hover {
  color: #d5def8;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 1.5rem 2rem;
}

.site-footer .logo-word {
  color: #f3eee6;
}

.footer-brand p {
  margin-top: 0.8rem;
  color: #d5d8df;
  max-width: 24rem;
}

.site-footer h2 {
  font-size: 1rem;
  margin-bottom: 0.55rem;
}

.site-footer ul {
  list-style: none;
}

.site-footer li + li {
  margin-top: 0.3rem;
}

.footer-meta {
  margin-top: 1.8rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(243, 238, 230, 0.16);
  color: #c5cad3;
  font-size: 0.95rem;
}

.to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 30;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: #f3eee6;
  font-size: 1.2rem;
  line-height: 1;
}

.to-top[hidden] {
  display: none !important;
}

/* 14. Responsive */

@media (max-width: 1023px) {
  .menu-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .header-cta {
    display: none;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0;
    padding: 0.7rem 1rem 0.9rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    max-height: min(22rem, 70vh);
    overflow: auto;
  }

  .site-nav.is-open {
    display: grid;
    gap: 0.55rem;
  }

  .site-nav ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.15rem 0.75rem;
  }

  .site-nav a {
    display: flex;
    align-items: center;
    min-height: 44px;
  }

  .nav-cta {
    display: inline-flex;
    width: 100%;
  }
}

@media (max-width: 900px) {
  .hero-grid,
  .split,
  .panels,
  .panels-3,
  .hands,
  .steps,
  .equations {
    grid-template-columns: 1fr;
  }

  .facts,
  .variants,
  .glossary,
  .myths,
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) and (min-width: 641px) {
  .steps,
  .panels-3,
  .equations {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 1.02rem;
  }

  .wrap,
  .header-inner {
    width: min(var(--container), calc(100% - 1.7rem));
  }

  .hero {
    padding-top: 2rem;
  }

  .section {
    padding: 3rem 0;
  }

  .facts,
  .variants,
  .glossary,
  .myths,
  .footer-grid,
  .rule-groups {
    grid-template-columns: 1fr;
  }

  .hero-actions .btn,
  .final-cta .btn {
    width: 100%;
  }

  .logo-word {
    font-size: 1rem;
  }

  .scroll-hint {
    display: block;
  }

  #responsible-gambling {
    padding-top: 3rem;
  }
}

@media (max-width: 1023px) and (min-width: 641px) {
  .scroll-hint {
    display: block;
  }
}

/* 15. Reduced motion */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .btn-ghost:active,
  .menu-toggle:active,
  .to-top:active {
    transform: none;
  }
}
