/**
 * Product typography — dual font (IRANYekanX | Yekan Bakh FaNum).
 * Optical scales tuned for dense RTL admin UI; switch via html[data-font].
 */

:root,
html[data-font="iran-yekan-x"] {
  --tt-font: "IRANYekanX", Tahoma, sans-serif;
  --tt-font-feature: "ss02";

  /* Size scale (dashboard density) */
  --tt-fs-meta: 0.75rem;      /* 12px — badges, chips */
  --tt-fs-label: 0.8125rem;   /* 13px — field labels, hints */
  --tt-fs-body: 0.9375rem;    /* 15px — body, tables */
  --tt-fs-section: 1.0625rem; /* 17px — panel titles */
  --tt-fs-title: 1.25rem;     /* 20px — page title */
  --tt-fs-display: 1.375rem;  /* 22px — rare H1 emphasis */

  /* Weight roles (VF-friendly) */
  --tt-fw-light: 300;
  --tt-fw-body: 400;
  --tt-fw-medium: 500;
  --tt-fw-semibold: 600;
  --tt-fw-bold: 700;
  --tt-fw-heavy: 800;

  /* Leading */
  --tt-lh-tight: 1.25;
  --tt-lh-snug: 1.4;
  --tt-lh-body: 1.7;
  --tt-lh-loose: 1.85;

  /* Tracking (Persian UI stays near 0) */
  --tt-tracking: 0;
}

/* Yekan Bakh reads slightly larger/heavier — compensate optically */
html[data-font="yekan-bakh"] {
  --tt-font: "Yekan Bakh FaNum", Tahoma, sans-serif;
  --tt-font-feature: normal; /* FaNum VF already has Persian digits */

  --tt-fs-meta: 0.72rem;
  --tt-fs-label: 0.8rem;
  --tt-fs-body: 0.9rem;
  --tt-fs-section: 1.025rem;
  --tt-fs-title: 1.2rem;
  --tt-fs-display: 1.325rem;

  --tt-fw-light: 300;
  --tt-fw-body: 400;
  --tt-fw-medium: 500;
  --tt-fw-semibold: 600;
  --tt-fw-bold: 650;
  --tt-fw-heavy: 750;

  --tt-lh-tight: 1.22;
  --tt-lh-snug: 1.38;
  --tt-lh-body: 1.65;
  --tt-lh-loose: 1.8;
}

/* —— Global application —— */
html body,
html body option,
html body select {
  font-family: var(--tt-font) !important;
  font-size: var(--tt-fs-body);
  font-weight: var(--tt-fw-body);
  line-height: var(--tt-lh-body);
  letter-spacing: var(--tt-tracking);
  -moz-font-feature-settings: var(--tt-font-feature);
  -webkit-font-feature-settings: var(--tt-font-feature);
  font-feature-settings: var(--tt-font-feature);
}

html[data-font="iran-yekan-x"] body,
html[data-font="iran-yekan-x"] option,
html[data-font="iran-yekan-x"] select {
  font-family: "IRANYekanX", font-primary, Tahoma, sans-serif !important;
}

html[data-font="yekan-bakh"] body,
html[data-font="yekan-bakh"] option,
html[data-font="yekan-bakh"] select {
  font-family: "Yekan Bakh FaNum", font-primary, Tahoma, sans-serif !important;
}

/* Headings — size + weight roles */
html h1,
html .h1 {
  font-size: var(--tt-fs-display);
  line-height: var(--tt-lh-tight);
  letter-spacing: var(--tt-tracking);
}

html h2,
html .h2 {
  font-size: var(--tt-fs-title);
  line-height: var(--tt-lh-snug);
}

html h3,
html .h3,
html h4,
html .h4,
html h5,
html .h5 {
  font-size: var(--tt-fs-section);
  line-height: var(--tt-lh-snug);
}

html h6,
html .h6 {
  font-size: var(--tt-fs-body);
  line-height: var(--tt-lh-snug);
}

html p,
html table {
  font-size: var(--tt-fs-body);
  line-height: var(--tt-lh-body) !important;
}

html small,
.tt-page-subtitle,
.form-text,
.text-muted {
  font-size: var(--tt-fs-label);
  line-height: var(--tt-lh-snug);
}

.tt-page-header h1,
.tt-page-header .tt-page-title {
  font-size: var(--tt-fs-title);
  font-weight: var(--tt-fw-semibold);
  line-height: var(--tt-lh-snug);
}

.menu-vertical .menu-item .menu-link,
.dropdown-item,
.nav-link {
  font-size: var(--tt-fs-label);
  line-height: var(--tt-lh-snug);
}

.btn {
  font-size: var(--tt-fs-label);
  font-weight: var(--tt-fw-medium);
  line-height: var(--tt-lh-snug);
}

.form-label,
.col-form-label {
  font-size: var(--tt-fs-label);
  font-weight: var(--tt-fw-medium);
  line-height: var(--tt-lh-snug);
}

.form-control,
.form-select {
  font-size: var(--tt-fs-body);
  line-height: var(--tt-lh-snug);
}

.badge,
.tt-fs-meta {
  font-size: var(--tt-fs-meta);
  font-weight: var(--tt-fw-medium);
  line-height: var(--tt-lh-tight);
}

/* Font preview cards on profile */
.tt-font-preview {
  display: grid;
  gap: var(--tt-space-2);
  margin-top: var(--tt-space-2);
}

.tt-font-choice {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--tt-line);
  border-radius: var(--tt-radius);
  background: var(--tt-panel);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tt-font-choice:hover {
  border-color: var(--tt-line-strong);
}

.tt-font-choice:has(input:checked),
.tt-font-choice.is-selected {
  border-color: var(--tt-accent);
  box-shadow: var(--tt-focus);
}

.tt-font-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tt-font-choice-name {
  font-size: var(--tt-fs-section);
  font-weight: var(--tt-fw-semibold);
  color: var(--tt-ink);
  line-height: var(--tt-lh-snug);
}

.tt-font-choice-sample {
  font-size: var(--tt-fs-body);
  color: var(--tt-muted);
  line-height: var(--tt-lh-body);
}

.tt-font-choice[data-preview="iran-yekan-x"] .tt-font-choice-name,
.tt-font-choice[data-preview="iran-yekan-x"] .tt-font-choice-sample {
  font-family: "IRANYekanX", Tahoma, sans-serif;
  font-feature-settings: "ss02";
}

.tt-font-choice[data-preview="yekan-bakh"] .tt-font-choice-name,
.tt-font-choice[data-preview="yekan-bakh"] .tt-font-choice-sample {
  font-family: "Yekan Bakh FaNum", Tahoma, sans-serif;
}
