/*
 * Flowly Thai Typography System
 * Thai-native families first, with reliable Windows fallbacks for offline use.
 */

@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans+Thai:wght@400;500;600;700&family=Kanit:wght@500;600;700&family=Noto+Sans+Thai:wght@400;500;600;700&family=Noto+Serif+Thai:wght@500;600;700&display=swap");

body[data-framework-theme] {
  --font-body: "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  --font-display: "IBM Plex Sans Thai", "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, "IBM Plex Sans Thai", "Noto Sans Thai", monospace;
  font-family: var(--font-body) !important;
  font-synthesis: none;
  line-height: 1.65;
}

body[data-framework-theme] :where(
  button,
  .btn,
  input,
  select,
  textarea,
  label,
  .label,
  .nav,
  .step,
  .chip,
  .tag
) {
  font-family: var(--font-body) !important;
}

body[data-framework-theme] :where(
  h1,
  h2,
  h3,
  h4,
  .title,
  .top-title,
  .brand h1,
  .hero h1,
  .hero h2,
  .mast h1,
  .lead h2,
  .report-cover h2
) {
  font-family: var(--font-display) !important;
  font-weight: 650;
  letter-spacing: -0.015em;
}

body[data-framework-theme] :where(h1, .hero h1, .mast h1) {
  line-height: 1.22 !important;
}

body[data-framework-theme] :where(h2, h3, h4, .lead h2, .report-cover h2) {
  line-height: 1.34;
}

body[data-framework-theme] :where(
  p,
  li,
  dd,
  .lead,
  .subtitle,
  .hint,
  .note,
  .callout
) {
  line-height: 1.72;
}

body[data-framework-theme] :where(
  code,
  pre,
  .code,
  .prompt,
  .mono,
  .flow-copy,
  textarea.code
) {
  font-family: var(--font-mono) !important;
  font-variant-ligatures: none;
  line-height: 1.7;
}

body[data-framework-theme] :where(
  .amount,
  .metric,
  .stat,
  .score,
  .summary-pill,
  table
) {
  font-feature-settings: "tnum" 1, "lnum" 1;
}

/* Commercial frameworks: confident Thai display face */
body[data-framework-theme="affiliate"],
body[data-framework-theme="lead-system"] {
  --font-display: Kanit, "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  --font-body: "IBM Plex Sans Thai", "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
}

/* Technical systems: precise and compact */
body[data-framework-theme="frontend-admin"],
body[data-framework-theme="competitor-scan"],
body[data-framework-theme="meta-mcp"],
body[data-framework-theme="booking-recovery"] {
  --font-display: "IBM Plex Sans Thai", "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  --font-body: "IBM Plex Sans Thai", "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
}

/* Gentle family tools: literary headings with highly readable body copy */
body[data-framework-theme="parent-pause"],
body[data-framework-theme="story-connection"] {
  --font-display: "Noto Serif Thai", "Th Sarabun New", Tahoma, serif;
  --font-body: "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
}

/* Parent product coaching: friendly, modern, and actionable */
body[data-framework-theme="parent-product"] {
  --font-display: Kanit, "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  --font-body: "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
}

/* Creative studio: editorial title with practical UI copy */
body[data-framework-theme="printable-creator"] {
  --font-display: "Noto Serif Thai", "Th Sarabun New", Tahoma, serif;
  --font-body: "IBM Plex Sans Thai", "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
}

/* Clean digital products */
body[data-framework-theme="search-delivery"],
body[data-framework-theme="website-launch"] {
  --font-display: Kanit, "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  --font-body: "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
}

body[data-framework-theme="search-delivery"] {
  --font-display: "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
}

/* Research dossier: neutral body with analytical headings */
body[data-framework-theme="local-market"] {
  --font-display: "IBM Plex Sans Thai", "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  --font-body: "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
}

/* Premium strategy: Thai editorial serif */
body[data-framework-theme="positioning-moat"] {
  --font-display: "Noto Serif Thai", "Th Sarabun New", Tahoma, serif;
  --font-body: "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
}

@media (max-width: 760px) {
  body[data-framework-theme] :where(h1, .hero h1, .mast h1) {
    line-height: 1.28 !important;
    letter-spacing: -0.01em;
  }

  body[data-framework-theme] :where(p, li, .lead, .subtitle) {
    line-height: 1.75;
  }
}
