/* Color converter - a live swatch plus live-linked HEX / RGB / HSL / alpha fields.
   Reuses base .btn-outline; colors come from theme tokens only. The swatch background is
   set by JS; the checkerboard behind it is built from theme tokens so transparency reads. */

.clr-intro { color: var(--muted); max-width: 64ch; margin: 8px 0 24px; }

/* Swatch beside the fields on wide screens, stacked on narrow. */
.clr-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
@media (max-width: 720px) { .clr-layout { grid-template-columns: 1fr; } }

/* The wrap holds the token-based checkerboard so transparency is visible; the swatch sits
   on top with its (inline, JS-set) color background, which paints over the checkerboard. */
.clr-swatch-wrap {
    min-width: 0; border-radius: 14px; overflow: hidden;
    border: 1px solid var(--border);
    background-color: var(--surface);
    background-image:
        conic-gradient(var(--border) 25%, transparent 0 50%, var(--border) 0 75%, transparent 0);
    background-size: 20px 20px;
}

/* Sizeable rounded swatch; JS sets style.background to rgb(... / alpha) so any transparency
   lets the checkerboard underneath show through. */
.clr-swatch { width: 100%; min-height: 180px; }

/* The format groups: two across on wide screens, one column on narrow. */
.clr-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; min-width: 0; }
@media (max-width: 540px) { .clr-grid { grid-template-columns: 1fr; } }

.clr-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.clr-group-head { display: flex; align-items: center; justify-content: space-between; min-height: 28px; }
.clr-label { font-size: 14px; color: var(--muted); font-weight: 600; }

.clr-input {
    width: 100%; box-sizing: border-box; padding: 12px;
    font-family: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
    font-size: 16px; font-weight: 600; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    font-variant-numeric: tabular-nums;
}
.clr-input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

/* Three channels side by side (R/G/B, H/S/L). */
.clr-channels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.clr-channel { padding: 10px; text-align: center; }

/* Alpha: slider takes the room, number sits at the end. */
.clr-alpha { display: flex; align-items: center; gap: 12px; }
.clr-range { flex: 1 1 auto; min-width: 0; accent-color: var(--accent); }
.clr-alpha .clr-channel { flex: 0 0 88px; }

.clr-actions { margin: 24px 0 0; }

/* Copy button mirrors the small toggle style used by the JSON formatter. */
.clr-copy {
    font: inherit; font-size: 13px; padding: 4px 12px; cursor: pointer;
    border: 1px solid var(--border-strong); border-radius: 8px;
    background: var(--surface); color: var(--text);
    transition: border-color .15s, background .15s, color .15s;
}
.clr-copy:hover { border-color: var(--accent); color: var(--accent-strong); }
