/*
 * Yomeru public typography contract.
 * Loaded after module styles so public text roles cannot drift through local overrides.
 * Chinese interface copy uses the UI sans stack; Japanese learning content keeps Mincho.
 */

:root {
  --type-role-navigation-size: var(--type-size-control);
  --type-role-navigation-weight: var(--type-weight-medium);
  --type-role-navigation-active-weight: var(--type-weight-semibold);
  --type-role-control-size: var(--type-size-control);
  --type-role-body-size: var(--type-size-body);
  --type-role-label-size: var(--type-size-emphasis);
  --type-role-meta-size: var(--type-size-caption);
  --type-role-section-title-size: var(--type-size-section-title);
  --type-role-page-title-size: var(--type-size-page-title);
}

/* Brand and application navigation */
.brand-text,
.hero-home-name,
.mobile-brand-wordmark {
  font-family: var(--type-font-brand) !important;
}

body:not(.first-visit) .app-sidebar .nav-item,
body:not(.first-visit) .app-sidebar .sidebar-utility-button,
body:not(.first-visit) .app-sidebar .public-account-entry {
  font-family: var(--type-font-ui-zh) !important;
  font-size: var(--type-role-navigation-size) !important;
  gap: 10px !important;
  font-weight: var(--type-role-navigation-weight) !important;
  line-height: var(--type-line-ui) !important;
  letter-spacing: 0 !important;
}

body:not(.first-visit) .app-sidebar .nav-item.active,
body:not(.first-visit) .app-sidebar .sidebar-utility-button.active,
body:not(.first-visit) .app-sidebar .public-account-entry[aria-current="page"] {
  font-weight: var(--type-role-navigation-active-weight) !important;
}

body:not(.first-visit) .app-sidebar .nav-label,
body:not(.first-visit) .app-sidebar .public-account-entry-label,
body:not(.first-visit) .app-sidebar .sidebar-utility-button > span:last-child {
  font: inherit !important;
  line-height: inherit !important;
}

body:not(.first-visit) .learning-domain-entry strong {
  font-family: var(--type-font-ui-zh) !important;
  font-size: var(--type-role-section-title-size) !important;
  font-weight: var(--type-weight-semibold) !important;
  line-height: var(--type-line-heading) !important;
  letter-spacing: 0 !important;
}

body:not(.first-visit) .global-search input {
  font-family: var(--type-font-ui-zh) !important;
  font-size: var(--type-role-control-size) !important;
  font-weight: var(--type-weight-regular) !important;
  line-height: var(--type-line-ui) !important;
}

.global-search-results b {
  font-size: var(--type-role-control-size) !important;
  font-weight: var(--type-weight-semibold) !important;
}

.global-search-results small,
.global-search-empty {
  font-size: var(--type-role-meta-size) !important;
}

/* Public controls */
.public-account-modal,
.public-account-panel {
  font-family: var(--type-font-ui-zh) !important;
}

body:not(.first-visit) button,
body:not(.first-visit) input,
body:not(.first-visit) select,
body:not(.first-visit) textarea,
body:not(.first-visit) summary {
  font-family: var(--type-font-ui-zh) !important;
}

body:not(.first-visit) input,
body:not(.first-visit) select,
body:not(.first-visit) textarea {
  font-size: var(--type-role-control-size) !important;
  line-height: var(--type-line-ui) !important;
}

/* Chinese interface hierarchy */
body:not(.first-visit) .workspace-page-head h1,
body:not(.first-visit) .workspace-page-head h2,
body:not(.first-visit) .page-title {
  font-family: var(--type-font-brand) !important;
  font-size: var(--type-role-page-title-size) !important;
  font-weight: var(--type-weight-semibold) !important;
  line-height: var(--type-line-page-title) !important;
}

body:not(.first-visit) .section-title,
body:not(.first-visit) .discover-panel-head h3,
body:not(.first-visit) .grammar-section-heading h2,
body:not(.first-visit) .settings-section-head h2 {
  font-family: var(--type-font-brand) !important;
  font-size: var(--type-role-section-title-size) !important;
  font-weight: var(--type-weight-semibold) !important;
  line-height: var(--type-line-compact) !important;
}

body:not(.first-visit) .settings-action-item strong,
body:not(.first-visit) .graded-material-card h3 {
  font-family: var(--type-font-ui-zh) !important;
  font-size: var(--type-role-label-size) !important;
  font-weight: var(--type-weight-semibold) !important;
  line-height: var(--type-line-compact) !important;
}

body:not(.first-visit) .source-directory-copy h3,
body:not(.first-visit) .vocab-library-level-title {
  font-family: var(--type-font-ui-zh) !important;
  font-size: var(--type-role-body-size) !important;
  font-weight: var(--type-weight-semibold) !important;
  line-height: var(--type-line-compact) !important;
}

body:not(.first-visit) .settings-action-item p,
body:not(.first-visit) .graded-card-summary,
body:not(.first-visit) .grammar-example-zh,
body:not(.first-visit) .grammar-explanation {
  font-family: var(--type-font-ui-zh) !important;
  font-size: var(--type-role-body-size) !important;
  line-height: var(--type-line-body) !important;
}

body:not(.first-visit) .source-directory-copy p,
body:not(.first-visit) .module-kicker,
body:not(.first-visit) .tag,
body:not(.first-visit) .badge,
body:not(.first-visit) .detail-badge,
body:not(.first-visit) .discover-panel-meta,
body:not(.first-visit) .vocab-filter-summary,
body:not(.first-visit) .vocab-table-head,
body:not(.first-visit) small {
  font-family: var(--type-font-ui-zh) !important;
  font-size: var(--type-role-meta-size) !important;
  line-height: 1.5 !important;
}

/* Japanese learning content is intentionally different from interface copy. */
#output,
#output ruby,
.detail-word,
.detail-reading-text,
.vocab-word,
.vocab-word-main,
.vocab-reading,
.flash-word,
.flash-main-word,
.flash-main-reading,
.grammar-native-title,
.grammar-continue-name,
.grammar-detail-title-row h2[lang="ja"],
.grammar-example-ja,
.gpoint-title,
.gpoint-example,
.gpoint-examples,
.grammar-book-card h3,
.grammar-book-example,
.typing-answer,
.typing-list,
.retell-sentence-row,
[lang="ja"].japanese-content {
  font-family: var(--type-font-content-ja) !important;
}

#output {
  font-size: var(--type-size-reading) !important;
  line-height: var(--type-line-reading) !important;
}

#output rt {
  font-size: 48% !important;
}

.detail-word,
.flash-main-word {
  font-size: var(--type-size-ja-term-detail) !important;
  line-height: 1.3571 !important;
}

.vocab-word,
.vocab-word-main,
.grammar-native-title,
.grammar-continue-name {
  font-size: var(--type-size-ja-term-list) !important;
  line-height: 1.4444 !important;
}

.grammar-detail-title-row h2 {
  font-size: var(--type-size-ja-grammar-title) !important;
  line-height: 1.4 !important;
}

.grammar-example-ja,
.gpoint-example,
.gpoint-examples,
.grammar-book-example {
  font-size: var(--type-size-ja-example) !important;
  line-height: var(--type-line-ja-example) !important;
}

html[lang="ja"] button,
html[lang="ja"] input,
html[lang="ja"] select,
html[lang="ja"] textarea,
html[lang="ja"] summary,
html[lang="ja"] .nav-item,
html[lang="ja"] .sidebar-utility-button,
html[lang="ja"] .public-account-entry {
  font-family: var(--type-font-ui-ja) !important;
}
