/* ==========================================================================
   SiamMiles — Design Tokens & Component Styles
   Palette concept: Thai temple gold + tropical Andaman teal.
   Typography: Cabinet Grotesk (display) / General Sans (body) via Fontshare.
   ========================================================================== */

:root,
[data-theme='light'] {
  /* ---- Surfaces: warm sand / ivory, evoking temple stone & sun ---- */
  --color-bg: #faf5ea;
  --color-surface: #fffcf5;
  --color-surface-2: #ffffff;
  --color-surface-offset: #f2e9d6;
  --color-surface-offset-2: #ecdfc4;
  --color-surface-dynamic: #e3d3ab;
  --color-divider: #e6d9bd;
  --color-border: #d9c79c;

  /* ---- Text: deep teal-black ink ---- */
  --color-text: #1c2b28;
  --color-text-muted: #5b6d67;
  --color-text-faint: #9aa8a2;
  --color-text-inverse: #fffcf5;

  /* ---- Primary accent: Andaman teal ---- */
  --color-primary: #0b6e6a;
  --color-primary-hover: #085651;
  --color-primary-active: #063e3b;
  --color-primary-highlight: #cfe6e2;

  /* ---- Gold accent: temple gold (secondary emphasis, sparingly) ---- */
  --color-gold: #b8862c;
  --color-gold-hover: #96701f;
  --color-gold-active: #765716;
  --color-gold-highlight: #f0e0bb;

  /* ---- Warning: saffron/terracotta ---- */
  --color-warning: #a15321;
  --color-warning-hover: #7c3f18;
  --color-warning-active: #582c10;
  --color-warning-highlight: #edd6c3;

  /* ---- Error: orchid maroon ---- */
  --color-error: #a12c4f;
  --color-error-hover: #7d2140;
  --color-error-active: #591730;
  --color-error-highlight: #e6ccd6;

  /* ---- Success: rice-paddy green ---- */
  --color-success: #3f7a3a;
  --color-success-hover: #2d5c29;
  --color-success-active: #1f401c;
  --color-success-highlight: #d3e3d0;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Shadows — tone-matched warm */
  --shadow-sm: 0 1px 2px oklch(0.3 0.05 150 / 0.08);
  --shadow-md: 0 6px 16px oklch(0.3 0.05 150 / 0.1);
  --shadow-lg: 0 16px 40px oklch(0.3 0.05 150 / 0.16);

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1180px;
  --content-full: 100%;

  /* Fonts */
  --font-display: 'Cabinet Grotesk', 'Noto Sans Thai', 'General Sans', system-ui, sans-serif;
  --font-body: 'General Sans', 'Noto Sans Thai', -apple-system, sans-serif;

  color-scheme: light;
}

[data-theme='dark'] {
  --color-bg: #101a18;
  --color-surface: #152522;
  --color-surface-2: #1a2b27;
  --color-surface-offset: #1d302b;
  --color-surface-offset-2: #23392f;
  --color-surface-dynamic: #2b463a;
  --color-divider: #294038;
  --color-border: #34534a;

  --color-text: #eef2ee;
  --color-text-muted: #a4b6ae;
  --color-text-faint: #6d857c;
  --color-text-inverse: #101a18;

  --color-primary: #3ec9bd;
  --color-primary-hover: #6bdcd1;
  --color-primary-active: #94e7de;
  --color-primary-highlight: #1d3e3a;

  --color-gold: #e8b955;
  --color-gold-hover: #f0ca79;
  --color-gold-active: #f6dba2;
  --color-gold-highlight: #3a2f18;

  --color-warning: #e08a4e;
  --color-warning-hover: #e9a170;
  --color-warning-active: #f0b58f;
  --color-warning-highlight: #3d2a1a;

  --color-error: #e07398;
  --color-error-hover: #e891ae;
  --color-error-active: #efadc2;
  --color-error-highlight: #3c2028;

  --color-success: #7fc47a;
  --color-success-hover: #9bd396;
  --color-success-active: #b6e0b2;
  --color-success-highlight: #1f3320;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-md: 0 6px 16px oklch(0 0 0 / 0.35);
  --shadow-lg: 0 16px 40px oklch(0 0 0 / 0.5);

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #101a18;
    --color-surface: #152522;
    --color-surface-2: #1a2b27;
    --color-surface-offset: #1d302b;
    --color-surface-offset-2: #23392f;
    --color-surface-dynamic: #2b463a;
    --color-divider: #294038;
    --color-border: #34534a;
    --color-text: #eef2ee;
    --color-text-muted: #a4b6ae;
    --color-text-faint: #6d857c;
    --color-text-inverse: #101a18;
    --color-primary: #3ec9bd;
    --color-primary-hover: #6bdcd1;
    --color-primary-active: #94e7de;
    --color-primary-highlight: #1d3e3a;
    --color-gold: #e8b955;
    --color-gold-hover: #f0ca79;
    --color-gold-highlight: #3a2f18;
    --color-warning: #e08a4e;
    --color-warning-highlight: #3d2a1a;
    --color-error: #e07398;
    --color-error-highlight: #3c2028;
    --color-success: #7fc47a;
    --color-success-highlight: #1f3320;
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
    --shadow-md: 0 6px 16px oklch(0 0 0 / 0.35);
    --shadow-lg: 0 16px 40px oklch(0 0 0 / 0.5);
    color-scheme: dark;
  }
}

