/* Space — Kinopio-inspired daily canvas */

.moodboard-view {
  display: none;
  position: relative;
  height: calc(100vh - 48px);
  overflow: hidden;
  background: var(--bg-primary);
}
.moodboard-view.active { display: block; }

.mb-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  height: 53px;
  box-sizing: border-box;
}
.mb-nav button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 120ms;
}
.mb-nav button:hover { background: rgba(107, 102, 94, 0.06); }

.mb-date {
  min-width: 200px;
  text-align: center;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.mb-hint-inline {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.02em;
  font-family: var(--font-body);
}

.mb-canvas {
  position: absolute;
  inset: 53px 0 0 0;
  overflow: auto;
  background-color: #faf7f2;
  background-image: radial-gradient(rgba(107, 102, 94, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
}
.mb-canvas-inner {
  position: relative;
  width: 4000px;
  height: 3000px;
  transform-origin: 0 0;
}

#mbSvg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
#mbSvg .mb-conn { pointer-events: stroke; cursor: pointer; }
#mbSvg .mb-conn:hover { stroke: #c97a3a !important; }

.mb-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.mb-conn-label {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  background: #faf7f2;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--text-muted);
  min-width: 28px;
  min-height: 16px;
  text-align: center;
  outline: none;
  cursor: text;
}
.mb-conn-label:hover, .mb-conn-label:focus { border-color: var(--border); color: var(--text-primary); }
.mb-conn-label:empty::before {
  content: attr(data-placeholder);
  color: rgba(107,102,94,0.4);
  font-style: italic;
}
.mb-conn-label.sel { border-color: #c97a3a; color: #c97a3a; }

.mb-card {
  position: absolute;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
  overflow: visible;
  cursor: move;
  user-select: none;
  transition: box-shadow 120ms, outline-color 120ms;
  z-index: 3;
  outline: 2px solid transparent;
}
.mb-card > img,
.mb-card > video,
.mb-card > .mb-text,
.mb-card > .mb-text-edit,
.mb-card > .mb-link,
.mb-card > .mb-embed {
  border-radius: 7px;
  overflow: hidden;
}
.mb-card:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 6px 18px rgba(0, 0, 0, 0.07);
}
.mb-card.selected {
  outline-color: #c97a3a;
}
.mb-card img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  border-top-left-radius: 7px;
  border-top-right-radius: 7px;
}
.mb-card video {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: auto;
}
.mb-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
}
.mb-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.mb-card .mb-text, .mb-card .mb-text-edit {
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-primary);
  word-break: break-word;
  min-height: 1.55em;
  outline: none;
  white-space: pre-wrap;
}
.mb-card .mb-text-edit:focus { cursor: text; }
.mb-card .mb-line { min-height: 1.55em; }
.mb-card .mb-h1 { font-weight: 700; font-size: 15px; line-height: 1.4; margin: 2px 0; }
.mb-card .mb-h2 { font-weight: 600; font-size: 14px; line-height: 1.4; margin: 2px 0; }
.mb-card .mb-bullet { padding-left: 2px; }
.mb-card .mb-todo {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding-left: 2px;
}
.mb-card .mb-todo.done .mb-todo-text { text-decoration: line-through; color: var(--text-muted); }
.mb-card .mb-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  font-size: 10px;
  line-height: 1;
  color: #c97a3a;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 3px;
  background: #fff;
}
.mb-card .mb-todo.done .mb-check { border-color: #c97a3a; }
.mb-card a { color: var(--accent-primary); }

.mb-card .mb-link {
  display: block;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--accent-primary);
  text-decoration: none;
  word-break: break-all;
}
.mb-card .mb-link:hover { text-decoration: underline; }

.mb-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms;
  z-index: 2;
}
.mb-card:hover .mb-del { opacity: 1; }

.mb-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, rgba(107, 102, 94, 0.35) 50%);
  opacity: 0;
  transition: opacity 120ms;
  z-index: 2;
}
.mb-card:hover .mb-resize { opacity: 1; }

.mb-handle {
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #c97a3a;
  border: 2px solid #fff;
  cursor: crosshair;
  opacity: 0;
  transition: opacity 120ms, transform 120ms;
  z-index: 4;
}
.mb-card:hover .mb-handle { opacity: 1; }
.mb-handle:hover { transform: translateY(-50%) scale(1.3); }

.mb-colors {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  padding: 4px 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms;
  z-index: 5;
}
.mb-card:hover .mb-colors { opacity: 1; pointer-events: auto; }
.mb-color-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
  cursor: pointer;
}
.mb-color-swatch:hover { transform: scale(1.15); }

.mb-box-select {
  position: absolute;
  background: rgba(201, 122, 58, 0.08);
  border: 1px dashed #c97a3a;
  pointer-events: none;
  z-index: 10;
}

.mb-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 10, 0.88);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.mb-lightbox.active { display: flex; }
.mb-lightbox img,
.mb-lightbox video {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
  .mb-nav { font-size: 12px; padding: 10px 14px; }
  .mb-date { min-width: 140px; font-size: 14px; }
  .mb-hint-inline { display: none; }
}
