/* 1. Variables */

:root {
  --bg: #090908;
  --bg-raised: #10110f;
  --felt: #0c1411;
  --surface: #141613;
  --ivory: #f4efe6;
  --ivory-dim: #ddd6c8;
  --muted: #b7b1a4;
  --faint: #8d877c;
  --gold: #c6a36a;
  --gold-bright: #e6d3a4;
  --gold-deep: #8c6e3e;
  --line: rgba(198, 163, 106, 0.22);
  --burgundy: #8a3140;
  --burgundy-hover: #9d3c4c;
  --card: #f6f0e4;
  --card-red: #9d3140;
  --card-black: #1a1916;
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.38);
  --radius: 2px;
  --container: 1140px;
  --header: 5.25rem;
  --serif: "Noto Serif Thai", "Leelawadee UI", Thonburi, serif;
  --sans: "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  --ease: 200ms ease;
  color-scheme: dark;
}

/* 2. Reset and base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-color: #3c362e var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ivory);
  font-family: var(--sans);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.8;
  line-break: strict;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button,
input,
summary {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

p,
h1,
h2,
h3,
figure,
dl,
dd {
  margin: 0;
}

a {
  color: inherit;
}

::selection {
  background: #6d2431;
  color: var(--ivory);
}

/* 3. Typography */

@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;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 500;
  color: var(--ivory);
  text-wrap: balance;
}

h2 {
  font-size: clamp(2.05rem, 4.2vw, 3.25rem);
  font-weight: 600;
  line-height: 1.4;
  max-width: 16em;
}

h3 {
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.45;
}

.eyebrow {
  margin-bottom: 0.85rem;
  color: var(--gold-bright);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.6;
}

.kicker {
  color: var(--gold-bright);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.6;
}

.prose {
  max-width: 38em;
  color: var(--muted);
}

.prose p + p {
  margin-top: 0.9rem;
}

.prose a {
  color: var(--gold-bright);
  text-decoration: none;
}

.prose a:hover {
  color: var(--ivory);
}

.note {
  max-width: 46rem;
  margin-top: 1.35rem;
  padding-left: 0.95rem;
  border-left: 1px solid var(--gold-deep);
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.8;
}

/* 4. Layout */

.container {
  width: min(var(--container), calc(100% - 2rem));
  margin-inline: auto;
}

.section,
.finale {
  scroll-margin-top: calc(var(--header) + 0.75rem);
}

.section {
  padding: clamp(4.25rem, 8vw, 7rem) 0;
  border-top: 1px solid var(--line);
}

.section-header {
  margin-bottom: clamp(2rem, 4vw, 3.25rem);
}

.section-description {
  max-width: 38em;
  margin-top: 1rem;
  color: var(--muted);
}

.section-felt {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(36, 72, 54, 0.38), transparent 52%),
    var(--felt);
}

.section-alt {
  background: var(--bg-raised);
}

.split {
  display: grid;
  gap: clamp(1.75rem, 4vw, 4.5rem);
  align-items: center;
}

.with-fan {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}

/* 5. Buttons */

.cta-button,
.button-ghost,
.nav-toggle,
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.8rem 1.3rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.5;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}

.cta-button {
  background: var(--burgundy);
  color: var(--ivory);
}

.cta-button:hover {
  background: var(--burgundy-hover);
}

.button-ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--ivory);
}

.button-ghost:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.6rem;
}

/* 6. Header */

.skip {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 40;
  transform: translateY(-150%);
  padding: 0.65rem 0.9rem;
  background: var(--ivory);
  color: var(--bg);
  text-decoration: none;
}

.skip:focus {
  transform: none;
}

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(9, 9, 8, 0.92), rgba(9, 9, 8, 0));
  transition: background var(--ease), border-color var(--ease);
  border-bottom: 1px solid transparent;
}

.site-header.is-scrolled,
.site-header.is-open {
  background: rgba(9, 9, 8, 0.94);
  border-bottom-color: var(--line);
  backdrop-filter: blur(16px);
}

