/* ==================== 16. STICKY NOTES & DESK LAMP ==================== */

/* ---- sticky note (a normal card with a coloured paper and handwritten text) ---- */
.card.is-note .paper {
  background-image: var(--note-bg);
  background-color: var(--note-c);
  border-radius: calc(2px * var(--z));
  box-shadow:
    inset 0 calc(18px * var(--z)) calc(24px * var(--z)) calc(-18px * var(--z)) rgba(140, 100, 10, 0.20),
    inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

/* curled bottom-right corner */
.card.is-note .paper::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  width: calc(24px * var(--z));
  height: calc(24px * var(--z));
  background: linear-gradient(315deg, rgba(0, 0, 0, 0.14) 0%, rgba(255, 255, 255, 0.30) 45%, transparent 50%);
  pointer-events: none;
}

.card.is-note.n-yellow { --note-c: #fde047; --note-bg: linear-gradient(165deg, #fef08a 0%, #fde047 68%, #f5ce2e 100%); }
.card.is-note.n-cream  { --note-c: #e9e0ca; --note-bg: linear-gradient(165deg, #f5f0e1 0%, #e9e0ca 70%, #dfd3b8 100%); }
.card.is-note.n-rose   { --note-c: #fda4af; --note-bg: linear-gradient(165deg, #fecdd3 0%, #fda4af 70%, #f48c9a 100%); }
.card.is-note.n-mint   { --note-c: #86efac; --note-bg: linear-gradient(165deg, #bbf7d0 0%, #86efac 70%, #6ddc96 100%); }
.card.is-note.n-sky    { --note-c: #7dd3fc; --note-bg: linear-gradient(165deg, #bae6fd 0%, #7dd3fc 70%, #5cc2f2 100%); }

.card.is-note .well {
  background: transparent;
  box-shadow: none;
}

.note-text {
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: calc(8px * var(--z)) calc(4px * var(--z));
  font-family: var(--hand);
  font-weight: 700;
  font-size: calc(25px * var(--z));
  line-height: 1.12;
  color: #1d1912;
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
  user-select: none;
}

.note-text:empty::before {
  content: 'Write a note…';
  opacity: 0.42;
}

.note-text[contenteditable="true"] {
  cursor: text;
  user-select: text;
  background: rgba(255, 255, 255, 0.34);
  border-radius: calc(4px * var(--z));
}

/* notes have no screenshot: hide photo actions in the toolbar and inspector */
#hudBar.is-note [data-do="rep"],
#hudBar.is-note [data-do="hd"] {
  display: none;
}

#drawer[data-kind="note"] .img-only {
  display: none;
}

#drawer:not([data-kind="note"]) .note-only {
  display: none;
}

#iNote {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--chrome-border-strong);
  background: var(--input-bg);
  color: var(--chrome-text);
  font: 500 13px/1.4 var(--sans);
  user-select: text;
}

#iNote:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---- desk lamp: room goes dim, a warm pool of light follows the cursor ---- */
#lamp {
  position: fixed;
  inset: 0;
  z-index: 33;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.45s ease;
  --edge: 0.66;
  --pool: 0.12;
  background: radial-gradient(
    640px circle at var(--lx, 50%) var(--ly, 36%),
    rgba(255, 222, 165, var(--pool)) 0%,
    rgba(255, 208, 140, calc(var(--pool) * 0.3)) 34%,
    rgba(5, 4, 3, calc(var(--edge) * 0.55)) 62%,
    rgba(5, 4, 3, var(--edge)) 100%
  );
}

body[data-mode="light"] #lamp {
  --edge: 0.52;
  --pool: 0.16;
  background: radial-gradient(
    640px circle at var(--lx, 50%) var(--ly, 36%),
    rgba(255, 226, 170, var(--pool)) 0%,
    rgba(255, 214, 150, calc(var(--pool) * 0.3)) 36%,
    rgba(30, 18, 4, calc(var(--edge) * 0.55)) 62%,
    rgba(30, 18, 4, var(--edge)) 100%
  );
}

#lamp.off {
  opacity: 0;
}

#bLamp.active {
  color: #f5b942;
}
