/*
 * Product typography layer
 *
 * This file loads after musegate-v14.css. It intentionally targets only the
 * authenticated product surfaces so the explore homepage keeps its exact
 * type scale and viewport composition.
 */

:is(
  body.auth-body,
  body.create-body,
  body.video-body,
  body.dashboard-body,
  body.admin-body,
  body.legal-body
) {
  --type-meta: 0.8125rem;
  --type-ui: 0.9375rem;
  --type-body: 1rem;
  --type-subheading: 1.125rem;
  --type-section: 1.25rem;
  --type-title: 1.5rem;
  --type-page: 2rem;
  font-size: var(--type-body);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

/* Shared product navigation and controls */
:is(
  body.auth-body,
  body.create-body,
  body.video-body,
  body.dashboard-body,
  body.admin-body,
  body.legal-body
) :is(.nav-link, .btn, .account-menu-row, .user-menu a, .user-menu button) {
  font-size: var(--type-ui);
}

:is(
  body.auth-body,
  body.create-body,
  body.video-body,
  body.dashboard-body,
  body.admin-body,
  body.legal-body
) :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea, .input, .select, .textarea) {
  font-size: var(--type-body) !important;
}

:is(
  body.auth-body,
  body.create-body,
  body.video-body,
  body.dashboard-body,
  body.admin-body,
  body.legal-body
) :is(.form-label, .field label, .brief-field) {
  font-size: var(--type-ui);
}

:is(
  body.auth-body,
  body.create-body,
  body.video-body,
  body.dashboard-body,
  body.admin-body,
  body.legal-body
) :is(.form-hint, .form-error, .field-help, .drawer-heading, .drawer-history-meta) {
  font-size: var(--type-meta);
  line-height: 1.55;
}

/* Authentication */
body.auth-body {
  overflow-x: hidden;
  overflow-y: auto;
}

body.auth-body .brand-lockup-copy strong {
  font-size: var(--type-body);
}

body.auth-body .brand-lockup-copy small,
body.auth-body .auth-head-label,
body.auth-body .auth-legal-note {
  font-size: var(--type-meta);
}

body.auth-body .auth-brand-statement > p,
body.auth-body .auth-brand-capabilities span,
body.auth-body .auth-tab,
body.auth-body .auth-help,
body.auth-body .auth-head > p:last-child {
  font-size: var(--type-ui);
}

body.auth-body .auth-head h2 {
  font-size: var(--type-page);
}

body.auth-body .auth-form .form-label,
body.auth-body .auth-foot-text,
body.auth-body .auth-link-btn,
body.auth-body .auth-notice {
  font-size: var(--type-ui);
}

body.auth-body .auth-agreement {
  grid-template-columns: 18px minmax(0, 1fr);
  font-size: var(--type-meta);
}

body.auth-body .auth-agreement input {
  width: 17px;
  height: 17px;
}

/* Image creation workbench */
body.create-body .create-page .studio-section-title h2,
body.create-body .create-page .studio-result .studio-section-title h2 {
  font-size: var(--type-section);
}

body.create-body .create-page :is(.studio-section-title .muted, .prompt-tools .muted, .history-controls .muted) {
  font-size: var(--type-ui);
  line-height: 1.55;
}

body.create-body .create-page .mini-heading > span,
body.create-body .create-page .mini-heading,
body.create-body .create-page .setting-group h3,
body.create-body .create-page .param-settings h3 {
  font-size: var(--type-ui);
}

body.create-body .create-page :is(.compact-action, .upload-button, .pill, .chip) {
  font-size: var(--type-ui);
}

body.create-body .create-page :is(
  .material-copy strong,
  .asset-role-button strong,
  .template-card strong,
  .plan-card strong,
  .style-suite-intro strong,
  .style-suite-fieldset legend,
  .style-suite-choice strong,
  .style-suite-result-head > div span
) {
  font-size: var(--type-ui);
}

body.create-body .create-page :is(
  .material-copy span,
  .asset-role-button span,
  .template-card span,
  .plan-card > span,
  .style-suite-intro p,
  .style-suite-choice small,
  .style-suite-safety strong,
  .style-suite-safety span,
  .style-suite-submit span,
  .style-suite-result-head > div strong,
  .style-suite-slot-meta,
  .style-suite-slot.is-error strong,
  .style-suite-slot.is-error span
) {
  font-size: var(--type-meta);
  line-height: 1.55;
}

body.create-body .create-page :is(.plan-summary, .queue-panel, .queue-wrap, .status-line) {
  font-size: var(--type-ui);
  line-height: 1.55;
}

body.create-body .create-page .plan-count {
  font-size: var(--type-meta);
}

body.create-body .create-page .plan-count input {
  min-width: 6ch;
  width: 6ch;
  font-size: var(--type-body);
}

body.create-body .create-page .empty-title {
  font-size: var(--type-subheading);
}

body.create-body .create-page .empty-desc {
  max-width: 58ch;
  font-size: var(--type-body);
  line-height: 1.6;
}