.site-header.is-open {
  background: #0c0c0b;
}

.header-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--header);
}

.logo {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 0.7rem;
  min-height: 44px;
  text-decoration: none;
}

.logo-mark {
  width: 1.7rem;
  height: 1.7rem;
  flex: none;
}

.logo-mark .face {
  fill: var(--ivory);
}

.logo-mark .back {
  fill: var(--burgundy);
  stroke: var(--gold);
}

.logo-text {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.35;
  white-space: nowrap;
}

.logo-text span {
  color: var(--gold-bright);
}

.header-bar .cta-button {
  flex: none;
  margin-left: auto;
  min-height: 44px;
  padding-inline: 0.9rem;
}

.nav-toggle {
  min-width: 4.5rem;
  border-color: var(--line);
}

.nav {
  display: none;
  position: absolute;
  z-index: 2;
  top: 100%;
  left: 0;
  right: 0;
  padding: 0.35rem 1.25rem 1rem;
  background: #0c0c0b;
  border-bottom: 1px solid var(--line);
}

.site-header.is-open .nav {
  display: block;
}

.nav a {
  display: block;
  padding: 0.8rem 0;
  color: var(--ivory-dim);
  font-size: 0.98rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.5;
  text-decoration: none;
}

.nav a:hover {
  color: var(--gold-bright);
}

/* 7. Hero */

.hero {
  padding: calc(var(--header) + 0.5rem) 0 clamp(3rem, 6vw, 5.5rem);
  background:
    radial-gradient(ellipse at 85% 30%, rgba(22, 46, 36, 0.55), transparent 46%),
    var(--bg);
}

.hero-layout {
  display: grid;
  gap: 1.35rem;
  container-type: inline-size;
}

.hero h1 {
  font-size: clamp(3.5rem, 12vw, 6.75rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
}

.hero-lead {
  max-width: 14em;
  color: var(--gold-bright);
  font-size: clamp(1.7rem, 2.8vw, 2.2rem);
  font-style: normal;
  font-weight: 500;
  line-height: 1.45;
}

.hero-text {
  max-width: 34em;
  margin-top: 0.9rem;
  color: var(--muted);
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.2rem;
  margin-top: 1.8rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.6;
}

.hero-media img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
}

/* 8. Content sections */

.highlights {
  display: grid;
  gap: 1px;
  margin-top: 1.75rem;
  border: 1px solid var(--line);
  background: var(--line);
}

.highlights li {
  padding: 1rem 1.05rem 1.1rem;
  background: var(--bg);
}

.highlights strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ivory);
  line-height: 1.45;
}

