/*
 * CPOOL TYPOGRAPHY UNIFORM V9.1
 * Solo tipografia: non modifica menu, griglie, colori, dimensioni dei contenitori
 * o flussi applicativi.
 */

:root {
  --cpool-font-ui: Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;

  --cpool-type-page-title: 1.875rem;      /* 30 px */
  --cpool-type-section-title: 1.25rem;    /* 20 px */
  --cpool-type-subtitle: 1rem;            /* 16 px */
  --cpool-type-body: 0.875rem;            /* 14 px */
  --cpool-type-label: 0.8125rem;          /* 13 px */
  --cpool-type-small: 0.75rem;            /* 12 px */
  --cpool-type-micro: 0.6875rem;          /* 11 px */

  --cpool-weight-normal: 400;
  --cpool-weight-medium: 500;
  --cpool-weight-semibold: 600;
  --cpool-weight-bold: 700;
}

.cpool-typography-scope {
  font-family: var(--cpool-font-ui) !important;
  font-size: var(--cpool-type-body);
  font-weight: var(--cpool-weight-normal);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.cpool-typography-scope :where(
  button,
  input,
  select,
  textarea,
  option,
  optgroup,
  label,
  table,
  th,
  td,
  dialog,
  .btn,
  .badge,
  .menu,
  .navbar,
  .dropdown,
  .dropdown-content,
  .modal-box,
  .drawer,
  .tabs,
  .tab,
  .alert,
  .tooltip,
  .input,
  .select,
  .textarea,
  .table,
  .card,
  .stat,
  [class^="cpool-"],
  [class*=" cpool-"]
) {
  font-family: var(--cpool-font-ui) !important;
}

/* Titolo principale: identico in tutte le sezioni. */
.cpool-typography-scope :where(h1, .cpool-page-title) {
  margin-top: 0;
  font-size: var(--cpool-type-page-title) !important;
  font-weight: var(--cpool-weight-bold) !important;
  line-height: 1.2 !important;
  letter-spacing: -0.025em !important;
}

/* Titoli delle sezioni e delle schede. */
.cpool-typography-scope :where(h2, .cpool-section-title) {
  font-size: var(--cpool-type-section-title) !important;
  font-weight: var(--cpool-weight-bold) !important;
  line-height: 1.3 !important;
  letter-spacing: -0.015em !important;
}

/* Sottosezioni. */
.cpool-typography-scope :where(h3, .cpool-subsection-title) {
  font-size: var(--cpool-type-subtitle) !important;
  font-weight: var(--cpool-weight-semibold) !important;
  line-height: 1.4 !important;
  letter-spacing: -0.005em !important;
}

.cpool-typography-scope :where(h4, h5, h6) {
  font-size: var(--cpool-type-body) !important;
  font-weight: var(--cpool-weight-semibold) !important;
  line-height: 1.45 !important;
}

/* Testo ordinario: peso normale, senza grassetti casuali. */
.cpool-typography-scope :where(
  p,
  li,
  dd,
  dt,
  td,
  input,
  select,
  textarea,
  option
) {
  font-size: var(--cpool-type-body);
  font-weight: var(--cpool-weight-normal);
  line-height: 1.55;
}

.cpool-typography-scope :where(label, .label, .cpool-field-label) {
  font-size: var(--cpool-type-label) !important;
  font-weight: var(--cpool-weight-semibold) !important;
  line-height: 1.4 !important;
}

.cpool-typography-scope :where(
  small,
  .text-xs,
  .cpool-help,
  .cpool-field-help,
  .cpool-support-help,
  .cpool-support-chat-sub,
  .cpool-support-ticket-meta,
  .cpool-support-message-time
) {
  font-size: var(--cpool-type-small) !important;
  font-weight: var(--cpool-weight-normal) !important;
  line-height: 1.45 !important;
}

/* Etichette introduttive sopra ai titoli. */
.cpool-typography-scope :where(
  .cpool-support-eyebrow,
  .cpool-v2-eyebrow,
  .cpool-eyebrow,
  [class$="-eyebrow"]
) {
  font-size: var(--cpool-type-small) !important;
  font-weight: var(--cpool-weight-bold) !important;
  line-height: 1.3 !important;
  letter-spacing: 0.08em !important;
}

/* Pulsanti e navigazione: leggibili ma non eccessivamente pesanti. */
.cpool-typography-scope :where(
  button,
  .btn,
  [role="button"],
  .navbar a,
  .menu a,
  .tab
) {
  font-size: var(--cpool-type-label) !important;
  font-weight: var(--cpool-weight-semibold) !important;
  line-height: 1.2 !important;
  letter-spacing: 0 !important;
}

/* Tabelle coerenti. */
.cpool-typography-scope :where(th, .table th) {
  font-size: var(--cpool-type-small) !important;
  font-weight: var(--cpool-weight-bold) !important;
  line-height: 1.35 !important;
  letter-spacing: 0.035em !important;
}

.cpool-typography-scope :where(td, .table td) {
  font-size: var(--cpool-type-body) !important;
  font-weight: var(--cpool-weight-normal);
  line-height: 1.5 !important;
}

/* Badge e stati. */
.cpool-typography-scope :where(
  .badge,
  [class*="-badge"],
  [class*="status"],
  [class*="state"]
) {
  font-size: var(--cpool-type-micro) !important;
  font-weight: var(--cpool-weight-bold) !important;
  line-height: 1.2 !important;
  letter-spacing: 0.015em !important;
}

/* Testi descrittivi e secondari restano normali. */
.cpool-typography-scope :where(
  .text-base-content\/50,
  .text-base-content\/60,
  .text-base-content\/70,
  .cpool-muted,
  .cpool-description,
  .cpool-support-hero p,
  .cpool-v2-hero p
) {
  font-weight: var(--cpool-weight-normal) !important;
}

/* Grassetto solo quando semanticamente richiesto. */
.cpool-typography-scope :where(strong, b) {
  font-weight: var(--cpool-weight-bold);
}

/* Uniformità esplicita della sezione Assistenza. */
.cpool-typography-scope .cpool-support-hero h1 {
  font-size: var(--cpool-type-page-title) !important;
  font-weight: var(--cpool-weight-bold) !important;
}

.cpool-typography-scope :where(
  .cpool-support-sidebar-head h2,
  .cpool-support-chat-head h2,
  .cpool-support-empty h2
) {
  font-size: var(--cpool-type-section-title) !important;
  font-weight: var(--cpool-weight-bold) !important;
}

.cpool-typography-scope :where(
  .cpool-support-ticket strong,
  .cpool-support-message-author,
  .cpool-support-attachment
) {
  font-weight: var(--cpool-weight-semibold) !important;
}

.cpool-typography-scope .cpool-support-bubble {
  font-size: var(--cpool-type-body) !important;
  font-weight: var(--cpool-weight-normal) !important;
  line-height: 1.55 !important;
}

/* Il titolo resta uniforme anche su mobile: cambia solo leggermente la scala. */
@media (max-width: 640px) {
  :root {
    --cpool-type-page-title: 1.625rem;   /* 26 px */
    --cpool-type-section-title: 1.125rem;/* 18 px */
  }
}

/*
 * Esclusioni intenzionali: contenuto dei documenti, editor, PDF e codice.
 * La tipografia dell'interfaccia non deve alterare il documento prodotto.
 */
.cpool-typography-scope :where(
  .ProseMirror,
  [contenteditable="true"],
  .pdf-viewer,
  .document-canvas,
  [data-document-editor],
  [data-pdf-viewer]
),
.cpool-typography-scope :where(
  .ProseMirror *,
  [contenteditable="true"] *,
  .pdf-viewer *,
  .document-canvas *,
  [data-document-editor] *,
  [data-pdf-viewer] *
) {
  font-family: revert !important;
  font-size: revert;
  font-weight: revert;
  line-height: revert;
  letter-spacing: revert;
}

.cpool-typography-scope :where(code, pre, kbd, samp, .font-mono) {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace !important;
}
