/* IPGuru logged-in application typography
   ----------------------------------------
   One semantic desktop scale for the shell and every mounted workspace.
   The account's server-backed text_size preference selects a complete role
   set; it does not zoom panels or icons. Values use rem so browser zoom and
   user font defaults continue to work. */

:root {
  --type-caption:.6875rem; /* 11px */
  --type-meta:.75rem; /* 12px */
  --type-label:.8125rem; /* 13px */
  --type-body:.875rem; /* 14px */
  --type-body-lg:.9375rem; /* 15px */
  --type-subheading:1.0625rem; /* 17px */
  --type-title:1.5rem; /* 24px */
  --type-display:1.75rem; /* 28px */
  --type-measure:68ch;
  --type-leading-tight:1.25;
  --type-leading-ui:1.4;
  --type-leading-body:1.6;
}

html[data-text-size="small"] {
  --type-caption:.6875rem; /* captions never fall below 11px */
  --type-meta:.6875rem;
  --type-label:.75rem;
  --type-body:.8125rem;
  --type-body-lg:.875rem;
  --type-subheading:.9375rem;
  --type-title:1.25rem;
  --type-display:1.5rem;
}

html[data-text-size="large"] {
  --type-caption:.75rem;
  --type-meta:.75rem;
  --type-label:.9375rem;
  --type-body:1rem;
  --type-body-lg:1rem;
  --type-subheading:1.125rem;
  --type-title:1.75rem;
  --type-display:2rem;
}

body {
  font-size:var(--type-body);
  line-height:var(--type-leading-body);
}

/* Semantic HTML is the baseline. Component-specific mappings below preserve
   deliberate density without allowing local micro-type to become body copy. */
body :where(h1) {
  font-size:var(--type-title)!important;
  line-height:1.2;
  text-wrap:balance;
}
body :where(h2) {
  font-size:var(--type-subheading)!important;
  line-height:1.3;
  text-wrap:balance;
}
body :where(h3) {
  font-size:var(--type-subheading)!important;
  line-height:1.35;
}
body :where(h4) {
  font-size:var(--type-label)!important;
  line-height:var(--type-leading-ui);
}
body :where(p,li,dt,dd,td) {
  font-size:var(--type-body)!important;
  line-height:var(--type-leading-body);
}
body :where(th,label,button:not(.iconbtn),input,textarea,select) {
  font-size:var(--type-label)!important;
  line-height:var(--type-leading-ui);
}
body :where(small) {
  font-size:var(--type-caption)!important;
  line-height:1.45;
}

/* Long-form reading and writing. */
.msg .bubble,
.bubble.cfv-md,
.composer textarea,
.pgsub,
.detrow .dv,
.rbintro,
.quicklook .ql-summary,
.csumm-wrap .csumm-body,
.sumevent-body,
.tnotice-body,
.turnnotice,
.spnote,
.spnote .spmd,
.actcard .ac-body,
.sample,
.nowcard .nowblurb,
.wnote,
.wben-tier .tb,
.comingsoon,
.fv-empty p,
.fv-note {
  font-size:var(--type-body-lg)!important;
  line-height:var(--type-leading-body);
}

:where(.msg .bubble,.bubble.cfv-md,.spmd,.cfv-md,.quicklook .ql-summary) {
  max-width:var(--type-measure);
}

/* Repeated application roles. */
.btn,
.seg button,
.field,
.wfield,
.lab2,
.prefrow,
.settings-studio p,
.settings-tile .s,
.side button:not(.iconbtn),
.side .thread-row-main,
.side .thread-new-button,
.side .thread-archive-toggle {
  font-size:var(--type-label)!important;
  line-height:var(--type-leading-ui);
}

.btn.sm,
.side .navgroup,
.side .crewhead,
.side .foot,
.kv,
.eyebrow,
.thread-row-time,
.thread-rename-hint,
.pghead,
.pghint,
.app-toast-context,
.app-toast-meta,
.notice-context,
.tn-meta,
.provpill,
.gradepill,
.vichip,
.vipill {
  font-size:var(--type-caption)!important;
  line-height:1.45;
}

.rail :where(p,li,dd,dt,.rtxt,.railrecord-empty) {
  font-size:var(--type-body)!important;
  line-height:var(--type-leading-body);
}
.rail :where(small,.kv) {
  font-size:var(--type-caption)!important;
}

/* Chat headings must remain above the reading body at every account size. */
.msg .bubble .mdbody h1 { font-size:var(--type-title)!important; }
.msg .bubble .mdbody :is(h2,h3) { font-size:var(--type-subheading)!important; }
.msg .bubble .mdbody h4 { font-size:var(--type-label)!important; }

/* Brainstorming workspaces share the same hierarchy rather than multiplying
   their legacy 8–12px declarations. */
