/* ==========================================================================
   areaC.css — Área C: efectos de capa, extras del panel de capas, color,
   paletas, referencias, fondo del lienzo y fuentes.
   Sólo tokens de tokens.css: ningún color literal salvo los de las etiquetas
   de color de capa, que son DATOS (se pintan por CSSOM desde el JS).
   ========================================================================== */

/* El atributo `hidden` tiene que ganar a los `display:flex` de los paneles. */
.fxp [hidden],
.lp-row[hidden],
.lp-cx[hidden],
.lp-tagbar[hidden],
.cpx [hidden],
.refw[hidden],
.pmx [hidden],
#color-wheel-canvas[hidden],
.cpx-picker[hidden] {
  display: none !important;
}

/* ---------------------------------------------------------------- Efectos */

#panel-fx-body {
  padding: var(--sp-4) var(--sp-4) var(--sp-5);
}

.fxp {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
}

.fxp-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}

.fxp-head-icon {
  flex: 0 0 auto;
  color: var(--accent);
}

.fxp-target {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fxp-power.is-off {
  color: var(--fg-mute);
  opacity: var(--op-muted);
}

.fxp-fill .opt {
  width: 100%;
}

.fxp-fill .opt-label {
  min-width: 70px;
}

.fxp-fill .opt-track {
  flex: 1 1 auto;
  width: auto;
}

.fxp-add {
  justify-content: center;
  gap: var(--sp-3);
}

.fxp-presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.fxp-chip {
  height: 22px;
  padding: 0 var(--sp-4);
  border: 1px solid var(--bd-strong);
  border-radius: var(--r-full);
  background: var(--s-2);
  color: var(--fg-dim);
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.fxp-chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--fg);
}

.fxp-chip:focus-visible {
  outline: var(--focus-w) solid var(--accent-ring);
  outline-offset: 1px;
}

.fxp-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.fxp-item {
  border: 1px solid var(--bd);
  border-radius: var(--r-md);
  background: var(--s-2);
  overflow: hidden;
}

.fxp-item-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  min-width: 0;
}

.fxp-check {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--bd-strong);
  border-radius: var(--r-sm);
  background: var(--s-3);
  color: transparent;
  cursor: pointer;
}

.fxp-check[aria-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.fxp-check:focus-visible {
  outline: var(--focus-w) solid var(--accent-ring);
  outline-offset: 1px;
}

.fxp-item-title {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: 24px;
  padding: 0 var(--sp-2);
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--fg);
  font-size: var(--fs-sm);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.fxp-item-title:hover {
  background: var(--s-3);
}

.fxp-chev {
  flex: 0 0 auto;
  color: var(--fg-mute);
}

.fxp-item-body {
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
  border-top: 1px solid var(--bd);
  gap: var(--sp-4);
}

.fxp-item-body .opt-label {
  min-width: 70px;
}

.btn-xs {
  width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
}

.fxp-empty {
  margin: 0;
}

.adj {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--bd);
}

.adj:empty {
  display: none;
}

.adj-h {
  margin: 0;
  letter-spacing: var(--ls-wide);
}

.adj-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}

.adj-name {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: var(--fw-medium);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.adj-params .opt-label {
  min-width: 70px;
}

/* --------------------------------------------------------- Panel de capas */

.lp-tagbar {
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 3px;
  border-radius: 2px;
  pointer-events: none;
}

.lp-cx .icon {
  width: 12px;
  height: 12px;
}

.lp-cx-fx {
  color: var(--accent);
}

.lp-row.is-solo .lp-name {
  color: var(--accent);
}

.lp-search-row {
  gap: var(--sp-2);
}

.lp-search-icon {
  flex: 0 0 auto;
  color: var(--fg-mute);
}

.lp-search {
  flex: 1 1 auto;
  min-width: 0;
}

.lp-tagfilter {
  position: relative;
}

.lp-tagfilter.is-active {
  color: var(--fg);
}

/* ------------------------------------------------------------- Referencias */

.ref-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: calc(var(--z-overlay) - 10);
}

.refw {
  position: fixed;
  display: flex;
  flex-direction: column;
  min-width: 120px;
  min-height: 90px;
  background: var(--s-1);
  border: 1px solid var(--bd-strong);
  border-radius: var(--r-md);
  box-shadow: var(--sh-2);
  overflow: hidden;
  pointer-events: auto;
}

.refw-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 26px;
  padding: 0 var(--sp-2) 0 var(--sp-3);
  background: var(--s-2);
  border-bottom: 1px solid var(--bd);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.refw.is-pinned .refw-head {
  cursor: default;
}

