/*
 * Croplod Font System
 * Persian -> Dana | Latin/English -> Product Sans
 * Smart language detection via CSS selectors
 */

/* ============================================================
   @font-face — Dana (Persian)
   ============================================================ */

@font-face {
    font-family: 'Dana';
    src: url('/static/fonts/dana/Dana-Thin.ttf') format('truetype');
    font-weight: 100;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Dana';
    src: url('/static/fonts/dana/Dana-UltraLight.ttf') format('truetype');
    font-weight: 200;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Dana';
    src: url('/static/fonts/dana/Dana-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Dana';
    src: url('/static/fonts/dana/Dana-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Dana';
    src: url('/static/fonts/dana/Dana-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Dana';
    src: url('/static/fonts/dana/Dana-DemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Dana';
    src: url('/static/fonts/dana/Dana-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Dana';
    src: url('/static/fonts/dana/Dana-ExtraBold.ttf') format('truetype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Dana';
    src: url('/static/fonts/dana/Dana-Black.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

/* ============================================================
   @font-face — Product Sans (English/Latin)
   ============================================================ */

@font-face {
    font-family: 'Product Sans';
    src: url('/static/fonts/productsans/ProductSans-Thin.ttf') format('truetype');
    font-weight: 100;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Product Sans';
    src: url('/static/fonts/productsans/ProductSans-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Product Sans';
    src: url('/static/fonts/productsans/ProductSans-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Product Sans';
    src: url('/static/fonts/productsans/ProductSans-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Product Sans';
    src: url('/static/fonts/productsans/ProductSans-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Product Sans';
    src: url('/static/fonts/productsans/ProductSans-Black.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

/* ============================================================
   Font Rules — Default: Dana for Persian text
   ============================================================ */

/*
 * Base: Dana for all Persian text
 */
html, body, div, span, h1, h2, h3, h4, h5, h6,
p, a, em, strong, small, sub, sup,
label, button, select, textarea,
header, nav, main, footer, section, article, aside,
ul, ol, li, dl, dt, dd,
table, thead, tbody, tfoot, tr, th, td,
form, fieldset, legend,
details, summary, figure, figcaption,
blockquote, cite, q,
abbr, dfn, mark, time,
bdi, bdo, ruby, rt, rp,
wbr, pre, code, kbd, samp, var,
address, hr,
.card, .card-title, .card-body, .card-header, .card-footer,
.list-item, .list-item-title, .list-item-desc, .list-item-icon,
.account-card, .account-card-title, .account-card-header,
.account-page-title, .account-page-subtitle,
.account-sidebar-link, .account-sidebar-section,
.account-header-brand-name, .account-header-brand-sub,
.stat-card-label,
.info-row-label,
.auth-logo h1, .auth-logo p, .auth-footer, .auth-divider,
.form-label, .form-hint, .form-error,
.badge, .badge-primary, .badge-success, .badge-error, .badge-warning,
.empty-state-title, .empty-state-desc,
.toast,
.account-profile-name, .account-profile-email,
.btn, .btn-primary, .btn-secondary, .btn-ghost, .btn-danger, .btn-sm, .btn-lg,
.account-chip,
.account-search-input,
.account-dropdown, .account-header-dropdown-item,
.theme-toggle,
.account-header-action-btn,
.account-header-avatar {
    font-family: 'Dana', 'Tahoma', sans-serif;
}

/*
 * Product Sans for English/Latin content:
 * Usernames (@username), emails, Croplod IDs, wallet IDs,
 * URLs, phone numbers, OTP/TFA/recovery codes, technical identifiers,
 * all form inputs (users type Latin in them)
 */
[dir="ltr"],
code, kbd, pre, samp, var,
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="text"],
input:not([type]),
select,
textarea,
.form-input,
.form-textarea,
.form-select,
.badge,
.stat-card-value,
.info-row-value,
.account-profile-email,
.account-search-input,
.account-chip,
input[type="checkbox"],
input[type="radio"],
.code-input,
.auth-email-display strong,
.auth-password-strength-text,
.pm-topbar-email,
.pm-account-email,
.account-username,
.account-croplod-id,
.account-email {
    font-family: 'Product Sans', 'Dana', sans-serif;
}

/*
 * Dynamic font detection classes (applied by JS)
 * .font-persian = Dana
 * .font-latin = Product Sans
 */
.font-persian {
    font-family: 'Dana', 'Tahoma', sans-serif;
}

.font-latin {
    font-family: 'Product Sans', 'Dana', sans-serif;
}

/*
 * Typography scale for consistent sizing
 */
h1 { font-size: var(--font-size-3xl); font-weight: var(--font-weight-bold); line-height: var(--line-height-tight); letter-spacing: var(--letter-spacing-tight); }
h2 { font-size: var(--font-size-2xl); font-weight: var(--font-weight-bold); line-height: var(--line-height-tight); letter-spacing: var(--letter-spacing-tight); }
h3 { font-size: var(--font-size-xl); font-weight: var(--font-weight-semibold); line-height: var(--line-height-tight); }
h4 { font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold); line-height: var(--line-height-normal); }
h5 { font-size: var(--font-size-base); font-weight: var(--font-weight-medium); line-height: var(--line-height-normal); }
h6 { font-size: var(--font-size-sm); font-weight: var(--font-weight-medium); line-height: var(--line-height-normal); }

p { line-height: var(--line-height-relaxed); }
small { font-size: var(--font-size-xs); }

/* Responsive typography */
@media (max-width: 639px) {
    h1 { font-size: var(--font-size-2xl); }
    h2 { font-size: var(--font-size-xl); }
    h3 { font-size: var(--font-size-lg); }
    h4 { font-size: var(--font-size-base); }
}
