/* App-specific styles only — Bulma (CDN) covers components/typography.
   Custom rules are limited to: the full-height app shell + graph/detail
   split (with mobile stacking), the capture slide-over, dynamic type-chip
   colors, the concept-row grid, the busy spinner, and the toast. */

/* Bulma sets display:flex/block on several containers, which would beat
   the UA's [hidden] rule and leave invisible panels intercepting clicks */
[hidden] { display: none !important; }

/* ------------------------------------------------------------ app shell */
#view-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}
.auth-box { max-width: 430px; }

main { display: flex; flex: 1; min-height: 0; }
#graph-wrap {
  flex: 1 1 60%;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  min-width: 0;
  position: relative;
}
#graph { position: absolute; inset: 0; }
.graph-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
  padding: 0 1rem;
}
#detail {
  flex: 0 0 40%;
  overflow-y: auto;
  padding: 1.1rem 1.4rem;
  background: #fff;
}

/* stack graph over detail on small screens */
@media screen and (max-width: 768px) {
  main { flex-direction: column; }
  #graph-wrap {
    flex: 0 0 46vh;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }
  #detail { flex: 1 1 auto; }
}

/* --------------------------------------------------------- detail panel */
.type-chip {
  color: #fff !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
table.frontmatter th { width: 90px; font-weight: 500; }
#detail-tags .tag { cursor: pointer; }
#detail-body a.internal { cursor: pointer; }
#backlinks-list { font-size: 0.85rem; }
#backlinks-list a { cursor: pointer; }
#memories-list { font-size: 1rem; font-weight: 600; }
#memories-list a { cursor: pointer; }

/* ------------------------------------------------------ capture slideover */
.slideover {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 100;
}
.slideover-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(560px, 100%);
  background: #fff;
  box-shadow: -8px 0 30px rgba(15, 23, 42, 0.2);
  padding: 1.2rem 1.4rem;
  overflow-y: auto;
}

.concept-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px;
  margin: 6px 0;
}
.concept-row .full { grid-column: 1 / -1; }
.concept-row .title-wrap { display: flex; gap: 6px; }
.concept-row .title-wrap .input { flex: 1; }
@media screen and (max-width: 480px) {
  .concept-row { grid-template-columns: 1fr; }
}

.busy {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
}
.spinner {
  width: 34px; height: 34px;
  border: 4px solid #e2e8f0;
  border-top-color: #485fc7;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------- tagging & @mentions */
/* Body editors are contenteditable rather than <textarea> so markdown links
   can render as atomic chips (see makeBodyEditor); .textarea comes along for
   Bulma's framing, these override what only makes sense for a real one. */
.body-editor {
  min-height: 12em;
  max-height: 24em;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
  cursor: text;
}
#rev-body.body-editor { min-height: 9em; }
.body-editor .mention-chip {
  display: inline-block;
  padding: 0 6px;
  border-radius: 10px;
  background: #eef1fb;
  border: 1px solid #d3daf5;
  color: #3c4d9e;
  font-size: 0.9em;
  line-height: 1.5;
  white-space: nowrap;
  user-select: all;
}

.tag-editor {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-height: 2.2em;
  padding: 4px 6px;
  border: 1px solid #dbdbdb;
  border-radius: 4px;
  background: #fff;
  cursor: text;
}
.tag-editor:focus-within { border-color: #485fc7; box-shadow: 0 0 0 2px rgba(72, 95, 199, 0.15); }
.tag-editor .tag { margin: 0; }
.tag-editor-input {
  flex: 1;
  min-width: 120px;
  border: none;
  outline: none;
  font-size: 0.8rem;
  font-family: inherit;
  padding: 2px;
  background: transparent;
}
.tag-suggest {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #dbdbdb;
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.15);
  z-index: 150;
}
.tag-suggest-item {
  padding: 6px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tag-suggest-item:hover, .tag-suggest-item.active { background: #eff1fa; }
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

/* Tribute (@mention) menu: above modals/slideover, Bulma-ish look */
.tribute-container {
  z-index: 300;
  border: 1px solid #dbdbdb;
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.15);
  max-height: 200px;
}
.tribute-container ul { margin: 0; background: #fff; }
.tribute-container li {
  padding: 6px 10px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tribute-container li.highlight { background: #eff1fa; }
.tribute-container li small { color: #7a7a7a; }

/* ----------------------------------------------------------------- misc */
.invite-url { word-break: break-all; font-size: 0.85rem; }

#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #f8fafc;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  z-index: 200;
  max-width: min(520px, 90vw);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.35);
}
#toast.error { background: #b91c1c; }
