/* V4.6.9.3 typography calibration — Apple-grade rhythm without touching logic */
:root{
  --type-ink-soft: color-mix(in srgb, var(--foreground) 72%, var(--desc));
  --type-ink-muted: color-mix(in srgb, var(--foreground) 52%, var(--desc));
  --type-title-soft: color-mix(in srgb, var(--foreground) 88%, var(--background));
}
html.dark{
  --type-ink-soft: color-mix(in srgb, var(--foreground) 76%, var(--desc));
  --type-ink-muted: color-mix(in srgb, var(--foreground) 58%, var(--desc));
  --type-title-soft: color-mix(in srgb, var(--foreground) 92%, var(--background));
}

html,body{
  letter-spacing:-0.011em;
  text-rendering:optimizeLegibility;
}
body,
.note-card,
.panel,
.detail-card,
.row,
.review-card,
.stream-card,
.section-card,
.metric,
.modal,
.drawer-pane,
.input,
.select,
button,
textarea{
  font-feature-settings:"kern" 1, "liga" 1, "calt" 1;
}

/* Global readable body rhythm */
.note-card,
.panel,
.detail-card,
.row,
.review-card,
.stream-card,
.section-card,
.modal,
.drawer-pane,
.resource-preview,
.comment-item,
.history-item,
.ref-item,
.attachment-card,
.file-fallback,
.upload-drop-hint,
.editor-shell,
.rich-editor,
.editor-input,
input,
textarea,
select{
  color:var(--type-ink-soft)!important;
}

p,
li,
.note-body,
.detail-body,
.rich-editor,
.editor-input,
textarea,
.input,
.select,
.result-item,
.qa-row,
.comment-item,
.history-item,
.ref-item,
.file-fallback,
.upload-drop-hint{
  line-height:1.62!important;
}

/* Titles — calmer, tighter, less template-like */
.topbar-title,
.detail-title,
.note-title,
.section-title,
.metric-title,
.review-title,
.modal-title,
.drawer-title,
.resource-title,
.command-title,
.page-title,
h1,h2,h3{
  color:var(--type-title-soft)!important;
  letter-spacing:-0.024em!important;
}

.topbar-title{
  font-size:17px!important;
  font-weight:700!important;
  line-height:1.15!important;
}

.detail-title,
.page-title,
h1{
  font-size:clamp(28px,3.2vw,36px)!important;
  font-weight:760!important;
  line-height:1.04!important;
}

.section-title,
h2{
  font-size:clamp(18px,2.2vw,22px)!important;
  font-weight:690!important;
  line-height:1.14!important;
}

.note-title,
.review-title,
.resource-title,
.modal-title,
.drawer-title,
h3{
  font-size:15.5px!important;
  font-weight:680!important;
  line-height:1.28!important;
}

.metric-title{
  font-size:12px!important;
  font-weight:650!important;
  letter-spacing:0.02em!important;
  text-transform:uppercase!important;
  opacity:.78!important;
}

/* Card copy and metadata */
.note-excerpt,
.note-body,
.detail-body,
.resource-meta,
.note-meta,
.card-meta,
.result-meta,
.qa-meta,
.muted,
.desc,
.helper,
.caption,
.small,
.form-hint,
.empty-copy,
.sidebar-section-copy{
  color:var(--type-ink-muted)!important;
}

.note-excerpt,
.note-body,
.detail-body,
.resource-meta,
.card-meta,
.result-item,
.qa-row{
  font-size:14.5px!important;
}

.note-meta,
.result-meta,
.qa-meta,
.helper,
.caption,
.form-hint,
.small{
  font-size:12.5px!important;
  line-height:1.45!important;
  letter-spacing:-0.005em!important;
}

/* Sidebar / navigation copy */
.sidebar-section-title{
  font-size:10.5px!important;
  font-weight:700!important;
  letter-spacing:0.14em!important;
  text-transform:uppercase!important;
}

.nav-item,
.segment-chip,
.tag-chip,
.chip,
.secondary-btn,
.primary-btn,
button{
  letter-spacing:-0.012em!important;
}

.nav-item{
  font-size:14px!important;
  font-weight:620!important;
}

.segment-chip,
.tag-chip,
.chip{
  font-size:12.5px!important;
  font-weight:640!important;
}

.primary-btn,
.secondary-btn,
button.icon-btn{
  font-size:13.5px!important;
  font-weight:640!important;
}

/* Form rhythm */
input,
textarea,
select,
.input,
.select,
.input-tagbox,
.editor-input,
.rich-editor{
  font-size:14.5px!important;
  font-weight:500!important;
  line-height:1.6!important;
}

textarea,
.editor-input,
.rich-editor{
  letter-spacing:-0.012em!important;
}

input::placeholder,
textarea::placeholder,
.input::placeholder{
  color:color-mix(in srgb, var(--desc) 78%, transparent)!important;
}

/* Numerical emphasis */
.metric-value,
.kpi-value,
.stat-value,
.synapse-kpi-value,
.review-progress-value{
  letter-spacing:-0.03em!important;
  font-weight:760!important;
  line-height:1!important;
  color:var(--type-title-soft)!important;
}

/* Tables / dense rows */
.table,
table,
th,
td,
.row,
.result-item,
.qa-row{
  letter-spacing:-0.01em!important;
}

/* Mobile calibration */
@media (max-width: 860px){
  .detail-title,
  .page-title,
  h1{
    font-size:clamp(24px,7.2vw,30px)!important;
  }

  .section-title,
  h2{
    font-size:17px!important;
  }

  .note-title,
  .review-title,
  .resource-title,
  .modal-title,
  .drawer-title,
  h3{
    font-size:15px!important;
  }

  .note-excerpt,
  .note-body,
  .detail-body,
  .resource-meta,
  .card-meta,
  .result-item,
  .qa-row,
  input,
  textarea,
  select,
  .input,
  .select,
  .input-tagbox,
  .editor-input,
  .rich-editor{
    font-size:14px!important;
  }
}