/* ---- Type scale (fluid clamp) ---- */
:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.25rem);
  --text-3xl: clamp(2.4rem, 1rem + 4vw, 4.5rem);

  /* 4px spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;
}

/* ==========================================================================
   Layout primitives
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container--narrow {
  max-width: var(--content-narrow);
}
.container--default {
  max-width: var(--content-default);
}

main {
  display: block;
}

section {
  padding-block: clamp(var(--space-12), 7vw, var(--space-24));
}

.section-tight {
  padding-block: clamp(var(--space-8), 4vw, var(--space-12));
}

/* ==========================================================================
   Skip link
   ========================================================================== */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  z-index: 200;
  font-weight: 600;
  font-size: var(--text-sm);
}
.skip-link:focus {
  top: var(--space-4);
}

/* ==========================================================================
   Header / Nav
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: oklch(from var(--color-bg) l c h / 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--color-divider);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding-block: var(--space-4);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--color-text);
  flex-shrink: 0;
}

.brand-logo {
  width: 36px;
  height: 36px;
  color: var(--color-primary);
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.main-nav ul {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
  list-style: none;
}

.main-nav a {
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
}

.main-nav a:hover,
.main-nav a[aria-current='page'] {
  color: var(--color-primary);
  background: var(--color-primary-highlight);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  background: var(--color-surface);
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ---- Language switcher ---- */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-full);
  padding: 3px;
  flex-shrink: 0;
}

.lang-switch button {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-muted);
  min-height: 32px;
  white-space: nowrap;
  line-height: 1;
}

.lang-switch button[aria-pressed='true'] {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

.lang-switch button:hover:not([aria-pressed='true']) {
  color: var(--color-primary);
}

@media (max-width: 400px) {
  .lang-switch button {
    padding: var(--space-1) var(--space-2);
  }
}

/* ==========================================================================
   Language gate modal
   ========================================================================== */
.lang-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: oklch(from var(--color-bg) l c h / 0.92);
  backdrop-filter: blur(6px);
}

.lang-gate.is-visible {
  display: flex;
}

.lang-gate-card {
  width: 100%;
  max-width: 480px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: clamp(var(--space-8), 5vw, var(--space-10));
  text-align: center;
}

.lang-gate-eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-gold-hover);
  margin-bottom: var(--space-4);
}
[data-theme='dark'] .lang-gate-eyebrow {
  color: var(--color-gold);
}

.lang-gate-card h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-3);
}

.lang-gate-card > p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-8);
}

.lang-gate-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

@media (max-width: 480px) {
  .lang-gate-options {
    grid-template-columns: 1fr;
  }
}

.lang-gate-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  min-height: 96px;
}

.lang-gate-option:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-highlight);
}

.lang-gate-option .flag {
  font-size: var(--text-xl);
  line-height: 1;
}

.lang-gate-option .name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--color-text);
}

.lang-gate-option .sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  background: var(--color-surface);
}

@media (max-width: 860px) {
  .nav-toggle {
    display: flex;
  }
  .main-nav {
    position: fixed;
    inset: 64px var(--space-4) auto var(--space-4);
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-4);
    flex-direction: column;
    align-items: stretch;
    display: none;
  }
  .main-nav.is-open {
    display: flex;
  }
  .main-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-1);
  }
  .main-nav a {
    padding: var(--space-3) var(--space-4);
  }
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  min-height: 44px;
  line-height: 1;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
}
.btn-primary:active {
  background: var(--color-primary-active);
}

