/* Shared styles for preview cards.
   Cards are fluid-width up to 700px. Cards inherit colors_and_type.css. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--color-text-body);
  background: var(--sl-white);
}

.card {
  width: 100%;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--sl-white);
}

.swatch-row {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.swatch {
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.swatch .step { font-size: 11px; }
.swatch .hex { font-size: 9px; font-weight: 400; opacity: 0.85; font-family: var(--font-mono); letter-spacing: 0; }
.swatch.light { color: var(--sl-indigo-900); }
.swatch.dark { color: var(--sl-white); }

.row-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}
.row-label .name {
  font-weight: 800;
  font-size: 14px;
  color: var(--color-text-heading);
}
.row-label .meta {
  font-size: 11px;
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
}

/* ── Checkbox ──────────────────────────────────────────────────
   Canonical checkbox shared by the Checkbox component, Tree, and
   Tree select. Edit here once — every consumer updates together.
   Default 20px; add .sl-checkbox--dense for the 16px table / tree /
   popover size. State classes: is-checked, is-indeterminate,
   is-disabled, is-error, is-hover, is-focus. */
.sl-checkbox {
  width: 20px; height: 20px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--sl-grey-600);
  background: var(--sl-white);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sl-checkbox.is-hover { border-color: var(--sl-blue-600); }
.sl-checkbox.is-focus { box-shadow: var(--shadow-focus-ring); }
.sl-checkbox.is-checked { background: var(--sl-blue-600); border-color: var(--sl-blue-600); }
.sl-checkbox.is-checked::after {
  content: ''; width: 12px; height: 7px; transform: rotate(-45deg) translate(1px, -1px);
  border-left: 2px solid var(--sl-white); border-bottom: 2px solid var(--sl-white);
}
.sl-checkbox.is-indeterminate { background: var(--sl-blue-600); border-color: var(--sl-blue-600); }
.sl-checkbox.is-indeterminate::after {
  content: ''; width: 10px; height: 2px; background: var(--sl-white); border-radius: 1px;
}
.sl-checkbox.is-error { border-color: var(--sl-red-600); }
.sl-checkbox.is-disabled { background: var(--sl-grey-100); border-color: var(--sl-grey-300); }
.sl-checkbox.is-disabled.is-checked { background: var(--sl-blue-200); border-color: var(--sl-blue-200); }
.sl-checkbox.is-disabled.is-checked::after { border-color: var(--sl-blue-400); }
.sl-checkbox.is-disabled.is-indeterminate { background: var(--sl-blue-200); border-color: var(--sl-blue-200); }
.sl-checkbox.is-disabled.is-indeterminate::after { background: var(--sl-blue-400); }

/* Dense 16px — radius stays 4px; only the box + glyph scale down. */
.sl-checkbox--dense { width: 16px; height: 16px; }
.sl-checkbox--dense.is-checked::after { width: 8px; height: 4px; }
.sl-checkbox--dense.is-indeterminate::after { width: 8px; }

/* ── Number input ──────────────────────────────────────────────
   Canonical number input shared by the Number input component and
   the Slider's paired-value row. Edit here once — every consumer
   updates together. State classes: focus, error. Add
   .sl-number--left to left-align the value (use with a prefix). */
.sl-number {
  height: var(--field-height-md);
  border-radius: var(--field-radius);
  border: 1px solid var(--field-border-default);
  background: var(--field-bg-default);
  display: inline-flex; align-items: stretch;
  transition: border-color 150ms, box-shadow 150ms;
  width: 100%;
}
.sl-number:hover { border-color: var(--field-border-hover); }
.sl-number.focus { border-color: var(--field-border-focus); box-shadow: var(--ring-focus); }
.sl-number.error { border-color: var(--field-border-error); }

.sl-number .affix {
  display: inline-flex; align-items: center;
  padding: 0 12px;
  background: var(--sl-grey-100);
  color: var(--color-text-subtle);
  font: 400 14px/22px var(--font-sans);
  flex: none;
  border-right: 1px solid var(--sl-grey-200);
}
.sl-number .affix.suffix { border-right: 0; border-left: 1px solid var(--sl-grey-200); }
.sl-number input {
  border: 0; outline: 0; background: transparent;
  padding: 0 var(--field-padding-x);
  flex: 1; min-width: 0;
  font: 400 14px/22px var(--font-mono);
  color: var(--field-text-default);
  text-align: right;
}
.sl-number--left input { text-align: left; }

