/* Side Note Styles - Adjusted for MistEye UI (Slate Theme) */

/* 
  Layout Strategy: Absolute Positioning via JS
  1. Main content is centered (max-width 720px).
  2. Side notes are absolutely positioned relative to the container.
  3. JS calculates the 'top' coordinate based on the preceding paragraph.
*/

.wrapper.post .page-content {
  display: block;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  /* Anchor for absolute notes */
  overflow: visible;
  /* Allow notes to hang outside */
}

.wrapper.post .page-content>* {
  max-width: 100%;
}

/* Base Side Note Style */
.side-note {
  box-sizing: border-box;
  background-color: transparent;
  width: 240px;
  z-index: 10;
  padding: 0;
  margin: 0;

  /* Initial State: Hidden until positioned by JS to prevent jump */
  position: absolute;
  visibility: hidden;

  font-size: 0.85rem;
  line-height: 1.6;
  color: #64748b; /* slate-500 */
}

/* Show when positioned */
.side-note.positioned {
  visibility: visible;
  transition: top 0.3s ease;
  /* Smooth re-flow on resize */
}

/* Header */
.side-note .side-note-header {
  font-weight: 700;
  display: block;
  margin-bottom: 0.3rem;
  color: #0f172a; /* slate-900 */
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Content */
.side-note .side-note-content {
  font-style: italic;
  color: #64748b; /* slate-500 */
}

.side-note .side-note-content p {
  margin: 0;
  margin-bottom: 0.5rem;
}


/* =========================================
   Hacker Style & Offsets (Adapted to clean UI)
   ========================================= */

/* Left Note */
.side-note.side-note-left {
  left: -260px;
  /* 240px width + 20px gap */
  text-align: right;
  border-right: 2px solid #e2e8f0; /* slate-200 */
  padding-right: 15px;
}

.side-note.side-note-left::before {
  content: "";
  position: absolute;
  top: 0.7em;
  right: -10px;
  /* Shortened to create 8px gap from text */
  width: 8px;
  height: 2px;
  background-color: #cbd5e1; /* slate-300 */
  opacity: 1;
}

/* Right Note */
.side-note.side-note-right {
  right: -260px;
  text-align: left;
  border-left: 2px solid #e2e8f0; /* slate-200 */
  padding-left: 15px;
}

.side-note.side-note-right::before {
  content: "";
  position: absolute;
  top: 0.7em;
  left: -10px;
  /* Shortened to create 8px gap from text */
  width: 8px;
  height: 2px;
  background-color: #cbd5e1; /* slate-300 */
  opacity: 1;
}

/* =========================================
   Mobile Response
   ========================================= */
@media screen and (max-width: 1260px) {
  .wrapper.post .page-content {
    max-width: 100%;
    padding: 0 1rem;
  }

  .side-note {
    position: static !important;
    /* Disable absolute */
    visibility: visible !important;
    width: 100%;
    margin: 1.5rem 0 !important;
    padding: 1rem !important;
    background-color: #f8fafc !important; /* slate-50 */
    border: 1px solid #e2e8f0 !important; /* slate-200 */
    border-radius: 0.5rem; /* rounded-lg */
    text-align: left !important;
  }

  .side-note.side-note-left {
    border-right: 1px solid #e2e8f0 !important;
    padding-right: 1rem !important;
  }

  .side-note.side-note-right {
    border-left: 1px solid #e2e8f0 !important;
    padding-left: 1rem !important;
  }

  .side-note::before {
    display: none !important;
  }
}
