/* ==========================================================================
   KubaOS paint.css - v1.1 M3
   KubaPaint + Viewer styles. References the shared design tokens declared in
   desktop.css (--navy, --amber, --paper, --ink, --danger, --green-term,
   --radius-* ...). Palette is NOT redeclared here.
   ========================================================================== */

/* ---- KubaPaint ---- */

.kt-paint {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--paper);
  color: var(--ink);
}

.kt-paint-filebar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid rgba(28, 36, 51, 0.14);
  background: linear-gradient(180deg, #f0ece1 0%, var(--paper) 100%);
}

.kt-paint-main {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  gap: 8px;
  padding: 8px;
}

.kt-paint-tools {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
}

.kt-paint-tool {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid rgba(28, 36, 51, 0.2);
  border-radius: var(--radius-btn);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}

.kt-paint-tool:hover { border-color: var(--amber); }

.kt-paint-tool[aria-pressed="true"] {
  background: var(--navy);
  color: var(--paper);
  border-color: var(--navy);
}

.kt-paint-tool:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}

.kt-paint-glyph {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.kt-paint-tool-label { white-space: nowrap; }

.kt-paint-stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  background:
    repeating-conic-gradient(#e8e3d6 0% 25%, #f3efe6 0% 50%) 0 / 20px 20px;
  border: 1px solid rgba(28, 36, 51, 0.2);
  border-radius: var(--radius-btn);
  overflow: auto;
}

.kt-paint-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: var(--paper);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.25);
  cursor: crosshair;
  touch-action: none;
}

.kt-paint-canvas:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.kt-paint-palette {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid rgba(28, 36, 51, 0.14);
  background: #f0ece1;
}

.kt-paint-swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid rgba(28, 36, 51, 0.3);
  border-radius: var(--radius-btn);
  background: var(--swatch, #000);
  cursor: pointer;
}

.kt-paint-swatch:hover { border-color: var(--ink); }

.kt-paint-swatch[aria-pressed="true"] {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px var(--amber);
}

.kt-paint-swatch:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.kt-paint-sizes {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.kt-paint-size {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 26px;
  border: 1px solid rgba(28, 36, 51, 0.2);
  border-radius: var(--radius-btn);
  background: #fff;
  cursor: pointer;
}

.kt-paint-size[aria-pressed="true"] {
  background: var(--navy);
  border-color: var(--navy);
}

.kt-paint-size[aria-pressed="true"] .kt-paint-size-dot { background: var(--paper); }

.kt-paint-size:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}

.kt-paint-size-dot {
  display: block;
  width: var(--dot, 6px);
  height: var(--dot, 6px);
  border-radius: 50%;
  background: var(--ink);
}

/* Open-picker dialog body */
.kt-paint-openlist { min-width: 240px; }
.kt-paint-openrows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  overflow: auto;
}
.kt-paint-openrow { text-align: left; }

/* ---- Viewer ---- */

.kt-viewer {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--navy-deep);
}

.kt-viewer-stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 12px;
  overflow: auto;
}

.kt-viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: var(--paper);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
}

.kt-viewer-bar {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.kt-viewer-torn {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  color: var(--paper);
}

.kt-viewer-torn .kt-paint-glyph {
  width: 56px;
  height: 56px;
  color: var(--amber);
}

.kt-viewer-torn-title { font-weight: 700; margin: 0; }
.kt-viewer-torn-sub { margin: 0; color: rgba(246, 243, 236, 0.7); font-size: 13px; }

/* ---- reduced motion: Paint has no decorative animation; nothing to gate.
   Stage/canvas are static. Kept explicit so the audit sees the intent. ---- */
@media (prefers-reduced-motion: reduce) {
  .kt-paint-canvas { transition: none; }
}
