/*
 * Global typography policy
 * Text rendered at 13px or below must use font-weight 500 or below.
 * Keep this stylesheet last so it can cap component-specific emphasis rules.
 * Source declarations are also guarded by tools/audit_small_text_weight.py.
 */

/* Desktop navigation renders its labels through child copy; the anchors stay at 0px. */
html:not([data-mobile-workbench="true"]) body .sidebar .side-nav :is(
  .nav-primary[data-nav-target],
  .nav-sublist a
) {
  font-weight: 500 !important;
}

/* Shared merchant, works, account, template, and generation controls. */
html body :is(
  .agent-reference-selection > span > strong,
  .canvas-template-marketplace .ctm-sort-option[aria-selected="true"],
  .video-smart-script-card header > div > span,
  .video-remix-prompt-card header em,
  .detail-count-menu button.selected,
  .inline-model-highlight,
  .generation-credit-cost,
  #credit-redeem-panel strong,
  .affiliate-rule-grid strong,
  #affiliate-registration-reward,
  #affiliate-settlement-title,
  .account-profile-main small,
  .account-profile-main small b,
  .detail-style-recommend-badge,
  .count-discount-badge,
  .parameter-control-value,
  .video-profile-name,
  .video-profile-credit,
  .video-profile-recommended-badge
) {
  font-weight: 500 !important;
}

/* Feature workbench emphasis rules previously overrode the shared cap. */
html body.feature-focus-mode.workstation-feature-mode[data-active-feature] #task-panel#task-panel :is(
  .video-profile-recommended-badge,
  .video-profile-official-badge,
  .video-profile-credit,
  .count-discount-badge,
  .detail-style-recommend-badge,
  .video-compact-select > summary > strong,
  .video-profile-name,
  .video-profile-menu button > strong,
  .video-profile-option-title
) {
  font-weight: 500 !important;
}

/* Mobile merchant workbench. */
html[data-mobile-workbench="true"] body :is(
  #points-value,
  .mobile-merchant-tool-empty > strong,
  .mobile-merchant-shortcuts > button > strong,
  .free-page-upload-button,
  .free-page-clear-button,
  .free-page-generate-button,
  .free-page-prompt > span,
  .free-page-setting-row > span,
  .free-page-select > summary > strong,
  .free-page-select > summary > strong > span,
  .set-mode-label,
  .detail-page-module-head > span,
  .detail-page-count-label,
  .detail-reference-head > span,
  .detail-style-preset-head > span,
  .clear-upload-button,
  .library-select-button,
  .video-script-entry-button,
  .video-script-entry-button > span,
  .prompt-optimize-button,
  .generate-count-label,
  .create-button,
  .create-button > span,
  .outline-button,
  .works-toggle,
  .modal-actions button,
  #profile-member-level,
  #profile-credit-balance,
  #profile-member-expire,
  .ai-assistant-form > label,
  .ai-assistant-compose-footer button,
  .ai-assistant-compose-footer button > span
) {
  font-weight: 500 !important;
}

/* Only actual mobile and responsive public pages use the compact text scale.
 * Narrow desktop workbenches retain their desktop font sizes and emphasis. */
@media (max-width: 980px) {
  html:is([data-mobile-workbench="true"], :not(:has(.app-layout))) body :is(
    .mobile-primary-action > span,
    .nav-video-entry-copy > strong,
    #job-status,
    .free-page-upload-button,
    .free-page-clear-button,
    .free-page-generate-button,
    .free-page-prompt > span,
    .free-page-setting-row > span,
    .free-page-select > summary > strong,
    .free-page-select > summary > strong > span,
    .set-mode-label,
    .detail-page-module-head > span,
    .detail-page-count-label,
    .detail-reference-head > span,
    .detail-style-preset-head > span,
    .detail-page-module-card label span > strong,
    .detail-reference-button span > strong,
    .detail-style-preset-button > span,
    .wrinkle-strength-title,
    #extra-prompt-label,
    .experience-label,
    .clear-upload-button,
    .library-select-button,
    .video-script-entry-button,
    .video-script-entry-button > span,
    .prompt-optimize-button,
    .generate-count-label,
    .create-button,
    .create-button > span,
    .outline-button,
    .works-toggle,
    #works-summary,
    .modal-actions button,
    .ai-assistant-form > label,
    .ai-assistant-compose-footer button,
    .ai-assistant-compose-footer button > span,
    .studio-form .label-row > span,
    .studio-form .form-label,
    .growth-top-cta
  ) {
    font-weight: 500 !important;
  }

  /* Feature-focus typography carries ID-level emphasis; cap it at the same scope. */
  html:is([data-mobile-workbench="true"], :not(:has(.app-layout))) body.feature-focus-mode.workstation-feature-mode[data-active-feature] #task-panel#task-panel :is(
    .detail-page-module-card label strong,
    .detail-reference-button strong,
    .detail-style-preset-button span,
    .parameter-control-value,
    #inline-model-section > summary > strong,
    #extra-prompt-label,
    #video-script-button > span,
    #generate,
    #generate > span
  ) {
    font-weight: 500 !important;
  }
}

/* Personal mobile application. */
body.mobile-personal-page :is(
  #home-resolution-menu strong,
  .mobile-register-agreement > span,
  .mobile-register-agreement a,
  .personal-tabbar button.is-active,
  .payment-method-copy strong
) {
  font-weight: 500 !important;
}

/* Fashion growth lead form. */
html body :is(
  #lead-form > label,
  #lead-form > label > input,
  #lead-form > label > select,
  #lead-form > label > textarea,
  .floating-cta > a
) {
  font-weight: 500 !important;
}

/* Infinite canvas dialogs, overlays, and keyboard guide. */
#infinite-canvas-app :is(
  .ic-publish-template-button span,
  .ic-task-overlay button,
  .ic-template-field > span,
  .ic-template-direct strong,
  .ic-shortcut-group kbd
) {
  font-weight: 500 !important;
}

/* Infinite canvas right settings: component emphasis must respect the 13px cap. */
#infinite-canvas-app .ic-detail-page-panel :is(
  .ic-detail-style-options strong,
  .ic-detail-style-label,
  .ic-detail-style-badge,
  .ic-detail-reference-card strong,
  .ic-detail-official-button strong,
  .ic-detail-module-option strong,
  .ic-detail-batch-actions > span strong,
  .ic-detail-module-editor-heading > span:first-child strong,
  .ic-detail-card-control > strong,
  .ic-detail-card-field > span,
  .ic-detail-card-copy-head > strong,
  .ic-detail-card-auto-color,
  .ic-detail-card-copy-field > button,
  .ic-detail-card-state span
) {
  font-weight: 500 !important;
}

/* Administration overview, billing, usage, and routing panels. */
.admin-layout :is(
  .canvas-template-nav-badge,
  .overview-panel > header > div > strong,
  .billing-settlement-policy strong,
  .usage-panel > header > div > strong,
  .routing-kind-switch button span strong,
  .routing-simple-guide span strong,
  .routing-rule-sections section > header > strong,
  .routing-log-streams section > header > strong
) {
  font-weight: 500 !important;
}
