/*
 * Site-wide three-tier typography system.
 *
 * Text uses only large, medium and small sizes. Pure glyph icons, emoji and
 * elements that intentionally use font-size: 0 keep their geometric sizing.
 */
:root {
  --fyg-font-large: 24px;
  --fyg-font-medium: 15px;
  --fyg-font-small: 12px;
  --fyg-line-large: 1.35;
  --fyg-line-medium: 1.55;
  --fyg-line-small: 1.6;
}

@media (max-width: 680px) {
  :root {
    --fyg-font-large: 20px;
    --fyg-font-medium: 14px;
    --fyg-font-small: 12px;
  }
}

html body:not(#fyg-typography-disabled) {
  --fyg-current-font: var(--fyg-font-medium);
  --fyg-current-line: var(--fyg-line-medium);
  font-size: var(--fyg-font-medium) !important;
  line-height: var(--fyg-line-medium) !important;
}

/* User and administrator workspaces switch to the mobile tier with their 900px layout. */
@media (max-width: 900px) {
  html body:not(#fyg-typography-disabled).dashboard-body,
  html body:not(#fyg-typography-disabled):has(.fyg-dashboard-shell) {
    --fyg-font-large: 20px;
    --fyg-font-medium: 14px;
    --fyg-font-small: 12px;
    --fyg-current-font: var(--fyg-font-medium);
    --fyg-current-line: var(--fyg-line-medium);
  }

  html body:not(#fyg-typography-disabled) .fyg-dashboard-shell {
    --fyg-font-large: 20px;
    --fyg-font-medium: 14px;
    --fyg-font-small: 12px;
    --fyg-current-font: var(--fyg-font-medium);
    --fyg-current-line: var(--fyg-line-medium);
    font-size: var(--fyg-font-medium) !important;
    line-height: var(--fyg-line-medium) !important;
  }
}

/* Normalize every textual HTML box. Classes containing "icon" retain icon geometry. */
html body:not(#fyg-typography-disabled) :where(
  main, header, footer, nav, aside, section, article, div, form, fieldset, legend,
  details, summary, table, caption, thead, tbody, tfoot, tr, th, td,
  h1, h2, h3, h4, h5, h6, p, a, span, strong, b, em, i, u, s, del, mark,
  ul, ol, li, dl, dt, dd, blockquote, figcaption, small, time, sup, sub,
  label, input, textarea, select, option, output, button, pre, code
):not([class*="icon"]) {
  font-size: var(--fyg-current-font, var(--fyg-font-medium)) !important;
  line-height: var(--fyg-current-line, var(--fyg-line-medium)) !important;
}

/* Section headings, cards, navigation, body copy and form controls use medium. */
html body:not(#fyg-typography-disabled) :where(
  h2, h3, h4, h5, h6, legend, label, input, textarea, select, option, output,
  button, [role="button"]
) {
  --fyg-current-font: var(--fyg-font-medium);
  --fyg-current-line: var(--fyg-line-medium);
}

/* The homepage feed heading is intentionally one pixel above the normal section-title size. */
html body:not(#fyg-typography-disabled) #latestTitle {
  font-size: calc(var(--fyg-font-medium) + 1px) !important;
  line-height: var(--fyg-line-medium) !important;
}

html body:not(#fyg-typography-disabled) :where(
  h2, h3, h4, h5, h6, p, li, dt, dd, blockquote, figcaption, td, pre, code
) {
  line-height: var(--fyg-current-line, var(--fyg-line-medium)) !important;
}

/* Metadata, dates, labels, hints, tags, statuses, pagination and footer copy use small. */
html body:not(#fyg-typography-disabled) :where(
  small, time, caption, sup, sub, thead, th,
  [class*="__meta"], [class*="-meta"],
  [class*="__hint"], [class*="-hint"],
  [class*="__note"], [class*="-note"],
  [class*="__tip"], [class*="-tip"],
  [class*="__badge"], [class*="-badge"],
  [class*="__status"], [class*="-status"],
  [class*="__pager"], [class*="-pager"], [class*="pagination"],
  [class*="__footer"], [class*="-footer"], [class*="copyright"],
  [class*="__muted"], [class*="-muted"],
  [class*="__subtitle"], [class*="-subtitle"],
  [class*="__byline"], [class*="-byline"],
  [class*="__date"], [class*="-date"],
  [class*="__time"], [class*="-time"],
  [class*="__author"], [class*="-author"],
  [class*="__views"], [class*="-views"],
  [class*="__count"], [class*="-count"],
  [role="status"], [role="alert"],
  .post-stat, .info-card__stats, .login-links, .auth-modal__links,
  .info-card__type, .member-admin-type,
  .comment-head, .comment-foot, .comment-user, .fyg-type, .status-pill,
  .fyg-muted, .fyg-admin-alert, .registration-email-hint,
  .login-result, .form-result, .profile-result,
  .login-help-text, .telegram-push-help, .pull-refresh-indicator,
  .registration-verification-reminder, .submission-comments-error,
  .fyg-ticket-alert, .member-ticket-closed,
  .nav-user-balance, .nav-user-vipbox span,
  .records-title-row > span, .favorites-title-row > span,
  .user-comments-head > span, .member-admin-head p, #commentCount,
  .recharge-form > p.is-error, .recharge-form > p.is-success,
  .submission-message, .email-verification-address,
  .detail-qr-modal__url, #detailQrHelp, .email-pending-links,
  .account-online, .submission-comment-top, .submission-comments-post-card,
  .member-ticket-priority, .fyg-ticket-priority, .fyg-ticket-no,
  .fyg-mail-service-source, .fyg-frontend-images-guide-line,
  .fyg-frontend-image-slot > header span,
  .fyg-frontend-banner-card > header span, .fyg-frontend-image-file,
  .fyg-comment-reply-mark,
  .fyg-withdraw-user > span, .fyg-withdraw-money > span,
  .fyg-ad-calendar-weekdays span, .fyg-ad-calendar-day,
  .fyg-ticket-attachments a, .member-ticket-attachments a,
  .favorite-cover > span, .favorite-info > p,
  [data-image-status], .fyg-logo-theme-title > span,
  .fyg-logo-upload-rules, .recharge-tutorial__heading > span, .vip-plan em,
  .nav-checkin-calendar__header span, .nav-checkin-calendar__details,
  .nav-checkin-calendar__summary, .nav-checkin-calendar__empty,
  .fyg-watermark-asset p, .comment-inline-profile,
  .member-admin-alert, .user-comment-reply, .user-comment-reply-disabled,
  .fyg-admin-shortcuts span, .fyg-admin-stat span,
  .fyg-affiliate-admin-stats span, .agency-summary span,
  .fyg-withdraw-summary span, .wallet-cards article p,
  .wallet-cards article small, .vip-plan p:last-of-type, .mobile-tabbar__item small,
  [data-live-chat-session-meta],
  .live-chat-queue__filter input, .live-chat-queue__filter button,
  .live-chat-queue-control
) {
  --fyg-current-font: var(--fyg-font-small);
  --fyg-current-line: var(--fyg-line-small);
  line-height: var(--fyg-line-small) !important;
}

/* Both halves of the compact check-in controls are button copy, not metadata. */
html body:not(#fyg-typography-disabled) .checkin-control-text {
  --fyg-current-font: var(--fyg-font-medium);
  --fyg-current-line: var(--fyg-line-medium);
  font-size: var(--fyg-font-medium) !important;
  font-weight: 800 !important;
  line-height: var(--fyg-line-medium) !important;
}

html body:not(#fyg-typography-disabled) .nav-user-balance:not(.nav-user-balance-breakdown) {
  display: flex;
  align-items: center;
}

html body:not(#fyg-typography-disabled) .nav-user-vipbox > a {
  min-height: 30px !important;
}

/* Date-picker labels are form content, not publication-date metadata. */
html body:not(#fyg-typography-disabled) :where(
  .fyg-ad-date-display, .fyg-ad-date-range-label, .fyg-ad-date-separator,
  .fyg-ad-date-trigger
) {
  --fyg-current-font: var(--fyg-font-medium);
  --fyg-current-line: var(--fyg-line-medium);
  font-size: var(--fyg-font-medium) !important;
  line-height: var(--fyg-line-medium) !important;
}

html body:not(#fyg-typography-disabled) :where(
  [class*="__pager"], [class*="-pager"], [class*="pagination"],
  .fyg-users-pager, .mobile-pagination
) :where(a, span, button, input, select, option) {
  --fyg-current-font: var(--fyg-font-small);
  --fyg-current-line: var(--fyg-line-small);
  font-size: var(--fyg-font-small) !important;
  line-height: var(--fyg-line-small) !important;
}

/* Text rendered by pseudo-elements follows the same tiers. */
html body:not(#fyg-typography-disabled) .float-tools button::before {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fyg-font-small) !important;
  line-height: var(--fyg-line-small) !important;
}

/* The one-character floating chat counter stays inside its compact fixed box. */
html body:not(#fyg-typography-disabled) .float-live-chat-unread-badge {
  --fyg-current-font: var(--fyg-font-small);
  --fyg-current-line: 1;
  font-size: var(--fyg-font-small) !important;
  line-height: 1 !important;
}

html body:not(#fyg-typography-disabled) .fyg-dashboard-sidebar::before {
  font-size: var(--fyg-font-medium) !important;
  line-height: var(--fyg-line-medium) !important;
}

html body:not(#fyg-typography-disabled) .email-pending-steps li::before {
  width: 20px !important;
  height: 20px !important;
  font-size: var(--fyg-font-small) !important;
  line-height: var(--fyg-line-small) !important;
}

/* Page titles, dialog titles and core numbers use large. */
html body:not(#fyg-typography-disabled) :where(
  h1,
  #drawerTitle, #detailQrTitle, #fygSaveCompleteTitle, #floatLiveChatTitle,
  #registrationAgreementTitle, #vipInsufficientTitle,
  .forgot-password-modal__title, .splash-popup__title,
  .email-verification-title,
  .logo.site-logo .site-logo__text,
  .splash-popup__brand.site-logo .site-logo__text,
  .fyg-logo-preview b,
  .member-ticket-dialog-title h3, .fyg-ticket-dialog-title h3,
  .fyg-admin-stat strong, .fyg-affiliate-admin-stats strong,
  .agency-summary strong, .fyg-withdraw-summary strong,
  .admin-stats strong, .wallet-cards article > h2,
  .wallet-cards article > strong, .vip-price strong,
  .withdraw-static > span
) {
  --fyg-current-font: var(--fyg-font-large);
  --fyg-current-line: var(--fyg-line-large);
  font-size: var(--fyg-font-large) !important;
  line-height: var(--fyg-line-large) !important;
}

html body:not(#fyg-typography-disabled) h1 :where(a, span, strong, em, b) {
  --fyg-current-font: var(--fyg-font-large);
  --fyg-current-line: var(--fyg-line-large);
  font-size: var(--fyg-font-large) !important;
  line-height: var(--fyg-line-large) !important;
}

/* Units and captions beside core numbers remain small instead of creating a fourth size. */
html body:not(#fyg-typography-disabled) :where(
  .vip-price span, .wallet-cards article h2:not(.account-level-display) span,
  .fyg-admin-stat span, .fyg-affiliate-admin-stats span,
  .agency-summary span, .fyg-withdraw-summary span
) {
  --fyg-current-font: var(--fyg-font-small);
  --fyg-current-line: var(--fyg-line-small);
  font-size: var(--fyg-font-small) !important;
  line-height: var(--fyg-line-small) !important;
}

/* Long page titles wrap instead of shrinking below the planned tier. */
html body:not(#fyg-typography-disabled) h1,
html body:not(#fyg-typography-disabled) :where(
  .member-ticket-dialog-title h3, .fyg-ticket-dialog-title h3,
  .forgot-password-modal__title, .email-verification-title
) {
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal !important;
}

/* Compact table badges and notification counters need room for the 12px/1.6 tier. */
html body:not(#fyg-typography-disabled) :where(
  .account-menu-badge, .info-card__type, .fyg-status, .fyg-type, .status-pill,
  .user-comment-status, .member-admin-status, .fyg-ticket-status
) {
  min-height: 20px;
  height: auto !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Table text grows without collapsing fixed columns; scrolling remains available. */
html body:not(#fyg-typography-disabled) :where(
  .fyg-admin-table-wrap, .member-admin-table-wrap, .records-table-wrap,
  .agency-table-wrap, .withdraw-table-wrap, .user-comments-table-wrap
) {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

html body:not(#fyg-typography-disabled) :where(
  .fyg-admin-table td, .member-admin-table td, .records-table td,
  .agency-table td, .withdraw-table td, .user-comments-table td
) {
  vertical-align: middle;
}

html body:not(#fyg-typography-disabled) .fyg-dashboard-shell :where(
  .fyg-admin-actions a, .fyg-admin-actions button,
  .fyg-user-actions a, .fyg-user-actions button,
  .member-admin-actions a, .member-admin-actions button
) {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

html body:not(#fyg-typography-disabled) .user-comment-reply-form textarea {
  height: 40px !important;
  min-height: 40px !important;
}

html body:not(#fyg-typography-disabled) .fyg-dashboard-shell :where(
  .fyg-admin-tabs a, .fyg-admin-tabs button,
  .member-admin-tabs a, .member-admin-tabs button
) {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* The empty, unfocused email field shows a second-line warning. */
html body:not(#fyg-typography-disabled) .registration-inline-row[data-email-row] {
  grid-template-columns: minmax(0, 1fr) !important;
}

html body:not(#fyg-typography-disabled) .registration-email-field.is-email-hint-visible:not(:focus-within) input,
html body:not(#fyg-typography-disabled) .auth-modal__form .registration-email-field.is-email-hint-visible:not(:focus-within) input {
  height: 64px !important;
  padding-top: 8px !important;
  padding-bottom: 32px !important;
}

html body:not(#fyg-typography-disabled) .registration-email-field.is-email-hint-visible:not(:focus-within) > span,
html body:not(#fyg-typography-disabled) .auth-modal__form .registration-email-field.is-email-hint-visible:not(:focus-within) > span,
html body:not(#fyg-typography-disabled) .registration-email-field.is-email-hint-visible.is-valid:not(:focus-within)::after,
html body:not(#fyg-typography-disabled) .auth-modal__form .registration-email-field.is-email-hint-visible.is-valid:not(:focus-within)::after {
  top: 21px !important;
}

html body:not(#fyg-typography-disabled) .registration-email-hint {
  right: 8px !important;
  top: auto !important;
  bottom: 5px !important;
  left: 34px !important;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: none;
  white-space: nowrap;
}

html body:not(#fyg-typography-disabled) .login-form [data-email-row] .registration-inline-action,
html body:not(#fyg-typography-disabled) .auth-modal__form [data-email-row] .registration-inline-action {
  width: 100% !important;
  min-height: 44px;
  height: 44px !important;
}

/* Front-end fixed controls retain comfortable heights after applying the medium tier. */
html body:not(#fyg-typography-disabled) :where(
  .vip-plan button, .vip-plan .button, .vip-plan .vip-upgrade-link
) {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 680px) {
  html body:not(#fyg-typography-disabled) .auth-modal .login-field input {
    height: 44px !important;
    padding-top: 11px !important;
    padding-bottom: 11px !important;
  }

  html body:not(#fyg-typography-disabled) .auth-modal__form > button {
    min-height: 44px;
    height: 44px !important;
  }

  html body:not(#fyg-typography-disabled) .auth-modal .registration-email-field.is-email-hint-visible:not(:focus-within) input,
  html body:not(#fyg-typography-disabled) .login-shell .registration-email-field.is-email-hint-visible:not(:focus-within) input {
    height: 62px !important;
    padding-top: 7px !important;
    padding-bottom: 31px !important;
  }

  html body:not(#fyg-typography-disabled) .registration-email-field.is-email-hint-visible:not(:focus-within) > span,
  html body:not(#fyg-typography-disabled) .auth-modal__form .registration-email-field.is-email-hint-visible:not(:focus-within) > span,
  html body:not(#fyg-typography-disabled) .registration-email-field.is-email-hint-visible.is-valid:not(:focus-within)::after,
  html body:not(#fyg-typography-disabled) .auth-modal__form .registration-email-field.is-email-hint-visible.is-valid:not(:focus-within)::after {
    top: 20px !important;
  }

  html body:not(#fyg-typography-disabled) .registration-email-hint {
    right: 6px !important;
    bottom: 4px !important;
    left: 31px !important;
  }

  html body:not(#fyg-typography-disabled):not(.dashboard-body) {
    padding-bottom: 60px;
  }

  html body:not(#fyg-typography-disabled) .mobile-tabbar {
    height: 60px;
  }

  html body:not(#fyg-typography-disabled) .mobile-tabbar__item small {
    padding-bottom: 3px;
  }

  html body:not(#fyg-typography-disabled) .float-tools {
    bottom: 80px;
  }
}

/* Font glyphs used as graphics are deliberately outside the three text tiers. */
html body:not(#fyg-typography-disabled) :where(
  .reaction-btn, .account-menu-icon,
  .account-admin-toggle, .avatar-btn
) {
  font-size: 0 !important;
}

/* Keep each reaction icon and its count as one tightly centered visual unit. */
html body:not(#fyg-typography-disabled) .reaction-row .reaction-content {
  font-size: 0 !important;
  line-height: 1 !important;
}

html body:not(#fyg-typography-disabled) .reaction-row .reaction-content > small {
  flex: 0 0 auto;
  margin: 0 !important;
  font-size: 10px !important;
  line-height: 10px !important;
}

html body:not(#fyg-typography-disabled) .detail-lightbox-control {
  font-size: 38px !important;
  line-height: 1 !important;
}

html body:not(#fyg-typography-disabled) .detail-lightbox-close {
  font-size: 32px !important;
  line-height: 1 !important;
}

html body:not(#fyg-typography-disabled) .detail-qr-modal__close {
  font-size: 26px !important;
  line-height: 1 !important;
}

html body:not(#fyg-typography-disabled) .drawer__close {
  font-size: 24px !important;
  line-height: 1 !important;
}

html body:not(#fyg-typography-disabled) .fyg-save-complete-popup__close {
  font-size: 28px !important;
  line-height: 34px !important;
}

html body:not(#fyg-typography-disabled) .fyg-operation-toast__close {
  font-size: 25px !important;
  line-height: 1 !important;
}

html body:not(#fyg-typography-disabled) .vip-insufficient-modal__close {
  font-size: 28px !important;
  line-height: 1 !important;
}

html body:not(#fyg-typography-disabled) :where(
  .member-ticket-dialog-close, .fyg-ticket-dialog-close
) {
  font-size: 20px !important;
  line-height: 34px !important;
}

html body:not(#fyg-typography-disabled) .fyg-dashboard-menu-btn {
  font-size: 20px !important;
  line-height: 1 !important;
}

html body:not(#fyg-typography-disabled) .fyg-ticket-eye {
  font-size: 17px !important;
  line-height: 1.55 !important;
}

html body:not(#fyg-typography-disabled) :where(.emoji-btn, .comment-inline-emoji) {
  font-size: 20px !important;
  line-height: 1 !important;
}

html body:not(#fyg-typography-disabled) .comment-emoji-picker button {
  font-size: 18px !important;
  line-height: 1 !important;
}

html body:not(#fyg-typography-disabled) .ticket-upload:not(.has-file) > span {
  font-size: 36px !important;
  line-height: 1 !important;
}

html body:not(#fyg-typography-disabled) .ticket-upload.has-file > span {
  font-size: var(--fyg-font-small) !important;
  line-height: var(--fyg-line-small) !important;
}

html body:not(#fyg-typography-disabled) .fyg-ad-calendar-nav {
  font-size: 24px !important;
  line-height: 1 !important;
}

/* The compact guest action group is intentionally identical on PC and phone. */
html body:not(#fyg-typography-disabled)
  .topnav .nav-actions.nav-actions--guest > a[data-open-auth],
html body:not(#fyg-typography-disabled)
  .topnav .nav-actions.nav-actions--guest > a[data-open-register] {
  font-size: 14px !important;
  line-height: 1 !important;
}

@media (max-width: 680px) {
  html body:not(#fyg-typography-disabled) .detail-lightbox-control {
    font-size: 34px !important;
  }

  html body:not(#fyg-typography-disabled) .detail-lightbox-close {
    font-size: 30px !important;
  }

  html body:not(#fyg-typography-disabled) .avatar-btn {
    font-size: 0 !important;
  }
}

/* Close icons are geometric controls, not typography. */
html body:not(#fyg-typography-disabled) .fyg-close-x {
  font-size: 0 !important;
  line-height: 0 !important;
}
