/* Phase 4: accessible typography, leaving approved image layers and panel sizes intact. */
:root {
  --asteria-typography-scale: 1;
  --asteria-root-font-size: 100%;
}
/* Respect browser font-size preferences: 100% is the user's chosen base,
   unlike a fixed 16px body size. Rem-based UI also follows the slider. */
html { font-size: var(--asteria-root-font-size); }
body {
  font-family: var(--asteria-font-body) !important;
}
button, input, select, textarea, [role="button"],
.asteria-library, .clean-compendium-shell, .clean-page,
.react-workspace-shell, .react-dashboard-panel {
  font-family: var(--asteria-font-body) !important;
}
main h1, main h2, .asteria-library h3,
#settingsPanel .theme-settings-section h3 {
  font-family: var(--asteria-font-display) !important;
}
/* Fixed-space gameplay panel labels remain readable even with decorative scripts. */
main .react-dashboard-custom-cell h1,
main .react-dashboard-custom-cell h2,
main .react-dashboard-custom-cell h3 {
  font-family: var(--asteria-font-body) !important;
}
.asteria-typography-controls {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  min-width: 0;
  color: var(--asteria-text);
}
.asteria-typography-help {
  margin: 0;
  font-size: .9rem;
  line-height: 1.5;
}
.asteria-typography-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 14px;
}
.asteria-typography-fields label {
  min-width: 0;
  display: grid;
  gap: 7px;
  font: 600 .9rem/1.4 ui-sans-serif, system-ui, sans-serif !important;
}
.asteria-typography-fields select,
.asteria-typography-fields input[type="range"] {
  width: 100%;
  max-width: 100%;
}
.asteria-typography-fields select {
  min-height: 44px;
  padding: 8px 10px;
  background: #08131d;
  color: #f5e8ce;
  border: 1px solid var(--asteria-border);
  border-radius: 6px;
  font: 400 .92rem/1.4 ui-sans-serif, system-ui, sans-serif !important;
}
.asteria-typography-fields output {
  margin-left: 8px;
  color: var(--asteria-gold);
  font-variant-numeric: tabular-nums;
}
.asteria-typography-preview {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--asteria-border);
  border-radius: 8px;
  background: rgba(3, 12, 18, .77);
  overflow-wrap: anywhere;
}
.asteria-typography-preview h3 {
  font-family: var(--asteria-font-display) !important;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 400;
  line-height: 1.35;
  margin: 0 0 12px;
}
.asteria-typography-preview p {
  font-family: var(--asteria-font-body) !important;
  font-size: 1rem;
  line-height: 1.65;
  margin: 0;
}
.asteria-typography-reset {
  justify-self: start;
  min-height: 44px;
}
#asteriaTypographyMenu {
  border: 1px solid rgba(188, 138, 57, .32);
  border-radius: 14px;
  padding: 14px;
}
#asteriaTypographyMenu > h3 { margin: 0; }
.workspace-gallery-open {
  min-height: 44px;
  margin-top: 12px;
}
@media (max-width: 620px) {
  .asteria-typography-fields { grid-template-columns: minmax(0, 1fr); }
  .asteria-typography-preview { padding: 12px; }
}

/* Optional font catalogue: previews render in the selected family, but never
   change the shape or artwork of dashboard cards or crystal buttons. */
.asteria-typography-font-status:empty { display:none; }
.asteria-typography-font-status:not(:empty) {
  color:var(--asteria-text-muted);
  margin:0;
  line-height:1.45;
}
.asteria-typography-gallery {
  min-width:0;
  border:1px solid var(--asteria-border);
  border-radius:8px;
  background:rgba(4,13,21,.72);
  overflow:hidden;
}
.asteria-typography-gallery > summary {
  padding:12px 14px;
  cursor:pointer;
  min-height:44px;
  font:600 .92rem/1.4 ui-sans-serif, system-ui, sans-serif;
}
.asteria-typography-gallery > summary:focus-visible {
  outline:2px solid var(--asteria-border-active);
  outline-offset:-3px;
}
.asteria-typography-gallery > p {
  margin:0;
  padding:0 14px 12px;
  font-size:.86rem;
  line-height:1.5;
}
.asteria-typography-samples {
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:10px;
  padding:0 12px 12px;
}
.asteria-typography-sample {
  display:grid;
  gap:10px;
  min-width:0;
  padding:12px;
  border:1px solid var(--asteria-border-subtle);
  border-radius:6px;
  background:rgba(3,11,19,.78);
}
.asteria-typography-sample-name {
  font:600 .85rem/1.45 ui-sans-serif, system-ui, sans-serif;
}
.asteria-typography-sample-line {
  font-size:clamp(1.18rem,3vw,1.65rem);
  font-weight:400;
  line-height:1.45;
  overflow-wrap:anywhere;
  margin:0;
}
.asteria-typography-sample-actions {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}
.asteria-typography-sample-actions button {
  flex:1 1 135px;
  min-height:44px;
  font:600 .82rem/1.3 ui-sans-serif, system-ui, sans-serif !important;
  white-space:normal;
}
.asteria-typography-sample-actions button[aria-pressed="true"] {
  border-color:var(--asteria-border-active) !important;
  box-shadow:var(--asteria-focus);
}
.asteria-typography-sample-actions small {
  color:var(--asteria-text-muted);
  line-height:1.4;
}
@media (max-width:620px) {
  .asteria-typography-samples {padding-inline:8px;}
  .asteria-typography-sample {padding:10px;}
  .asteria-typography-preview h3 {font-size:clamp(1.15rem,5vw,1.65rem);}
}
