/* ==========================================================================
   Sidenotes — Tufte-style margin notes
   Dot in margin, expands on hover, stays open on click.
   ========================================================================== */

.sidenotes-container {
  position: absolute;
  top: 0;
  width: 220px;
  pointer-events: auto;
  z-index: 10;
}

/* --- Contribute prompt at top of margin ---------------------------------- */

.sidenote-prompt {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: #1a1d3a;
  line-height: 1.5;
  background: #fff;
  padding: 12px 14px;
  margin-bottom: 16px;
  border-left: 2px solid #2a2f7c;
}

.sidenote-prompt strong {
  color: #2a2f7c;
}

/* --- Individual sidenote ------------------------------------------------- */

.sidenote {
  position: absolute;
  width: 220px;
  cursor: pointer;
}

/* --- Collapsed: white dot ------------------------------------------------ */

.sidenote-marker {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}

.sidenote-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
  transition: box-shadow 0.15s;
}

.sidenote:hover .sidenote-dot,
.sidenote.hover .sidenote-dot {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}


.sidenote-preview {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
  opacity: 0;
  transition: max-width 0.2s ease, opacity 0.2s ease;
}

.sidenote:hover .sidenote-preview,
.sidenote.hover .sidenote-preview {
  max-width: 200px;
  opacity: 1;
}

/* --- Integrated: resolved comment, faded dot ----------------------------- */

.sidenote.integrated .sidenote-dot {
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.sidenote.integrated:hover .sidenote-dot {
  background: rgba(255, 255, 255, 0.5);
}

.sidenote.integrated .sidenote-expanded {
  opacity: 0.7;
}

.sidenote.integrated .sidenote-status {
  font-size: 10px;
  color: #4d5cf2;
  font-weight: 600;
  margin-bottom: 4px;
}

/* --- Expanded: white card ------------------------------------------------ */

.sidenote-expanded {
  display: none;
  padding: 12px;
  background: #fff;
  border-left: 2px solid #2a2f7c;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  line-height: 1.5;
  color: #3a3d5a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Show on hover OR when pinned open */
.sidenote:hover .sidenote-expanded,
.sidenote.hover .sidenote-expanded,
.sidenote.open .sidenote-expanded {
  display: block;
}

.sidenote:hover .sidenote-marker,
.sidenote.hover .sidenote-marker,
.sidenote.open .sidenote-marker {
  display: none;
}

.sidenote.open,
.sidenote:hover {
  z-index: 10;
}

/* --- Quote --------------------------------------------------------------- */

.sidenote-quote {
  font-family: 'Lora', serif;
  font-size: 11px;
  font-style: italic;
  color: #999;
  line-height: 1.4;
  margin-bottom: 6px;
}

/* --- Comment body -------------------------------------------------------- */

.sidenote-body {
  color: #3a3d5a;
  margin-bottom: 6px;
}

/* --- Meta ---------------------------------------------------------------- */

.sidenote-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidenote-author {
  font-size: 10px;
  color: #bbb;
  font-weight: 500;
}

.sidenote-votes {
  display: flex;
  align-items: center;
  gap: 3px;
}

.sidenote-vote-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 8px;
  color: #ccc;
  padding: 2px;
  line-height: 1;
  transition: color 0.15s;
}

.sidenote-vote-btn:hover { color: #2a2f7c; }
.sidenote-vote-btn.voted { color: #2a2f7c; }

.sidenote-vote-count {
  font-size: 10px;
  font-weight: 600;
  color: #999;
  min-width: 14px;
  text-align: center;
}

/* --- Anchor: highlighted text in the article ----------------------------- */

.sidenote-anchor {
  border-bottom: 1px solid #4d5cf2;
  cursor: pointer;
  transition: background 0.15s;
}

.sidenote-anchor.integrated {
  border-bottom: none;
}

.sidenote-anchor:hover,
.sidenote-anchor-hover {
  background: rgba(77, 92, 242, 0.1);
}

/* --- Mobile -------------------------------------------------------------- */

@media (max-width: 1400px) {
  .sidenotes-container {
    position: relative;
    right: auto;
    width: 100%;
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid rgba(42, 47, 124, 0.08);
  }

  .sidenotes-container::before {
    content: 'Community notes';
    display: block;
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #bbb;
    margin-bottom: 12px;
  }

  .sidenote {
    position: relative;
    top: auto !important;
    width: 100%;
    margin-bottom: 8px;
  }

  .sidenote-marker { display: none; }
  .sidenote-expanded { display: block; }
}