/* Suppress the browser's own spinner. The component draws its own stepper
   when it wants one, and the native buttons otherwise sit on top of the
   value and clip it. */
.sl-number input::-webkit-outer-spin-button,
.sl-number input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sl-number input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* Size the field to the widest value it can actually hold, rather than a
   round guess. Set --digits to the character count of the longest legal
   value, counting the decimal point and any minus sign. The value font is
   monospace, so 1ch is exactly one digit. */
.sl-number--fit { width: auto; }
.sl-number--fit input {
  flex: none;
  /* + 2px leaves room for the caret so the last digit is never clipped. */
  width: calc(var(--digits, 4) * 1ch + var(--field-padding-x) * 2 + 2px);
}

.sl-number .stepper {
  display: flex; flex-direction: column;
  border-left: 1px solid var(--sl-grey-200);
  flex: none;
}
.sl-number .stepper button {
  width: 24px; height: 50%;
  border: 0; background: transparent;
  color: var(--color-text-body);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
}
.sl-number .stepper button:hover { background: var(--sl-grey-100); }
.sl-number .stepper button:first-child { border-bottom: 1px solid var(--sl-grey-200); }
.sl-number .stepper svg { width: 10px; height: 10px; }

/* ── Spinner ───────────────────────────────────────────────────
   Comet-tail loader. A conic gradient ramps from transparent to
   currentColor over a full revolution, masked into a ring; a small
   "head" dot caps the seam so the comet reads as one tapered tail.
   Default 24px (md). Sizes scale width/height and ring thickness
   (--sl-spin-thick) together. Blue-600 for all loading; see
   components-spinner.html for when to use another tone. */
.sl-spinner {
  --sl-spin-thick: 1.25px;
  position: relative;
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: var(--sl-blue-600);
  background: conic-gradient(from 0deg, transparent 0deg, currentColor 360deg);
  -webkit-mask: radial-gradient(circle, transparent calc(50% - var(--sl-spin-thick)), #000 calc(50% - var(--sl-spin-thick) + 0.5px));
          mask: radial-gradient(circle, transparent calc(50% - var(--sl-spin-thick)), #000 calc(50% - var(--sl-spin-thick) + 0.5px));
  animation: sl-spin 1.1s linear infinite;
  flex: none;
}
.sl-spinner::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--sl-spin-thick);
  height: var(--sl-spin-thick);
  border-radius: 50%;
  background: currentColor;
  transform: translateX(-50%);
}
/* Legacy: any inner <svg> from older markup is hidden. */
.sl-spinner svg { display: none; }
@keyframes sl-spin { to { transform: rotate(360deg); } }
/* Respect reduced motion — slow further */
@media (prefers-reduced-motion: reduce) { .sl-spinner { animation-duration: 2.8s; } }

.sl-spinner--xs { width: 12px; height: 12px; --sl-spin-thick: 1px; }
.sl-spinner--sm { width: 16px; height: 16px; --sl-spin-thick: 1px; }
.sl-spinner--md { width: 24px; height: 24px; --sl-spin-thick: 1.25px; }    /* default */
.sl-spinner--lg { width: 40px; height: 40px; --sl-spin-thick: 1.5px; }
.sl-spinner--xl { width: 64px; height: 64px; --sl-spin-thick: 2px; }

.sl-spinner--brand   { color: var(--sl-blue-600); }       /* default — all loading */
/* DEPRECATED: teal is the focus color, not a loading color. Kept only so
   existing consumers don't break; do not use it on new work. */
.sl-spinner--teal    { color: var(--sl-teal-600); }
.sl-spinner--ai      { color: var(--ai-accent); }
.sl-spinner--success { color: var(--sl-green-600); }
.sl-spinner--warning { color: var(--sl-yellow-700); }
.sl-spinner--danger  { color: var(--sl-red-600); }
.sl-spinner--subtle  { color: var(--sl-grey-500); }
.sl-spinner--inverse { color: var(--sl-white); }
