/* Do by Businlog: mini whiteboard demo (I2). Root #demo-board (templates/_demo_board.html, static/demo-board.js).
   Light theme only. Only the canvas and the notes block touch scrolling (touch-action: none), so the page still
   scrolls everywhere else. Classes are prefixed db-. */

.demo-board {
  --db-ink: var(--ink, #0a0f1c);
  --db-ink-2: var(--ink-2, #3b4256);
  --db-ink-3: var(--ink-3, #5c637a);
  --db-line: var(--line, rgba(70, 45, 10, .10));
  --db-line-2: var(--line-2, rgba(70, 45, 10, .17));
  --db-focus: var(--focus, #2563eb);
  --db-ease: var(--ui-ease, cubic-bezier(.2, .7, .2, 1));
  --db-mate: #c2185b;
  position: relative;
  display: flex; flex-direction: column;
  min-width: 0; max-width: 100%;
  color: var(--db-ink);
  background: #fff;
  border: 1px solid var(--db-line);
  border-radius: var(--ui-r-lg, 22px);
  box-shadow: var(--ui-shadow-2, 0 1px 2px rgba(70, 45, 10, .05), 0 10px 26px -14px rgba(255, 140, 40, .30));
  overflow: hidden;
  font-family: var(--f-body, system-ui, sans-serif);
  text-align: left;
}
.demo-board *, .demo-board *::before, .demo-board *::after { box-sizing: border-box; }
/* inside a browser frame (home tour: .frame > .hm-frame-body) the frame is the border: don't draw a second one */
.frame .demo-board, .demo-board--bare { border: 0; border-radius: 0; box-shadow: none; }
.demo-board .ui-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---- top bar: board name, sample label, who's here ---- */
.db-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--db-line); background: #fffdf9; }
.db-titles { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.db-file { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: #fff;
  background: linear-gradient(135deg, #5b3df5, #ff4d8d); flex: none; }
.db-title { margin: 0; font: 650 .95rem/1.25 var(--f-display, inherit); color: var(--db-ink); letter-spacing: -.01em; }
.db-title-sub { font-weight: 500; color: var(--db-ink-3); }
.db-example { font-size: .68rem; padding: 3px 9px; }
.db-people { display: flex; align-items: center; gap: 10px; }
.db-live { display: inline-flex; align-items: center; gap: 6px; font: 600 .78rem/1 var(--f-body, inherit); color: #04694a; }
.db-live .ui-live { width: 8px; height: 8px; }
.db-avatars { display: flex; margin: 0; padding: 0; list-style: none; }
.db-av { display: inline-grid; place-items: center; height: 28px; min-width: 28px; padding: 0 7px; border-radius: 999px;
  font: 700 .72rem/1 var(--f-body, inherit); color: #fff; border: 2px solid #fff; box-shadow: 0 1px 2px rgba(10, 15, 28, .12); }
.db-av + .db-av { margin-left: -6px; }
.db-av--you { background: #4a32d6; }
.db-av--mate { background: var(--db-mate); }

/* ---- toolbar ---- */
.db-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px 12px;
  border-bottom: 1px solid var(--db-line); background: #fff; }
.db-swatches, .db-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.db-sep { width: 1px; height: 24px; background: var(--db-line-2); }
.db-sw { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px;
  background: transparent; cursor: pointer; }
.db-sw i { display: block; width: 20px; height: 20px; border-radius: 50%; background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(10, 15, 28, .18); transition: transform .15s var(--db-ease), box-shadow .15s; }
.db-sw:hover { background: rgba(70, 45, 10, .05); }
.db-sw[aria-pressed="true"] { background: rgba(91, 61, 245, .08); }
.db-sw[aria-pressed="true"] i { transform: scale(1.12); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--c); }
.db-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 11px; border: 1px solid var(--db-line-2);
  border-radius: 10px; background: #fff; color: var(--db-ink-2); font: 600 .84rem/1 var(--f-body, inherit); cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s; }
.db-btn:hover { background: #fff8ec; border-color: rgba(255, 138, 0, .38); color: var(--db-ink); }
.db-btn:active { transform: translateY(1px); }
.db-btn svg { flex: none; }
.db-sw:focus-visible, .db-btn:focus-visible, .db-note:focus-visible { outline: 3px solid var(--db-focus); outline-offset: 2px; }

/* ---- the board ---- */
.db-stage { position: relative; width: 100%; min-width: 0; aspect-ratio: 16 / 10; overflow: hidden;   /* no min/max-height: they would
  transfer through aspect-ratio into a min width and cause sideways scroll on phones */
  background-color: #fffdf8;
  background-image: radial-gradient(circle at 1px 1px, rgba(70, 45, 10, .16) 1px, transparent 1.4px);
  background-size: 22px 22px; background-position: 11px 11px; }
@supports not (aspect-ratio: 1) { .db-stage { height: 0; padding-bottom: 62.5%; } }
.db-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.demo-board.db-placing .db-canvas { cursor: copy; }
.db-notes { position: absolute; inset: 0; z-index: 1; pointer-events: none; }

.db-note { position: absolute; pointer-events: auto; width: clamp(96px, 24%, 136px); min-height: clamp(76px, 18%, 104px);
  padding: 12px 12px 14px; border: 0; border-radius: 4px 4px 14px 4px; margin: 0;
  font: 600 clamp(.78rem, .74rem + .2vw, .88rem)/1.3 var(--f-body, inherit); color: #2b2f3c; text-align: left;
  display: flex; align-items: flex-start; overflow-wrap: anywhere;
  transform: rotate(var(--rot, -1.5deg)); transform-origin: 50% 40%;
  box-shadow: 0 1px 1px rgba(70, 45, 10, .08), 0 8px 18px -10px rgba(70, 45, 10, .45);
  cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform .18s var(--db-ease), box-shadow .18s var(--db-ease); }
.db-note::after { content: ""; position: absolute; top: -7px; left: 50%; width: 38px; height: 14px; margin-left: -19px;
  border-radius: 2px; background: rgba(255, 255, 255, .6); box-shadow: 0 0 0 1px rgba(70, 45, 10, .06); transform: rotate(-3deg); }
.db-note--sun { background: #ffe39a; --rot: -2deg; }
.db-note--pink { background: #ffd1e1; --rot: 1.5deg; }
.db-note--mint { background: #c9f1df; --rot: -1deg; }
.db-note--violet { background: #e0dbff; --rot: 2deg; }
.db-note--sky { background: #cfe8ff; --rot: -2.5deg; }
.db-note:hover { box-shadow: 0 1px 1px rgba(70, 45, 10, .08), 0 14px 24px -12px rgba(70, 45, 10, .5); }
.db-note.is-drag { cursor: grabbing; transform: rotate(0deg) scale(1.05); transition: box-shadow .18s var(--db-ease);
  box-shadow: 0 2px 4px rgba(70, 45, 10, .08), 0 22px 34px -14px rgba(70, 45, 10, .55); }
.db-note.is-picked { transform: rotate(0deg) scale(1.04);
  outline: 2px dashed #4a32d6; outline-offset: 4px; }
.db-note.is-new { animation: db-pop .32s var(--db-ease); }
@keyframes db-pop { from { transform: rotate(var(--rot)) scale(.6); opacity: 0; } }
.db-note.is-hint { animation: db-wiggle .5s var(--db-ease); }
@keyframes db-wiggle { 30% { transform: rotate(-4deg); } 65% { transform: rotate(3deg); } }

/* sample teammate's cursor */
.db-cursor { position: absolute; left: 0; top: 0; z-index: 4; pointer-events: none; will-change: transform;
  transform: translate(-100px, -100px); transition: opacity .3s; }
.db-cursor[hidden] { display: block; opacity: 0; }
.db-cursor svg { display: block; filter: drop-shadow(0 1px 1px rgba(10, 15, 28, .25)); }
.db-cursor-tag { position: absolute; left: 14px; top: 16px; padding: 3px 8px 4px; border-radius: 6px 999px 999px 999px;
  background: var(--db-mate); color: #fff; font: 650 .72rem/1.2 var(--f-body, inherit); white-space: nowrap;
  box-shadow: 0 2px 6px -2px rgba(10, 15, 28, .3); }
.db-cursor.is-flip .db-cursor-tag { left: auto; right: 12px; border-radius: 999px 6px 999px 999px; }
.db-cursor.is-up .db-cursor-tag { top: -24px; }
.db-cursor-tag em { font-style: normal; font-weight: 500; opacity: .92; }
.db-cursor-tag em::before { content: "· "; }

/* little status bubble at the bottom of the board */
.db-toast { position: absolute; left: 50%; bottom: 12px; z-index: 5; margin: 0; max-width: calc(100% - 24px);
  padding: 7px 12px; border-radius: 999px; background: rgba(10, 15, 28, .86); color: #fff;
  font: 600 .78rem/1.3 var(--f-body, inherit); text-align: center; pointer-events: none;
  transform: translate(-50%, 8px); opacity: 0; transition: opacity .2s, transform .2s var(--db-ease); }
.db-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---- footer hint ---- */
.db-help { margin: 0; padding: 10px 14px 12px; border-top: 1px solid var(--db-line); background: #fffdf9;
  font-size: .8rem; line-height: 1.5; color: var(--db-ink-3); }
.db-help > span { display: block; }
.db-help-js { display: none !important; }
.db-help-note { margin-top: 2px; }
.demo-board.db-js .db-help-js { display: block !important; }
.demo-board.db-js .db-help-nojs { display: none; }
.demo-board:not(.db-js) .db-tools { display: none; }
.demo-board:not(.db-js) .db-note { cursor: default; }

@media (max-width: 520px) {
  .db-bar { padding: 9px 12px; }
  .db-title-sub { display: none; }
  .db-live { display: none; }
  .db-tools { padding: 6px 8px; gap: 6px; }
  .db-sep { display: none; }
  .db-sw { width: 34px; height: 34px; }
  .db-btn { padding: 0 9px; font-size: .8rem; }
  .db-stage { aspect-ratio: 1 / 1; }
  .db-note { padding: 10px 9px 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .demo-board *, .demo-board *::before, .demo-board *::after { transition: none !important; animation: none !important; }
}

@media print {
  .db-tools, .db-cursor, .db-toast { display: none !important; }
}