body.create-body .create-page :is(.result-actions a, .result-actions button, .drawer-history-actions button) {
  font-size: var(--type-meta);
}

/* Video workbench */
body.video-body .video-page .panel-head h2 {
  font-size: var(--type-section);
}

body.video-body .video-page .panel-head p,
body.video-body .video-page .field label,
body.video-body .video-page .upload-card-head strong,
body.video-body .video-page .status-line {
  font-size: var(--type-ui);
  line-height: 1.55;
}

body.video-body .video-page :is(
  .panel-note,
  .mini-label,
  .field-help,
  .upload-card-head span,
  .preview-empty,
  .param-chip
) {
  font-size: var(--type-meta);
  line-height: 1.5;
}

body.video-body .video-page .mini-label {
  min-height: 1.5rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

body.video-body .video-page .empty-state-title {
  font-size: var(--type-subheading);
}

body.video-body .video-page .empty-state-desc {
  max-width: 58ch;
  font-size: var(--type-body);
  line-height: 1.6;
}

/* Account center */
body.dashboard-body .dash-page .dash-hero-kicker {
  font-size: var(--type-meta);
}

body.dashboard-body .dash-page .dash-hero-title {
  font-size: var(--type-page);
}

body.dashboard-body .dash-page .dash-hero-subtitle {
  max-width: 70ch;
  font-size: var(--type-body);
  line-height: 1.65;
}

body.dashboard-body .dash-page .identity-line strong {
  font-size: var(--type-subheading);
}

body.dashboard-body .dash-page .profile-meta,
body.dashboard-body .dash-page .pager {
  font-size: var(--type-meta);
}

body.dashboard-body .dash-page :is(.small-badge, .request-tag, .profile-stats .stat span) {
  font-size: var(--type-meta);
}

body.dashboard-body .dash-page .profile-stats .stat strong {
  font-size: var(--type-section);
}

body.dashboard-body .dash-page .side-panel h2 {
  font-size: var(--type-section);
}

body.dashboard-body .dash-page .tab,
body.dashboard-body .dash-page :is(.package strong, .quick-list a, .quick-list button) {
  font-size: var(--type-ui);
}

body.dashboard-body .dash-page :is(.package span, .ql-copy small) {
  font-size: var(--type-meta);
}

body.dashboard-body .dash-page .table th {
  font-size: var(--type-meta);
}

body.dashboard-body .dash-page .table td {
  font-size: var(--type-ui);
  line-height: 1.5;
}

body.dashboard-body .dash-page .table-wrap {
  overscroll-behavior-inline: contain;
}

/* Administration console */
body.admin-body .admin-page :is(.rail-brand span, .hero-card-kicker, .admin-context, .panel-context) {
  font-size: var(--type-meta);
}

body.admin-body .admin-page .rail-brand strong,
body.admin-body .admin-page .rail-nav a {
  font-size: var(--type-subheading);
}

body.admin-body .admin-page .rail-nav a {
  font-size: var(--type-ui);
}

body.admin-body .admin-page .rail-hint {
  font-size: var(--type-meta);
  line-height: 1.6;
}

body.admin-body .admin-page :is(.hero-card h1, .admin-masthead h1) {
  font-size: var(--type-page);
}

body.admin-body .admin-page :is(.hero-card .muted, .panel-head .muted, .mini-head p) {
  font-size: var(--type-ui);
  line-height: 1.55;
}

body.admin-body .admin-page :is(.summary-grid .stat span, .ops-card span, .system-card span) {
  font-size: var(--type-meta);
}

body.admin-body .admin-page :is(.summary-grid .stat strong, .system-card strong, .ops-card strong) {
  font-size: var(--type-section);
}

body.admin-body .admin-page :is(.panel-head h2, .side-panel h2, .mini-head h3) {
  font-size: var(--type-subheading);
}

body.admin-body .admin-page :is(
  .system-card small,
  .ops-card small,
  .helper-line,
  .mini-note,
  .notice,
  .admin-output-empty,
  .badge,
  .system-pill,
  .live-status
) {
  font-size: var(--type-meta);
  line-height: 1.5;
}

body.admin-body .admin-page :is(.package-editor-row, .channel-editor-row, .model-health-item, .audit-item, .detail-item, .system-failure-item) {
  font-size: var(--type-ui);
  line-height: 1.5;
}

body.admin-body .admin-page .table th {
  font-size: var(--type-meta);
}

body.admin-body .admin-page .table td {
  font-size: var(--type-ui);
  line-height: 1.5;
}

body.admin-body .admin-page :is(.badge, .system-pill, .live-status, .status-line, .mini-note) {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

body.admin-body .admin-page .table-wrap {
  overscroll-behavior-inline: contain;
}

/* The cockpit stylesheet carries a data-attribute specificity layer. These
 * role-level declarations intentionally win so dynamic admin content follows
 * the same readable scale as the rest of the product. */
body.admin-body .admin-page[data-admin-design="cockpit-v15"] :is(
  .rail-brand span,
  .rail-nav a small,
  .rail-hint,
  .admin-context,
  .panel-context,
  .live-status span,
  .live-status small,
  .summary-grid .stat span,
  .system-card span,
  .ops-card span,
  .system-card small,
  .ops-card small,
  .system-failure-title,
  .helper-line,
  .mini-note,
  .notice,
  .admin-output-empty,
  .audit-item p,
  .search-field > span
) {
  font-size: var(--type-meta) !important;
  line-height: 1.5;
}

body.admin-body .admin-page[data-admin-design="cockpit-v15"] :is(
  .rail-nav a,
  .rail-nav a span,
  .admin-masthead p,
  .panel-head .muted,
  .mini-head p,
  .zone-heading p,
  .live-status strong,
  .system-failure-item strong,
  .model-health-item strong,
  .audit-item strong,
  .field-label,
  .form-label,
  .btn,
  .btn-sm
) {
  font-size: var(--type-ui) !important;
}

body.admin-body .admin-page[data-admin-design="cockpit-v15"] :is(
  .summary-grid .stat strong,
  .system-card strong,
  .ops-card strong
) {
  font-size: var(--type-section) !important;
}

body.admin-body .admin-page[data-admin-design="cockpit-v15"] :is(
  .panel-head h2,
  .zone-heading h2
) {
  font-size: var(--type-section) !important;
}

body.admin-body .admin-page[data-admin-design="cockpit-v15"] :is(
  .panel-head h3,
  .mini-head h3,
  .mini-head h4,
  .inspector-head h2,
  .inspector-section h3
) {
  font-size: var(--type-subheading) !important;
}

body.admin-body .admin-page[data-admin-design="cockpit-v15"] .table {
  font-size: var(--type-ui) !important;
  line-height: 1.5;
}

body.admin-body .admin-page[data-admin-design="cockpit-v15"] .table thead th {
  font-size: var(--type-meta) !important;
}

body.admin-body .admin-page[data-admin-design="cockpit-v15"] :is(
  .table tbody td,
  .table td strong,
  .task-actions .btn
) {
  font-size: var(--type-ui) !important;
}

body.admin-body .admin-page[data-admin-design="cockpit-v15"] :is(
  .table td .muted,
  .table .badge,
  .badge,
  .task-error-row td,
  .system-failure-item span
) {
  font-size: var(--type-meta) !important;
  line-height: 1.45;
}

/* Legal documents */
body.legal-body .layout-doc .doc-back-link {
  font-size: var(--type-ui);
}

body.legal-body .layout-doc .doc-title {
  font-size: var(--type-page);
}

body.legal-body .layout-doc .doc-intro,
body.legal-body .layout-doc .doc-section {
  max-width: 70ch;
}

body.legal-body .layout-doc .doc-intro,
body.legal-body .layout-doc :is(.doc-section p, .doc-muted) {
  font-size: var(--type-body);
  line-height: 1.8;
}

body.legal-body .layout-doc .doc-section h2 {
  font-size: var(--type-title);
  line-height: 1.3;
  text-wrap: balance;
}

/* Responsive safeguards for the larger type scale */
@media (max-width: 1280px) and (min-width: 621px) {
  body.video-body .video-page .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) and (min-width: 821px) {
  :is(body.create-body, body.video-body, body.dashboard-body, body.admin-body) .topnav-inner {
    grid-template-columns: minmax(132px, 0.8fr) auto minmax(132px, 0.8fr);
    gap: 8px;
    padding-inline: 14px;
  }

  :is(body.create-body, body.video-body, body.dashboard-body, body.admin-body) .nav-link {
    min-width: 48px;
    padding-inline: 9px;
  }
}

@media (max-width: 620px) {
  body.dashboard-body .dash-page .profile-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  body.dashboard-body .dash-page .profile-stats .stat {
    min-width: 0;
    padding: 8px 10px;
    border-left: 0;
    border-bottom: 1px solid var(--border-subtle);
  }

  body.dashboard-body .dash-page .tabs {
    display: flex;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  body.dashboard-body .dash-page .tabs::-webkit-scrollbar {
    display: none;
  }

  body.dashboard-body .dash-page .tab {
    flex: 0 0 auto;
  }

  body.admin-body .admin-page :is(.hero-card h1, .admin-masthead h1),
  body.dashboard-body .dash-page .dash-hero-title,
  body.legal-body .layout-doc .doc-title {
    font-size: 1.75rem;
  }

  body.legal-body .layout-doc .doc-section h2 {
    font-size: var(--type-section);
  }
}

@media (max-width: 430px) {
  body.dashboard-body .dash-page .profile-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-height: 760px) and (min-width: 981px) {
  body.auth-body .auth-page,
  body.auth-body .auth-split,
  body.auth-body .auth-form-zone {
    min-height: 760px;
  }

  body.auth-body .auth-form-zone {
    justify-content: flex-start;
    padding-top: 64px;
  }
}