.refw-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-xs);
  color: var(--fg-dim);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.refw-op {
  flex: 0 1 64px;
  width: 64px;
  min-width: 32px;
  accent-color: var(--accent);
}

.refw-btn {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--fg-mute);
  cursor: pointer;
}

.refw-btn:hover {
  color: var(--fg);
  background: var(--s-3);
}

.refw-pin[aria-pressed="true"] {
  color: var(--accent);
}

.refw-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--canvas-bg);
  touch-action: none;
  cursor: move;
}

/* Fijada: la imagen deja pasar el puntero (se dibuja a través) y el marco se
   aligera para estorbar lo menos posible. */
.refw.is-pinned {
  background: transparent;
  border-color: var(--accent-soft);
  box-shadow: none;
}

.refw.is-pinned .refw-body {
  pointer-events: none;
  background: transparent;
}

.refw.is-pinned .refw-grip {
  display: none;
}

.refw-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.refw-grip {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  touch-action: none;
  background: linear-gradient(135deg, transparent 50%, var(--s-hi) 50%);
}

.refp {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border: 1px dashed transparent;
  border-radius: var(--r-md);
}

.refp.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.refp-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.refp-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.refp-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.refp-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-sm);
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.refp-drop {
  padding: var(--sp-4);
  border: 1px dashed var(--bd-strong);
  border-radius: var(--r-md);
  color: var(--fg-mute);
  font-size: var(--fs-xs);
  text-align: center;
}

/* ------------------------------------------------- Fondo del lienzo / filtro */

.cnv {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.cnv-preview-wrap {
  display: flex;
  justify-content: center;
}

.cnv-preview {
  width: 320px;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--bd-strong);
  border-radius: var(--r-md);
}

.cnv-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  min-width: 0;
}

.cnv-label {
  flex: 0 0 120px;
  color: var(--fg-dim);
  font-size: var(--fs-sm);
}

.cnv-row .select,
.cnv-range {
  flex: 1 1 auto;
  min-width: 0;
}

.cnv-range {
  accent-color: var(--accent);
}

.cnv-color {
  width: 48px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--bd-strong);
  border-radius: var(--r-sm);
  background: none;
}

.fd-allframes {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: var(--sp-4);
  font-size: var(--fs-sm);
  color: var(--fg-dim);
  cursor: pointer;
}

.fd-allframes[hidden] {
  display: none;
}

/* ------------------------------------------------------------------ Color */

.cpx-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}

.cpx-compare {
  flex: 0 0 auto;
  display: flex;
  width: 52px;
  height: 22px;
  border: 1px solid var(--bd-strong);
  border-radius: var(--r-sm);
  overflow: hidden;
}

.cpx-prev,
.cpx-cur {
  flex: 1 1 50%;
  display: block;
  height: 100%;
  border: 0;
  padding: 0;
}

.cpx-prev {
  cursor: pointer;
}

.cpx-prev:focus-visible {
  outline: var(--focus-w) solid var(--accent-ring);
  outline-offset: -2px;
}

.cpx-rgb {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
}

.cpx-contrast {
  flex: 0 0 auto;
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  color: var(--fg-dim);
  white-space: nowrap;
}

.cpx-contrast.is-low {
  color: var(--warn);
}

.cpx-seg {
  margin-bottom: var(--sp-3);
}

.cpx-pickers {
  display: flex;
  justify-content: center;
}

.cpx-picker:focus-visible {
  outline: var(--focus-w) solid var(--accent-ring);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.cpx-harm {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.cpx-harm-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.cpx-h {
  margin: 0;
  flex: 0 0 auto;
  letter-spacing: var(--ls-wide);
}

.cpx-harm-mode {
  flex: 1 1 auto;
  min-width: 0;
}

.cpx-harm-row {
  display: flex;
  gap: 4px;
  min-width: 0;
}

.cpx-harm-sw {
  flex: 1 1 0;
  min-width: 0;
  height: 22px;
  padding: 0;
  border: 1px solid var(--bd-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
}

.cpx-harm-sw.is-base {
  box-shadow: inset 0 0 0 2px var(--s-1), 0 0 0 1px var(--accent);
}

.cpx-harm-sw:focus-visible {
  outline: var(--focus-w) solid var(--accent-ring);
  outline-offset: 1px;
}

#color-palette-grid button.is-dragging {
  opacity: 0.4;
}

#color-palette-grid button.is-drop {
  box-shadow: -3px 0 0 var(--accent);
}

.lp-tagdot {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--s-1);
}
