/* ============================================================
   color.css — "Colour Science Playground"

   Layers the colour-specific furniture on top of the shared
   instrument bench. The @import must stay first: CSS requires
   @import before any other rule.
   ============================================================ */

@import url("instrument.css");

/* ============================================================
   Swatches
   ============================================================ */

.col-swatch {
  border-radius: 3px;
  border: 1px solid var(--cam-rule-hard);
  /* A checkerboard shows through anything translucent, and makes a
     swatch that matches the panel background still readable. */
  background-image:
    linear-gradient(45deg, var(--cam-rule) 25%, transparent 25%),
    linear-gradient(-45deg, var(--cam-rule) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--cam-rule) 75%),
    linear-gradient(-45deg, transparent 75%, var(--cam-rule) 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0;
}

.col-swatch-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 2px;
}

.col-swatch-lg {
  height: 76px;
  width: 100%;
  margin-bottom: 0.6rem;
}

/* A pair of swatches shown against each other, for before/after. */
.col-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--cam-rule);
  border: 1px solid var(--cam-rule-hard);
  border-radius: 3px;
  overflow: hidden;
  margin: 0.5rem 0;
}
.col-pair > div { padding: 0; height: 60px; position: relative; }
.col-pair span {
  position: absolute;
  left: 5px; bottom: 4px;
  font-family: var(--cam-mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  pointer-events: none;
}

/* ============================================================
   Colour-space readout
   ============================================================ */

.col-spaces {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  border-top: 1px solid var(--cam-rule);
  border-left: 1px solid var(--cam-rule);
  background: var(--cam-panel);
}

.col-space {
  border-right: 1px solid var(--cam-rule);
  border-bottom: 1px solid var(--cam-rule);
  padding: 0.6rem 0.7rem;
  min-width: 0;
}

.col-space-name {
  font-family: var(--cam-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cam-a);
  margin: 0 0 0.4rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.col-space-name em {
  font-style: normal;
  color: var(--cam-muted);
  text-transform: none;
  letter-spacing: 0;
}

.col-space-row {
  display: grid;
  grid-template-columns: 1.35rem 1fr auto;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--cam-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  line-height: 1.7;
}
.col-space-row .ch { color: var(--cam-muted); }
.col-space-row .num { text-align: right; color: var(--cam-ink); }

/* A thin bar showing where the component sits in its own range. */
.col-bar {
  height: 3px;
  background: var(--cam-rule);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.col-bar i {
  position: absolute;
  top: 0; bottom: 0;
  background: var(--cam-a);
  border-radius: 2px;
}
.col-bar.neg i { background: var(--cam-b); }

/* ============================================================
   Image stage
   ============================================================ */

/* Images keep their own aspect ratio, so the canvas is sized by JS
   rather than by an aspect-ratio class. */
.col-imgstage {
  position: relative;
  background: var(--cam-sunk);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 10px;
}
.col-imgstage canvas {
  display: block;
  max-width: 100%;
  max-height: 460px;
  width: auto;
  height: auto;
  image-rendering: auto;
  cursor: crosshair;
  border: 1px solid var(--cam-rule);
}
.col-imgstage.pixelated canvas { image-rendering: pixelated; }

/* Drag-and-drop target state. */
.col-drop {
  outline: 1px dashed var(--cam-rule-hard);
  outline-offset: -6px;
  transition: outline-color 0.15s ease, background 0.15s ease;
}
.col-drop.is-over {
  outline-color: var(--cam-a);
  background: var(--cam-a-soft);
}

.col-dropnote {
  position: absolute;
  inset: auto 0 6px 0;
  text-align: center;
  font-family: var(--cam-mono);
  font-size: 0.6rem;
  color: var(--cam-muted);
  pointer-events: none;
}

/* Scene picker: small labelled thumbnails. */
.col-scenes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(66px, 1fr));
  gap: 0.35rem;
  margin-top: 0.4rem;
}
.col-scene {
  border: 1px solid var(--cam-rule-hard);
  border-radius: 2px;
  background: var(--cam-panel-2);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.14s ease;
}
.col-scene canvas { display: block; width: 100%; height: 38px; }
.col-scene span {
  display: block;
  font-family: var(--cam-mono);
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  color: var(--cam-soft);
  padding: 0.2rem 0.1rem;
  border-top: 1px solid var(--cam-rule);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.col-scene:hover { border-color: var(--cam-a); }
.col-scene[aria-pressed="true"] { border-color: var(--cam-a); }
.col-scene[aria-pressed="true"] span { color: var(--cam-a); }

/* The magnified loupe around the inspected pixel. */
.col-loupe {
  position: absolute;
  top: 8px; right: 8px;
  width: 92px; height: 92px;
  border: 1px solid var(--cam-rule-hard);
  border-radius: 3px;
  overflow: hidden;
  background: var(--cam-sunk);
  pointer-events: none;
  z-index: 4;
}
.col-loupe canvas { width: 100%; height: 100%; border: none; image-rendering: pixelated; }

/* ============================================================
   Curve plots (transfer functions, histograms, CDFs)
   ============================================================ */

.col-plot {
  background: var(--cam-sunk);
  position: relative;
}
.col-plot canvas { display: block; width: 100%; }

/* ============================================================
   Chromaticity diagram
   ============================================================ */

.col-cie { background: var(--cam-sunk); position: relative; }

/* ============================================================
   Before/after split slider over an image
   ============================================================ */

.col-compare { position: relative; }
.col-compare input[type="range"] {
  position: absolute;
  left: 10px; right: 10px; bottom: 6px;
  width: calc(100% - 20px);
  z-index: 5;
}

/* ============================================================
   Narrow screens
   ============================================================ */

@media (max-width: 680px) {
  .col-spaces { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .col-imgstage canvas { max-height: 300px; }
  .col-loupe { width: 64px; height: 64px; }
}