.highlights span {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.frame img {
  width: 100%;
  border: 1px solid var(--line);
  object-fit: cover;
}

.frame figcaption {
  margin-top: 0.75rem;
  color: var(--faint);
  font-size: 1rem;
  line-height: 1.7;
}

.frame-square img {
  aspect-ratio: 1;
}

.fan {
  display: flex;
  align-items: flex-end;
  height: 5.4rem;
}

.fan span {
  width: 3rem;
  height: 4.35rem;
  margin-left: -1.15rem;
  border-radius: 0.2rem;
  background:
    linear-gradient(160deg, rgba(230, 211, 164, 0.28), transparent 40%),
    #6e2430;
  box-shadow:
    inset 0 0 0 0.42rem rgba(12, 20, 17, 0.55),
    inset 0 0 0 0.5rem rgba(198, 163, 106, 0.55),
    0 12px 22px rgba(0, 0, 0, 0.28);
}

.fan span:first-child {
  margin-left: 0;
  transform: rotate(-11deg);
}

.fan span:nth-child(2) {
  transform: translateY(-0.45rem);
}

.fan span:nth-child(3) {
  transform: rotate(11deg);
}

.steps {
  display: grid;
  gap: 1.35rem;
}

.steps li {
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.numeral {
  display: block;
  margin-bottom: 0.55rem;
  color: var(--gold);
  font-family: var(--serif);
  font-size: clamp(2.2rem, 4vw, 3.1rem);
  font-weight: 500;
  line-height: 1.15;
}

.steps p,
.tips p,
.reasons p,
.timeline p {
  color: var(--muted);
}

.steps h3,
.tips h3 {
  margin-bottom: 0.4rem;
}

.bet-grid {
  display: grid;
  gap: 0.9rem;
}

.bet {
  display: flex;
  flex-direction: column;
  min-height: 22rem;
  padding: 1.4rem 1.3rem 1.25rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.bet-player {
  background: linear-gradient(180deg, #1a1c19 0%, #121412 100%);
}

.bet-banker {
  border-color: rgba(198, 163, 106, 0.42);
  background: linear-gradient(180deg, #231c14 0%, #14120f 100%);
}

.bet-tie {
  background: linear-gradient(180deg, #241418 0%, #140e11 100%);
}

.bet h3 {
  margin-top: 0.7rem;
  font-size: clamp(2.35rem, 4vw, 3.15rem);
  line-height: 1.25;
}

.bet-copy {
  max-width: 28rem;
  margin-top: 0.9rem;
  color: var(--muted);
}

.bet-foot {
  margin-top: auto;
  padding-top: 1.4rem;
}

.payout {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  align-items: baseline;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  color: var(--ivory);
  line-height: 1.55;
}

.payout span {
  color: var(--faint);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.55;
}

.edge {
  margin-top: 0.55rem;
  color: var(--ivory-dim);
  font-size: 1rem;
  line-height: 1.65;
}

.values {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.value-row {
  display: grid;
  gap: 0.9rem;
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--line);
}

.value-label span {
  display: block;
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 2.2rem;
  line-height: 1.2;
}

.value-label {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.value-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.playing-card {
  position: relative;
  display: block;
  width: 4.15rem;
  height: 6rem;
  border-radius: 0.35rem;
  background: linear-gradient(180deg, #fffaf3 0%, var(--card) 100%);
  color: var(--card-black);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 12px 24px rgba(0, 0, 0, 0.28);
}

.playing-card-red {
  color: var(--card-red);
}

.corner {
  position: absolute;
  top: 0.32rem;
  left: 0.36rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.9;
}

.corner-rev {
  top: auto;
  left: auto;
  right: 0.36rem;
  bottom: 0.32rem;
  transform: rotate(180deg);
}

.rank {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
}

.playing-card-ten .rank {
  font-size: 0.78rem;
  letter-spacing: -0.04em;
}

.suit {
  font-size: 0.72rem;
}

.pip {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.55rem;
  line-height: 1;
}

.equations {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.5rem;
}

.equation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
}

.equation figcaption {
  flex: 1 1 14rem;
  color: var(--ivory-dim);
}

.equation strong {
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 500;
}

.timeline li {
  position: relative;
  padding: 0 0 1.45rem 1.6rem;
  border-left: 1px solid var(--line);
}

.timeline li::before {
  content: "";
  position: absolute;
  top: 0.35rem;
  left: -4px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: var(--felt);
}

.timeline .numeral {
  margin-bottom: 0.25rem;
  font-size: 1.35rem;
}

.timeline h3 {
  margin-bottom: 0.3rem;
  font-size: 1.45rem;
}

.timeline p {
  font-size: 0.95rem;
}

.rules {
  margin-top: clamp(2.5rem, 5vw, 4rem);
}

.rules h3 {
  margin-bottom: 0.85rem;
  font-size: clamp(2rem, 3.4vw, 2.7rem);
}

.rules .kicker {
  margin-top: 1.35rem;
}

.rule-pair {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.75rem;
}

.rule-pair li {
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  color: var(--ivory-dim);
}

.rule-pair strong {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 500;
  line-height: 1;
}

.chart-wrap {
  margin-top: 0.9rem;
  overflow-x: auto;
}

.scroll-hint {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--faint);
  font-size: 0.95rem;
  line-height: 1.6;
}

.chart {
  width: 100%;
  min-width: 48rem;
  border-collapse: collapse;
}

.chart caption {
  margin-bottom: 0.75rem;
  caption-side: top;
  text-align: left;
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.45;
}

.chart th,
.chart td {
  padding: 0.8rem 0.85rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.chart th {
  color: var(--gold-bright);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.55;
}

.chart td {
  color: var(--ivory-dim);
  line-height: 1.65;
}

.invite {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-top: 2.5rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}

.invite p {
  max-width: 28em;
  color: var(--ivory);
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2.2vw, 1.75rem);
  font-weight: 500;
  line-height: 1.55;
}

.tips {
  display: grid;
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.tips li {
  padding: 1.35rem 1.2rem 1.45rem;
  background: var(--bg);
}

.tips .numeral {
  font-size: 2rem;
}

.reasons li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  padding: 1.05rem 0;
  border-top: 1px solid var(--line);
}

.reasons .numeral {
  margin: 0;
  font-size: 1.7rem;
  font-style: normal;
  line-height: 1.3;
}

.reasons h3 {
  font-size: 1.4rem;
  line-height: 1.45;
}

.glossary {
  border-top: 1px solid var(--line);
}

.glossary div {
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--line);
}

.glossary dt {
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.45;
}

.glossary dd {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

/* 9. Cards — playing cards and bet panels live with their sections */

/* 10. FAQ */

.faq {
  border-top: 1px solid var(--line);
}

.faq-item {
  border-bottom: 1px solid var(--line);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0;
  cursor: pointer;
  list-style: none;
}

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

.faq-item summary h3 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  line-height: 1.5;
}

.faq-item summary::after {
  content: "";
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.35rem;
  border-right: 1px solid var(--gold-bright);
  border-bottom: 1px solid var(--gold-bright);
  transform: rotate(45deg) translateY(-0.12rem);
  transition: transform var(--ease);
}

.faq-item[open] summary h3 {
  color: var(--gold-bright);
}

.faq-item[open] summary::after {
  transform: rotate(225deg) translateY(-0.12rem);
}

.faq-item p {
  max-width: 42rem;
  padding-bottom: 1.15rem;
  color: var(--muted);
}

/* 11. Final CTA */

.finale {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 28rem;
  isolation: isolate;
  overflow: hidden;
}

.finale-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center 40%;
}

.finale-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(9, 9, 8, 0.78), rgba(9, 9, 8, 0.58) 42%, rgba(9, 9, 8, 0.86));
  pointer-events: none;
}

.finale-inner {
  position: relative;
  z-index: 1;
  width: min(40rem, calc(100% - 2rem));
  margin-inline: auto;
  padding: clamp(4.5rem, 10vw, 7.5rem) 0;
  text-align: center;
}

.finale h2 {
  max-width: none;
  margin-inline: auto;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.4;
}

.finale p {
  margin-top: 1rem;
  color: var(--ivory-dim);
  font-size: 1.12rem;
}

.finale .cta-button {
  min-height: 52px;
  margin-top: 1.5rem;
  padding-inline: 1.7rem;
}

/* 12. Footer */

.site-footer {
  padding: 2.5rem 0 1.5rem;
  border-top: 1px solid var(--line);
  background: #070707;
}

.footer-grid {
  display: grid;
  gap: 1.5rem;
}

.site-footer .logo {
  margin-bottom: 0.8rem;
}

.footer-copy {
  max-width: 32rem;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.75;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
}

.footer-links button {
  min-height: 44px;
  color: var(--ivory-dim);
  font-size: 1rem;
  line-height: 1.5;
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.footer-links button:hover {
  color: var(--gold-bright);
}

.footer-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.95rem;
  line-height: 1.65;
}

.modal {
  width: min(40rem, calc(100% - 2rem));
  max-height: min(85vh, 42rem);
  overflow: auto;
  padding: clamp(1.2rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #121311;
  color: var(--ivory);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.82);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.modal h2 {
  max-width: none;
  font-size: clamp(1.7rem, 3.5vw, 2.2rem);
  line-height: 1.45;
}

.modal-close {
  border-color: var(--line);
  flex: none;
}

.modal p {
  color: var(--muted);
}

.modal p + p {
  margin-top: 0.85rem;
}

.modal a {
  color: var(--gold-bright);
  white-space: nowrap;
}

/* 13. Responsive */

@media (max-width: 480px) {
  .header-bar {
    gap: 0.4rem;
  }

  .logo {
    gap: 0.45rem;
  }

  .logo-mark {
    width: 1.35rem;
    height: 1.35rem;
  }

  .logo-text {
    font-size: 1.15rem;
  }

  .header-bar .cta-button,
  .nav-toggle {
    min-height: 44px;
    padding: 0.45rem 0.7rem;
    font-size: 0.95rem;
    letter-spacing: 0;
  }
}

@media (min-width: 560px) {
  .highlights {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 700px) {
  .container {
    width: min(var(--container), calc(100% - 3rem));
  }

  .rule-pair,
  .equations {
    grid-template-columns: 1fr 1fr;
  }

  .scroll-hint {
    display: none;
  }

  .value-row {
    grid-template-columns: 11rem 1fr;
    align-items: center;
    gap: 1.25rem;
  }
}

@media (min-width: 800px) {
  .tips {
    grid-template-columns: 1fr 1fr;
  }

  .glossary {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(5, auto);
    grid-auto-flow: column;
    column-gap: 3rem;
  }
}

@media (min-width: 900px) {
  .hero-layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    column-gap: 4rem;
    row-gap: 1.1rem;
    align-items: center;
  }

  .hero .eyebrow,
  .hero h1 {
    grid-column: 1 / -1;
  }

  .hero h1 {
    font-size: clamp(4.2rem, 9cqi, 6.5rem);
  }

  .hero-content {
    grid-column: 1;
    grid-row: 3;
  }

  .hero-media {
    grid-column: 2;
    grid-row: 3;
  }

  .split {
    grid-template-columns: 1.05fr 0.95fr;
  }

  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem 1.75rem;
  }
}

@media (min-width: 960px) {
  .nav-toggle {
    display: none;
  }

  .nav {
    display: block;
    position: static;
    margin-left: auto;
    padding: 0;
    background: none;
    border: 0;
  }

  .site-header.is-open .nav {
    display: block;
  }

  .nav ul {
    display: flex;
    align-items: center;
    gap: 0.85rem;
  }

  .nav a {
    padding: 0.4rem 0;
  }

  .header-bar .cta-button {
    margin-left: 0;
  }

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

  .footer-grid {
    grid-template-columns: 1.4fr 1fr;
    align-items: end;
  }

  .footer-links {
    justify-content: flex-end;
  }
}

@media (min-width: 800px) {
  .timeline {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem 1.25rem;
  }

  .timeline li {
    padding: 0;
    border-left: 0;
  }

  .timeline li::before {
    display: none;
  }
}

@media (min-width: 1100px) {
  .timeline {
    gap: 1.75rem 2rem;
  }
}

/* 14. Accessibility and reduced motion */

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

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

.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 25;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(12, 12, 11, 0.94);
  color: var(--gold-bright);
}

.back-to-top span {
  width: 0.55rem;
  height: 0.55rem;
  border-top: 1.5px solid currentColor;
  border-left: 1.5px solid currentColor;
  transform: translateY(0.12rem) rotate(45deg);
}

.back-to-top:hover {
  border-color: var(--gold);
  color: var(--ivory);
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .playing-card {
    transition: transform var(--ease);
  }

  .playing-card:hover {
    transform: translateY(-6px);
  }

  .bet {
    transition: transform var(--ease), border-color var(--ease);
  }

  .bet:hover {
    transform: translateY(-4px);
  }

  .hero-media img {
    animation: drift 32s ease-in-out infinite alternate;
  }
}

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

  to {
    transform: scale(1.035);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