.btn-secondary {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-gold {
  background: var(--color-gold);
  color: #241a06;
}
.btn-gold:hover {
  background: var(--color-gold-hover);
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative;
  padding-block: clamp(var(--space-16), 9vw, var(--space-32)) clamp(var(--space-10), 6vw, var(--space-16));
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-12);
  align-items: center;
}

@media (max-width: 960px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-gold-hover);
  background: var(--color-gold-highlight);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-6);
}

[data-theme='dark'] .hero-eyebrow {
  color: var(--color-gold);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin-bottom: var(--space-5);
}

.hero h1 em {
  font-style: normal;
  color: var(--color-primary);
}

.hero-sub {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 56ch;
  margin-bottom: var(--space-8);
}

.hero-actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  gap: var(--space-8);
  margin-top: var(--space-10);
  flex-wrap: wrap;
}

.hero-stat-num {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
}

.hero-stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.hero-art {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-art svg {
  width: 100%;
  height: 100%;
}

/* ==========================================================================
   Calculator card
   ========================================================================== */
.calculator {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: clamp(var(--space-6), 4vw, var(--space-10));
  margin-top: calc(-1 * clamp(var(--space-8), 5vw, var(--space-16)));
  position: relative;
  z-index: 2;
}

.calc-tabs {
  display: flex;
  gap: var(--space-2);
  background: var(--color-surface-offset);
  border-radius: var(--radius-full);
  padding: var(--space-1);
  margin-bottom: var(--space-8);
  max-width: fit-content;
}

.calc-tab {
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  min-height: 40px;
}

.calc-tab[aria-selected='true'] {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

.calc-panel {
  display: none;
}
.calc-panel.is-active {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field-full {
  grid-column: 1 / -1;
}

.field label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.field .hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.field input,
.field select {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-base);
  min-height: 48px;
  width: 100%;
}

.field input:focus,
.field select:focus {
  border-color: var(--color-primary);
}

.field select:disabled,
.field input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.calc-submit-row {
  margin-top: var(--space-8);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.calc-result {
  margin-top: var(--space-8);
  padding-top: var(--space-8);
  border-top: 1px dashed var(--color-border);
  display: none;
}

.calc-result.is-visible {
  display: block;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

@media (max-width: 720px) {
  .result-grid {
    grid-template-columns: 1fr;
  }
}

.result-card {
  background: var(--color-surface-offset);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.result-card .label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.result-card .value {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  word-break: break-word;
}

.result-card.highlight {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.result-card.highlight .label {
  color: oklch(from var(--color-text-inverse) l c h / 0.75);
}
.result-card.highlight .value {
  color: var(--color-text-inverse);
}

.verdict {
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  line-height: 1.55;
  border: 1px solid var(--color-border);
}

.verdict strong {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}

.verdict.verdict-good {
  background: var(--color-success-highlight);
  border-color: color-mix(in oklab, var(--color-success) 40%, transparent);
}
.verdict.verdict-good strong {
  color: var(--color-success);
}

.verdict.verdict-caution {
  background: var(--color-warning-highlight);
  border-color: color-mix(in oklab, var(--color-warning) 40%, transparent);
}
.verdict.verdict-caution strong {
  color: var(--color-warning);
}

.verdict.verdict-poor {
  background: var(--color-error-highlight);
  border-color: color-mix(in oklab, var(--color-error) 40%, transparent);
}
.verdict.verdict-poor strong {
  color: var(--color-error);
}

.calc-footnote {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-6);
  line-height: 1.5;
}

.caveat-box {
  display: none;
  margin-top: var(--space-5);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--color-warning-highlight);
  border: 1px solid color-mix(in oklab, var(--color-warning) 45%, transparent);
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.55;
}
.caveat-box.is-visible {
  display: block;
}
.caveat-box strong {
  color: var(--color-warning);
}

/* ==========================================================================
   Generic sections / cards
   ========================================================================== */
.section-head {
  max-width: 68ch;
  margin-bottom: var(--space-10);
}

.eyebrow {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
  display: block;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-3);
}

.section-head p {
  color: var(--color-text-muted);
  font-size: var(--text-base);
}

.program-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-6);
}

.program-card {
  position: relative;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  overflow: hidden;
  transition: transform var(--transition-interactive), box-shadow var(--transition-interactive),
    border-color var(--transition-interactive);
}

.program-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--color-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-interactive);
}