:is(.bsidea-page,.bs-documents-page,.bsvisual-page,.bsphysical-page,.bsconsult-page,.bscrew-page,.bsfind-page,.bsdirector-page) {
  font-size:var(--type-body);
}
:is(.bsidea-page,.bs-documents-page,.bsvisual-page,.bsphysical-page,.bsconsult-page,.bscrew-page,.bsfind-page,.bsdirector-page) :where(h1) {
  font-size:var(--type-title)!important;
}
:is(.bsidea-page,.bs-documents-page,.bsvisual-page,.bsphysical-page,.bsconsult-page,.bscrew-page,.bsfind-page,.bsdirector-page) :where(h2,h3) {
  font-size:var(--type-subheading)!important;
}
:is(.bsidea-page,.bs-documents-page,.bsvisual-page,.bsphysical-page,.bsconsult-page,.bscrew-page,.bsfind-page,.bsdirector-page) :where(h4,b) {
  font-size:var(--type-label)!important;
}
:is(.bsidea-page,.bs-documents-page,.bsvisual-page,.bsphysical-page,.bsconsult-page,.bscrew-page,.bsfind-page,.bsdirector-page) :where(p,li,dt,dd,td,.rtxt) {
  font-size:var(--type-body)!important;
  line-height:var(--type-leading-body);
}
:is(.bsidea-page,.bs-documents-page,.bsvisual-page,.bsphysical-page,.bsconsult-page,.bscrew-page,.bsfind-page,.bsdirector-page) :where(label,button:not(.iconbtn),input,textarea,select,th) {
  font-size:var(--type-label)!important;
}
:is(.bsidea-page,.bs-documents-page,.bsvisual-page,.bsphysical-page,.bsconsult-page,.bscrew-page,.bsfind-page,.bsdirector-page) :where(small,.kv,.eyebrow) {
  font-size:var(--type-caption)!important;
}

/* Visual Thinking used fixed 6.8–10.5px text throughout its canvas. Preserve
   the diagram geometry and icon sizes while applying the shared text roles. */
:is(.vt-workspace,.vt-dialog,.vt-review-sheet,.vt-state-card) {
  font-size:var(--type-body);
}
:is(.vt-workspace,.vt-dialog,.vt-review-sheet,.vt-state-card) :where(h1) {
  font-size:var(--type-title)!important;
}
:is(.vt-workspace,.vt-dialog,.vt-review-sheet,.vt-state-card) :where(h2,h3) {
  font-size:var(--type-subheading)!important;
}
:is(.vt-workspace,.vt-dialog,.vt-review-sheet,.vt-state-card) :where(h4,b) {
  font-size:var(--type-label)!important;
  line-height:var(--type-leading-ui);
}
:is(.vt-workspace,.vt-dialog,.vt-review-sheet,.vt-state-card) :where(p,li,dt,dd) {
  font-size:var(--type-body)!important;
}
:is(.vt-workspace,.vt-dialog,.vt-review-sheet,.vt-state-card) :where(button:not(.iconbtn),input,textarea,select) {
  font-size:var(--type-label)!important;
}
:is(.vt-workspace,.vt-dialog,.vt-review-sheet,.vt-state-card) :where(small,.kv) {
  font-size:var(--type-caption)!important;
}
.vt-concept-legend span,
.vt-source-chip,
.vt-frame-chip,
.vt-version-strip,
.vt-question-state,
.vt-progressive,
.vt-canvas-status,
.vt-zoom span,
.vt-story-state,
.vt-structure-note,
.vt-count,
.vt-status-btn,
.vt-section-label,
.vt-change-type,
.vt-grounded,
.vt-attributed,
.vt-dialog-loading,
.vt-dialog-error {
  font-size:var(--type-caption)!important;
  line-height:1.45;
}
.vt-edge-label,
.vt-sun-label,
.vt-sun-centre text {
  font-size:var(--type-caption)!important;
}
.vt-sun-centre .title {
  font-size:var(--type-subheading)!important;
}

/* File browser and viewer components remain dense but no longer introduce a
   second scale or ignore the account preference. */
:is(.cfv,.cfb) {
  font-size:var(--type-body);
}
:is(.cfv,.cfb) :where(button:not(.iconbtn),input,textarea,select) {
  font-size:var(--type-label)!important;
}
.cfv-name,
.cfv-loading-label,
.cfb-name,
.cfb-row,
.cfb-pane-empty::before {
  font-size:var(--type-label)!important;
}
.cfv-badge,
.cfv-count,
.cfv-zipsize,
.cfv-jt-chip,
.cfb-count,
.cfb-vbadge,
.cfb-card .cfb-meta {
  font-size:var(--type-caption)!important;
}
.cfv-md h1 { font-size:var(--type-title)!important; }
.cfv-md :is(h2,h3) { font-size:var(--type-subheading)!important; }
.cfv-md :is(p,li) { font-size:var(--type-body-lg)!important; line-height:var(--type-leading-body); }

/* Essential captions use the contrast-safe muted token. Faint remains for
   disabled or purely decorative marks. */
:where(.kv,.eyebrow,small,.app-toast-context,.app-toast-meta,.notice-context,.thread-row-time) {
  color:var(--muted);
}

@media (max-width:760px) {
  /* Prevent mobile browser auto-zoom while retaining the selected role scale. */
  body :where(input,textarea,select) { font-size:max(1rem,var(--type-label))!important; }
}
