/* ============================================================
   SKETCH PAD

   The paper itself is deliberately theme-independent (always light) — see
   the header comment in public/js/notes/sketch-pad.js for why. Everything
   around it follows the app theme as normal, and in Ember/Dark the paper
   gets a soft ring so it reads as a sheet laid on the surface rather than
   a blown-out rectangle.
============================================================ */

.sp-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.sp-group { display: flex; align-items: center; gap: 6px; }
.sp-group--end { margin-left: auto; }
.sp-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text3);
}

.sp-tool {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.sp-tool:hover { background: var(--bg2); border-color: var(--border-strong); }
.sp-tool.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.sp-swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  border: 2px solid transparent;
  box-shadow: 0 0 0 1px var(--border);
  cursor: pointer;
}
.sp-swatch.is-on { border-color: var(--surface); box-shadow: 0 0 0 2px var(--accent); }
.sp-color {
  width: 30px;
  height: 26px;
  padding: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.sp-range { width: 110px; accent-color: var(--accent); }
.sp-import { margin: 0; cursor: pointer; }

/* Shown only while the Text tool is active — keeps the emoji shortcuts out
   of the main toolbar until they're relevant. */
.sp-textbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 9px 12px;
  margin-bottom: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.sp-emoji-row { display: flex; flex-wrap: wrap; gap: 4px; }
.sp-emoji {
  width: 30px;
  height: 30px;
  font-size: 1rem;
  line-height: 1;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.sp-emoji:hover { background: var(--bg2); border-color: var(--border-strong); }

.sp-stage {
  position: relative; /* anchors the floating text input below */
  display: flex;
  justify-content: center;
  padding: 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Floating input placed exactly where the text will land, so you type in
   position rather than into a dialog and hope. */
.sp-text-input {
  position: absolute;
  z-index: 5;
  min-width: 180px;
  padding: 2px 6px;
  font-family: 'DM Sans', sans-serif;
  color: #1c1917;
  background: rgba(255, 253, 249, 0.97);
  border: 1px solid var(--accent);
  border-radius: 4px;
  box-shadow: var(--shadow-md);
  outline: none;
}
.sp-canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  background: #fffdf9;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  cursor: crosshair;
  /* The pad owns every gesture inside it — without this, a touch drag
     scrolls the page instead of drawing a line. */
  touch-action: none;
}
body.theme-ember .sp-canvas,
body.theme-dark .sp-canvas { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.10), var(--shadow-lg); }

.sp-tip { margin-top: 10px; }

@media (max-width: 720px) {
  .sp-toolbar { gap: 8px 10px; }
  .sp-group--end { margin-left: 0; width: 100%; }
  .sp-range { width: 78px; }
  .sp-stage { padding: 8px; }
}