.program-card-transition::before {
  background: var(--color-warning);
}

.program-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary);
}

.program-card-transition:hover {
  border-color: var(--color-warning);
}

.program-card:hover::before {
  transform: scaleX(1);
}

.program-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-md);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  flex-shrink: 0;
}

.program-card-icon svg {
  width: 1.4rem;
  height: 1.4rem;
}

.program-card-transition .program-card-icon {
  background: var(--color-warning-highlight);
  color: var(--color-warning);
}

.program-card .chip {
  align-self: flex-start;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  background: var(--color-gold-highlight);
  color: var(--color-gold-hover);
}
[data-theme='dark'] .program-card .chip {
  color: var(--color-gold);
}
.program-card-transition .chip {
  background: var(--color-warning-highlight);
  color: var(--color-warning-hover);
}
[data-theme='dark'] .program-card-transition .chip {
  color: var(--color-warning);
}

.program-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
}

.program-card p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.program-card .ratio {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-primary);
  font-weight: 700;
}

/* ==========================================================================
   Prose (guide, privacy, disclosure, about)
   ========================================================================== */
.prose {
  max-width: 72ch;
  counter-reset: guide-step;
}

.prose h1 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
}

.prose .lede {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  margin-bottom: var(--space-8);
}

.prose h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  margin-top: var(--space-12);
  margin-bottom: var(--space-4);
}

.prose h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}

.prose p {
  margin-bottom: var(--space-5);
  color: var(--color-text);
}

.prose ul,
.prose ol {
  margin-bottom: var(--space-5);
  padding-left: var(--space-6);
}

.prose li {
  margin-bottom: var(--space-2);
}

.prose a {
  color: var(--color-primary);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.prose blockquote {
  border-left: 3px solid var(--color-gold);
  padding-left: var(--space-5);
  margin: var(--space-8) 0;
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--color-text-muted);
}

.guide-step {
  position: relative;
  isolation: isolate;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-8) var(--space-2);
  margin: var(--space-10) 0;
  overflow: hidden;
  counter-increment: guide-step;
}

.guide-step::before {
  content: counter(guide-step, decimal-leading-zero);
  position: absolute;
  top: -0.4em;
  right: var(--space-6);
  font-family: var(--font-display);
  font-size: 6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--color-primary-highlight);
  z-index: -1;
  user-select: none;
}

.guide-step-transition::before {
  color: var(--color-warning-highlight);
}

.guide-step h2 {
  margin-top: 0;
  padding-right: 3.5rem;
}

.guide-step .calc-footnote {
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
}

[data-theme='dark'] .guide-step::before {
  opacity: 0.55;
}

@media (max-width: 640px) {
  .guide-step {
    padding: var(--space-6) var(--space-5) var(--space-2);
  }
  .guide-step::before {
    font-size: 3.5rem;
  }
}

.prose .callout {
  background: var(--color-surface-offset);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin: var(--space-8) 0;
}

.prose .callout p:last-child {
  margin-bottom: 0;
}

.meta-row {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-bottom: var(--space-8);
}

.sources-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.sources-list li {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  padding-left: var(--space-5);
  position: relative;
}

.sources-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--color-text-faint);
}

/* ==========================================================================
   Tables (compare.html)
   ========================================================================== */
.table-wrap {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
}

.table-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2.5rem;
  pointer-events: none;
  background: linear-gradient(to right, transparent, var(--color-surface-2) 92%);
  opacity: 1;
  transition: opacity var(--transition-interactive);
}

.table-wrap.is-scrolled-end::after {
  opacity: 0;
}

.table-scroll-hint {
  display: none;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-3);
}

@media (max-width: 860px) {
  .table-scroll-hint {
    display: flex;
  }
}

.compare-table {
  min-width: 860px;
}

.compare-table th,
.compare-table td {
  text-align: left;
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: top;
}

.compare-table th {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  background: var(--color-surface-offset);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.compare-table td.program-name {
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
}

.compare-table tr:last-child td {
  border-bottom: none;
}

.compare-table sup a {
  color: var(--color-primary);
  text-decoration: none;
}

/* ==========================================================================
   FAQ accordion
   ========================================================================== */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: var(--content-default);
}

