/* =============================================================================
   9UY COLOUR — styles.css
   ============================================================================= */

/* ---- Suite base ---------------------------------------------------------- */
.block-cursor {
    display: inline-block;
    width: 0.6ch;
    height: 0.9em;
    background: #ffffff;
    vertical-align: middle;
    margin-left: 4px;
    animation: cursor-blink 1s step-end infinite;
}
@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.scanline {
    width: 100%;
    height: 100px;
    z-index: 1000;
    background: linear-gradient(0deg, transparent 0%, rgba(255,255,255,0.02) 50%, transparent 100%);
    opacity: 0.1;
    position: fixed;
    top: -100px;
    left: 0;
    pointer-events: none;
    animation: scanline 10s linear infinite;
}
@keyframes scanline {
    to { top: 100vh; }
}

::selection { background: #ffffff; color: #000000; }

/* ---- Picker canvas ------------------------------------------------------- */
#picker-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    cursor: crosshair;
    border-radius: 4px;
    overflow: hidden;
}
#picker-canvas {
    display: block;
    width: 100%;
    height: 100%;
}
#picker-thumb {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1.5px rgba(0,0,0,0.6), 0 2px 6px rgba(0,0,0,0.5);
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: box-shadow 0.1s ease;
}

/* ---- Sliders ------------------------------------------------------------- */
.slider-wrap {
    position: relative;
    height: 14px;
    border-radius: 7px;
    cursor: pointer;
    overflow: hidden;
}
.slider-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
}
.slider-thumb {
    position: absolute;
    top: 50%;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid rgba(0,0,0,0.25);
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* ---- Checkerboard (alpha/transparent) ------------------------------------ */
.checker {
    background-image:
        linear-gradient(45deg, #555 25%, transparent 25%),
        linear-gradient(-45deg, #555 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #555 75%),
        linear-gradient(-45deg, transparent 75%, #555 75%);
    background-size: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0;
    background-color: #333;
}

/* ---- Format display ------------------------------------------------------ */
.format-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #1f2937;
}
.format-row:last-child { border-bottom: none; }
.format-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #4b5563;
    width: 52px;
    flex-shrink: 0;
}
.format-value {
    flex: 1;
    font-family: ui-monospace, monospace;
    font-size: 11px;
    color: #e5e7eb;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: default;
    user-select: all;
}
.format-copy-btn {
    flex-shrink: 0;
    color: #4b5563;
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    transition: color 0.1s, background 0.1s;
}
.format-copy-btn:hover { color: #fff; background: #1f2937; }

/* ---- Named colour dot ---------------------------------------------------- */
.colour-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    flex-shrink: 0;
}
.colour-dot.exact { background: currentColor; }

/* ---- Contrast checker ---------------------------------------------------- */
.swatch-btn {
    flex: 1;
    height: 56px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s;
    position: relative;
}
.swatch-btn.active { border-color: #ffffff; }
.swatch-btn .swatch-label {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    mix-blend-mode: difference;
    color: white;
    white-space: nowrap;
}

.wcag-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid #1f2937;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.wcag-result:last-child { border-bottom: none; }
.wcag-label { color: #6b7280; }
.wcag-pass { color: #4ade80; font-weight: 700; }
.wcag-fail { color: #f87171; font-weight: 700; }

/* ---- Palette tray -------------------------------------------------------- */
#palette-tray {
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
}
#palette-tray.open {
    max-height: 120px;
    opacity: 1;
}
.palette-swatch {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    border: 1.5px solid rgba(255,255,255,0.08);
    transition: border-color 0.1s, transform 0.1s;
}
.palette-swatch:hover { border-color: rgba(255,255,255,0.4); transform: scale(1.08); }
.palette-swatch .remove-btn {
    display: none;
    position: absolute;
    top: -6px;
    right: -6px;
    width: 14px;
    height: 14px;
    background: #0a0a0a;
    border: 1px solid #374151;
    border-radius: 50%;
    color: #9ca3af;
    font-size: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.palette-swatch:hover .remove-btn { display: flex; }

/* ---- Export panel -------------------------------------------------------- */
#export-panel {
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
}
#export-panel.open {
    max-height: 600px;
    opacity: 1;
}
.export-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #1f2937;
}
.export-row:last-child { border-bottom: none; }
.export-name {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #4b5563;
    width: 80px;
    flex-shrink: 0;
}
.export-value {
    flex: 1;
    font-family: ui-monospace, monospace;
    font-size: 10px;
    color: #9ca3af;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Image loupe --------------------------------------------------------- */
#image-loupe {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.6);
    pointer-events: none;
    display: none;
    overflow: hidden;
    z-index: 10;
}

/* ---- Scrollbar ----------------------------------------------------------- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1f2937; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #4b5563; }

/* ---- Numeric inputs ------------------------------------------------------ */
.colour-input {
    background: #0a0a0a;
    border: 1px solid #1f2937;
    border-radius: 4px;
    color: #e5e7eb;
    font-family: ui-monospace, monospace;
    font-size: 12px;
    padding: 4px 6px;
    text-align: center;
    width: 100%;
    transition: border-color 0.15s;
}
.colour-input:focus {
    outline: none;
    border-color: #6b7280;
}
.colour-input.hex-input { text-align: left; letter-spacing: 0.05em; }
