/* ============================================================
   color-converters.css - shared look for the color format converter family
   (color-converter, hex-to-rgb, rgb-to-hex, hex-to-hsl, hsl-to-hex-converter,
   hex-to-hsv, bulk-color-converter). Pairs with assets/js/color-converters.js.
   Loads after common.min.css. Served as-is (no .min copy).
   ============================================================ */
.cv-row[hidden], .cv-note[hidden], .cv-error[hidden], .cv-panel[hidden], .cv-empty[hidden],
.cv-help[hidden], .cv-bar[hidden], .cv-tile[hidden] { display: none !important; }

/* ---------- Sidebar: channel rows (label + number, slider below) ---------- */
.cv-channel { margin-bottom: 0.85rem; }
.cv-channel__head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.cv-channel__head .label { margin: 0 !important; }
.cv-channel__num {
  flex: none;
  width: 5.25rem !important;
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  -moz-appearance: textfield;
}
.cv-channel__num::-webkit-outer-spin-button,
.cv-channel__num::-webkit-inner-spin-button { opacity: 0.6; }
.cv-channel.is-invalid .cv-channel__num { box-shadow: 0 0 0 1px inset #dc2626; }
.cv-channel__unit { font-size: 0.8125rem; color: #6b7280; margin-left: 0.25rem; }
.cv-channel__numwrap { display: inline-flex; align-items: center; }
/* Gradient track: the inline background is set by JS (shows where the channel travels). */
.cv-channel .slider { height: 0.75rem; margin: 0.45rem 0 0; box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.1); }
.cv-checker-track {
  background-image: linear-gradient(45deg, #e5e7eb 25%, transparent 25%), linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e5e7eb 75%), linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
}
.cv-subhead { margin-top: 1.25rem !important; }
.cv-help { display: block; margin-top: 0.3rem; font-size: 0.75rem; line-height: 1.45; color: #4b5563; }
.cv-error { display: block; margin-top: 0.35rem; font-size: 0.8125rem; line-height: 1.4; color: #b91c1c; }

/* Example chips (quick inputs) */
.cv-chips { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.cv-chip {
  display: inline-flex; align-items: center; gap: 0.375rem;
  min-height: 2rem; padding: 0.25rem 0.6rem 0.25rem 0.3rem;
  border: 1px solid #e5e7eb; border-radius: 999px;
  background: #fff; color: #374151; cursor: pointer;
  font: 600 0.75rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.cv-chip:hover { border-color: #a5b4fc; background: #f5f7ff; }
.cv-chip:focus-visible { outline: 2px solid #4f46e5; outline-offset: 2px; }
.cv-chip__dot { width: 1.25rem; height: 1.25rem; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); flex: none; }

/* ---------- Preview ---------- */
.cv-preview {
  position: relative;
  height: clamp(150px, 24vw, 200px);
  border-radius: 12px;
  overflow: hidden;
  background-color: #fff;
  background-image: linear-gradient(45deg, #e5e7eb 25%, transparent 25%), linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e5e7eb 75%), linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.08);
}
.cv-preview__fill { position: absolute; inset: 0; background: var(--cv-color, #3273dc); }
.cv-preview__text {
  position: absolute; left: 1rem; right: 4.25rem; bottom: 0.9rem;
  color: var(--cv-ink, #fff);
}
.cv-preview__value {
  display: block;
  font: 700 clamp(1.05rem, 3.2vw, 1.5rem)/1.25 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}
.cv-preview__sub { display: block; margin-top: 0.2rem; font-size: 0.875rem; font-weight: 600; opacity: 0.92; overflow-wrap: anywhere; }
.cv-preview__info {
  position: absolute; top: 0.6rem; right: 0.6rem;
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.92); color: #374151;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.cv-preview__info:hover { background: #fff; color: #4338ca; }
.cv-preview__info:focus-visible { outline: 2px solid #4f46e5; outline-offset: 2px; }
.cv-note { margin: 0.6rem 0 0; font-size: 0.8125rem; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 0.5rem; padding: 0.45rem 0.7rem; }

/* ---------- Result value cards ---------- */
.cv-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14.5rem), 1fr));
  gap: 0.6rem;
  margin-top: 1rem;
}
.cv-row {
  display: flex; align-items: center; gap: 0.5rem;
  min-width: 0;
  padding: 0.55rem 0.5rem 0.55rem 0.8rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 0.6rem;
}
.cv-row.is-primary { grid-column: 1 / -1; background: #eef2ff; border-color: #c7d2fe; }
.cv-row__body { flex: 1; min-width: 0; }
.cv-row__label {
  display: block;
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: #4b5563;
}
.cv-row__value {
  display: block;
  margin-top: 0.1rem;
  font: 600 0.9rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #111827;
  overflow-wrap: anywhere;
  cursor: copy;
}
.cv-row.is-primary .cv-row__value { font-size: clamp(1.05rem, 2.6vw, 1.3rem); font-weight: 700; color: #1e1b4b; }
.cv-row .copy-btn { flex: none; width: 2.25rem; height: 2.25rem; border-radius: 0.375rem; }
.cv-row .copy-btn:hover { background: #e0e7ff; }
.cv-results-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 1rem; }
.cv-results-head .seg-tabs { margin-bottom: 0; }
.cv-results-head + .cv-results { margin-top: 0.6rem; }
.cv-caption { margin: 0; font-size: 0.8125rem; color: #4b5563; }

/* Channel tiles (H / S / L etc.) */
.cv-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 7.5rem), 1fr)); gap: 0.5rem; }
.cv-tile { display: flex; align-items: center; justify-content: space-between; gap: 0.25rem; padding: 0.5rem 0.4rem 0.5rem 0.75rem; border: 1px solid #e5e7eb; border-radius: 0.6rem; background: #fff; }
.cv-tile__label { display: block; font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #4b5563; }
.cv-tile__value { display: block; font: 700 1.05rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #111827; }
.cv-tile .copy-btn { width: 2.25rem; height: 2.25rem; }

/* ---------- Breakdown bars ---------- */
.cv-section-title { margin: 1.35rem 0 0.6rem !important; }
.cv-bars { display: grid; gap: 0.55rem; }
.cv-bar { display: grid; grid-template-columns: minmax(4.5rem, 7rem) 1fr auto; align-items: center; gap: 0.6rem; font-size: 0.8125rem; }
.cv-bar__name { font-weight: 600; color: #374151; }
.cv-bar__track { display: block; height: 0.6rem; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.cv-bar__fill { display: block; height: 100%; width: 0; border-radius: inherit; transition: width 0.2s ease; }
.cv-bar__val { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; color: #111827; text-align: right; min-width: 3.5rem; }
.cv-math { margin: 0.75rem 0 0; padding: 0.6rem 0.8rem; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 0.5rem; font: 0.8125rem/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #1f2937; overflow-x: auto; white-space: pre; }

/* Swatch scale (tints / shades / brightness steps) */
.cv-scale { display: grid; grid-template-columns: repeat(auto-fit, minmax(2.75rem, 1fr)); gap: 0.3rem; }
.cv-scale__swatch {
  min-height: 2.75rem; padding: 0.25rem;
  border: 0; border-radius: 0.45rem; cursor: pointer;
  font: 700 0.6875rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cv-scale__swatch:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(17, 24, 39, 0.18); }
.cv-scale__swatch:focus-visible { outline: 2px solid #4f46e5; outline-offset: 2px; }
.cv-scale__swatch.is-current { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #4f46e5; }

/* ---------- WCAG contrast cards ---------- */
.cv-contrast { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 0.75rem; }
.cv-contrast__card { border: 1px solid #e5e7eb; border-radius: 0.6rem; overflow: hidden; background: #fff; }
.cv-contrast__sample { padding: 0.9rem 1rem; }
.cv-contrast__sample strong { display: block; color: inherit; font-size: 1.125rem; line-height: 1.3; }
.cv-contrast__sample span { display: block; font-size: 0.875rem; margin-top: 0.15rem; }
.cv-contrast__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; padding: 0.7rem 1rem 0.8rem; border-top: 1px solid #e5e7eb; }
.cv-contrast__label { flex: 1 0 100%; font-size: 0.75rem; font-weight: 600; color: #4b5563; }
.cv-contrast__ratio { margin-right: auto; font: 700 1.2rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #111827; }
.cv-badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.2rem 0.5rem; border-radius: 999px; font-size: 0.6875rem; font-weight: 700; background: #f3f4f6; color: #374151; }
.cv-badge.is-pass { background: #dcfce7; color: #166534; }
.cv-badge.is-fail { background: #fee2e2; color: #991b1b; }

/* ---------- Code card extras ---------- */
.cv-code-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
.cv-code-head .seg-tabs { margin-bottom: 0; }
.cv-token { display: flex; align-items: center; gap: 0.5rem; }
.cv-token .label { margin: 0 !important; white-space: nowrap; }
.cv-token .input { width: 9.5rem; }

/* ---------- History chips (color converter) ---------- */
.cv-history { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-bottom: 0.6rem; }
.cv-history__empty { margin: 0 0 0.6rem; font-size: 0.8125rem; color: #6b7280; }

@media (pointer: coarse) {
  .cv-chip { min-height: 44px; }
  .cv-row .copy-btn, .cv-tile .copy-btn { width: 2.75rem; height: 2.75rem; }
  .cv-scale__swatch { min-height: 44px; }
}
@media (max-width: 768px) {
  .cv-token .input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .cv-bar__fill, .cv-scale__swatch, .cv-chip { transition: none; }
  .cv-scale__swatch:hover { transform: none; }
}