.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  overflow: hidden;
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  text-align: left;
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  min-height: 44px;
}

.faq-question .icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: var(--color-primary);
  transition: transform var(--transition-interactive);
}

.faq-question[aria-expanded='true'] .icon {
  transform: rotate(45deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-answer-inner {
  padding: 0 var(--space-6) var(--space-6);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.65;
}

.faq-answer-inner a {
  color: var(--color-primary);
}

.faq-answer-inner ul {
  padding-left: var(--space-5);
  margin-top: var(--space-2);
}

/* ==========================================================================
   Contact form
   ========================================================================== */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-width: 560px;
}

.contact-form textarea {
  resize: vertical;
  min-height: 140px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-base);
}

.form-note {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--color-surface-offset);
  border-top: 1px solid var(--color-divider);
  margin-top: clamp(var(--space-16), 8vw, var(--space-24));
}

.footer-inner {
  padding-block: var(--space-16) var(--space-10);
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--space-10);
}

@media (max-width: 860px) {
  .footer-inner {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 540px) {
  .footer-inner {
    grid-template-columns: 1fr;
  }
}

.footer-brand .brand {
  margin-bottom: var(--space-4);
}

.footer-brand p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  max-width: 42ch;
}

.footer-col h4 {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-faint);
  margin-bottom: var(--space-4);
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  list-style: none;
}

.footer-col a {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
}
.footer-col a:hover {
  color: var(--color-primary);
}

.footer-disclaimer {
  border-top: 1px solid var(--color-divider);
  padding-block: var(--space-6);
}

.footer-disclaimer p {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  line-height: 1.6;
  max-width: none;
}

.footer-bottom {
  border-top: 1px solid var(--color-divider);
  padding-block: var(--space-5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

/* ==========================================================================
   Consent banner (CMP-style)
   ========================================================================== */
.consent-banner {
  position: fixed;
  left: var(--space-4);
  right: var(--space-4);
  bottom: var(--space-4);
  max-width: 560px;
  margin-inline: auto;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-6);
  z-index: 300;
  transform: translateY(140%);
  transition: transform 360ms cubic-bezier(0.16, 1, 0.3, 1);
}

.consent-banner.is-visible {
  transform: translateY(0);
}

.consent-banner h2 {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.consent-banner p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.consent-banner a {
  color: var(--color-primary);
}

.consent-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.consent-actions .btn {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

.consent-manage-panel {
  display: none;
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-divider);
}
.consent-manage-panel.is-visible {
  display: block;
}

.consent-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-2);
  font-size: var(--text-sm);
}

.consent-option .toggle {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--color-border);
  flex-shrink: 0;
}

.consent-option .toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-surface-2);
  transition: transform var(--transition-interactive);
}

.consent-option .toggle[aria-checked='true'] {
  background: var(--color-primary);
}
.consent-option .toggle[aria-checked='true']::after {
  transform: translateX(18px);
}

.consent-option.is-locked .toggle {
  opacity: 0.6;
}

/* ==========================================================================
   Misc / utility
   ========================================================================== */
.badge-row {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-6);
}

.badge {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.ad-slot {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  background: var(--color-surface-offset);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
  align-items: start;
}

@media (max-width: 860px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

.stat-card-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}
@media (max-width: 720px) {
  .stat-card-row {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.stat-card .num {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-gold-hover);
}
[data-theme='dark'] .stat-card .num {
  color: var(--color-gold);
}

.stat-card .desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

.pill-list {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.text-center {
  text-align: center;
}

/* ==========================================================================
   Thai language rendering adjustments
   ========================================================================== */
:lang(th) {
  line-height: 1.7;
}

html[lang='th'] .hero h1,
html[lang='th'] .lang-gate-card h2,
html[lang='th'] .consent-banner h2 {
  line-height: 1.4;
}

html[lang='th'] .calc-tab,
html[lang='th'] .btn,
html[lang='th'] .lang-switch button,
html[lang='th'] .main-nav a {
  word-break: keep-all;
}

/* Prevent flash of untranslated content while i18n.js applies strings */
[data-i18n], [data-i18n-attr] {
  transition: none;
}

html:not([data-i18n-ready]) body {
  visibility: hidden;
}

html[data-i18n-ready] body {
  visibility: visible;
}
