/* Type Scale Calculator: styles for this tool only.
   The page shell (workspace, #stage, side panel and its mobile behaviour) comes from
   /tools/shared/css/pdf.css; shared components come from /tools/shared/tools.css. */

body {
  font-variant-numeric: tabular-nums;
}

/* ---------- preview: only the step rows, straight on the page background ---------- */

.ts-scroll {
  --label-col: 9.5rem; /* the step labels, and the "Text preview" label above them */
  --col-gap: var(--space-4);
  flex: 1;
  padding: var(--space-4) var(--space-8) var(--space-12);
}
/* One grid definition for the text field row and every step row, so the columns can't drift apart */
.sample-field,
.step {
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, 1fr);
  column-gap: var(--col-gap);
  align-items: center;
}
.sample-field {
  padding-bottom: var(--space-2);
}
.sample-label {
  font-size: var(--text-sm);
  color: var(--color-muted);
}
.sample-field .field {
  height: 2.75rem;
}
/* Preview width (fluid only): same row structure as Text preview, with the shared slider (.slider) */
.pv-row {
  padding-top: var(--space-3); /* air between Text preview and Preview width */
  padding-bottom: var(--space-6); /* and between the slider and the first step */
}
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
}
.step {
  padding: var(--space-4) 0;
}
.step + .step {
  border-top: 1px solid var(--color-border);
}
.step .meta {
  min-width: 0;
}
.step .name {
  display: block;
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--color-ink);
}
.step.is-base .name {
  color: var(--color-accent);
}
.step .vals {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-muted);
}
.step .at {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-muted);
  opacity: 0.85;
}
.step .sample {
  min-width: 0;
  line-height: 1.1;
  color: var(--color-ink);
  overflow-wrap: anywhere;
}
.steps-empty {
  padding: var(--space-8) 0;
  text-align: center;
  color: var(--color-muted);
}

/* ---------- settings panel ---------- */
/* One pattern for every control: a label above it (--space-2 gap), a 2.75rem control,
   and --space-4 between rows. Two-column rows share one grid, so both sides line up. */

@media (min-width: 861px) {
  body.panel-open .panel {
    width: clamp(20rem, 32%, 28rem);
  }
}
.panel-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4) var(--space-3);
  align-content: start;
  align-items: start;
  padding-top: var(--space-2);
  padding-bottom: var(--space-4);
}
.panel-body > * {
  min-width: 0;
}
.panel-body .f {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}
.panel-body .f.full,
.panel-body .note,
.panel-body .settings {
  grid-column: 1 / -1;
}
/* Settings table: one column in static mode; in fluid mode a Small screen and a Large screen column.
   Each row is a label above its controls, so rows keep the panel's 16px gap and labels their 8px gap. */
.panel-body .settings {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}
.srow {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2) var(--space-3);
  align-items: start;
}
.settings[data-mode="fluid"] .srow {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
/* Fluid mode: the Small screen / Large screen table sits in its own bordered box */
.panel-body .settings[data-mode="fluid"] {
  padding: 16px;
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-2xl);
}
.srow > .field-label,
.srow > .label-info {
  grid-column: 1 / -1;
}
.srow .cell {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}
.col-head {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  line-height: 1.25rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.panel-body .field-label {
  padding: 0;
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: 1.25rem;
  color: var(--color-muted);
}
.panel-body .field,
.panel-body select.select,
.panel-body .dropdown-btn,
.panel-body .segmented {
  height: 2.75rem;
  box-sizing: border-box;
}
.panel-body .segmented {
  align-items: stretch;
}
.panel-body .segmented button {
  padding: 0 var(--space-2);
}
/* In a narrow column the name is cut with an ellipsis; the value and the chevron always stay visible */
.panel-body .dropdown-btn .dropdown-name {
  min-width: 0;
}
.panel-body .dropdown-btn .dropdown-meta,
.panel-body .dropdown-btn .icon {
  flex: none;
}
.panel-body [hidden] {
  display: none;
}
.panel-body .export {
  gap: var(--space-2);
}
/* "Export settings": a line above it and generous space around it */
.panel-body .sub-head {
  margin: var(--space-4) 0 var(--space-2);
  padding: var(--space-6) 0 0;
  border-top: 1px solid var(--color-border);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  line-height: 1.25rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.label-info {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.info-btn {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin: -2px 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-muted);
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.info-btn:hover,
.info-btn:focus-visible,
.info-btn.is-open {
  opacity: 1;
}
.info-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}
.info-btn .icon {
  width: 13px;
  height: 13px;
}
/* Tooltip for the (i) buttons. Moved to <body> by type-scale.js and placed next to its button, so the panel's
   scrolling and transforms cannot clip or offset it. */
.info-tip {
  position: fixed;
  z-index: 60;
  max-width: min(18rem, calc(100vw - 16px));
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-ink);
  color: var(--color-bg);
  font-size: var(--text-sm);
  line-height: 1.4;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}
.info-tip[hidden] {
  display: none;
}
.hint {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--color-muted);
}
.note {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--color-warning);
}
.code {
  margin: 0;
  max-height: 18rem;
  min-height: 6rem;
  padding: var(--space-3);
  overflow: auto;
  border-radius: var(--radius-lg);
  background: var(--color-field);
  color: var(--color-ink);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.65;
  white-space: pre;
  tab-size: 2;
}

/* ---------- small screens ---------- */

@media (max-width: 860px) {
  .ts-scroll {
    padding: var(--space-3) var(--space-4) var(--space-8);
  }
}
@media (max-width: 560px) {
  .sample-field,
  .step {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--space-1);
  }
  .step {
    padding: var(--space-3) 0;
  }
  .step .meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 var(--space-3);
  }
  .step .at {
    flex-basis: 100%;
  }
}
