/**
 * vidhi-panel.css
 * ─────────────────────────────────────────────────────────────────
 * Styles for the Vidhi anchor panel on φ¹ and φ² post pages.
 * Uses the same night-sky design tokens as akeru-renderer.css.
 *
 * Repo path: shared/panel/vidhi-panel.css
 */

/* ── Anchor spans in post body ──────────────────────────────────── */
.vidhi-anchor {
  border-bottom: 1px solid rgba(143, 180, 232, 0.30);
  cursor: help;
  transition: border-color 0.2s, color 0.2s;
  position: relative;
  white-space: nowrap;
}

.vidhi-anchor::after {
  content: ' ✦';
  font-size: 0.6em;
  color: rgba(143, 180, 232, 0);
  transition: color 0.2s, opacity 0.2s;
  vertical-align: super;
  letter-spacing: 0;
  pointer-events: none;
}

.vidhi-anchor:hover {
  border-color: rgba(143, 180, 232, 0.7);
  color: rgba(225, 232, 255, 1);
}

.vidhi-anchor:hover::after {
  color: rgba(143, 180, 232, 0.8);
}

.vidhi-anchor.vp-active {
  border-color: rgba(143, 180, 232, 0.9);
  border-bottom-style: solid;
  color: rgba(225, 232, 255, 1);
}

.vidhi-anchor.vp-active::after {
  color: rgba(143, 180, 232, 1);
}

/* ── Body modifier when panel is open ──────────────────────────── */
.vp-body-open {
  /* Post does not reflow — panel overlays */
}

/* ── Panel shell ────────────────────────────────────────────────── */
.vidhi-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  max-width: 92vw;
  z-index: 200;

  display: flex;
  flex-direction: column;

  background: rgba(2, 6, 20, 0.92);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border-left: 1px solid rgba(160, 185, 255, 0.10);
  box-shadow: -8px 0 60px rgba(0, 0, 0, 0.6);

  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.vidhi-panel.vp-open {
  transform: translateX(0);
}

/* Top shimmer edge */
.vidhi-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(143, 180, 232, 0.18), transparent);
  pointer-events: none;
}

/* ── Header ─────────────────────────────────────────────────────── */
.vp-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.4rem 1.4rem 1rem;
  border-bottom: 1px solid rgba(160, 185, 255, 0.08);
  flex-shrink: 0;
  gap: 0.75rem;
}

.vp-label-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.vp-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(143, 180, 232, 0.45);
}

.vp-concept-label {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 500;
  color: rgba(225, 232, 255, 0.92);
  letter-spacing: 0.01em;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vp-close {
  background: none;
  border: 1px solid rgba(160, 185, 255, 0.10);
  color: rgba(120, 140, 185, 0.50);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 1px;
  flex-shrink: 0;
  transition: color 0.2s, border-color 0.2s;
  margin-top: 0.1rem;
}

.vp-close:hover {
  color: rgba(143, 180, 232, 0.8);
  border-color: rgba(143, 180, 232, 0.25);
}

/* ── Messages ───────────────────────────────────────────────────── */
.vp-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.4rem 1.4rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  scroll-behavior: smooth;
}

.vp-messages::-webkit-scrollbar { width: 3px; }
.vp-messages::-webkit-scrollbar-track { background: transparent; }
.vp-messages::-webkit-scrollbar-thumb {
  background: rgba(143, 180, 232, 0.12);
  border-radius: 2px;
}

/* ── Message bubbles ────────────────────────────────────────────── */
.vp-msg {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  animation: vp-msg-in 0.24s ease forwards;
}

@keyframes vp-msg-in {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.vp-msg--user  { align-self: flex-end;  align-items: flex-end;  max-width: 90%; }
.vp-msg--assistant { align-self: flex-start; max-width: 100%; }

.vp-role {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.56rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(120, 140, 185, 0.35);
}

.vp-body {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.88rem;
  line-height: 1.72;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(160, 185, 255, 0.09);
  position: relative;
}

.vp-msg--user .vp-body {
  background: rgba(143, 180, 232, 0.07);
  border-color: rgba(143, 180, 232, 0.12);
  color: rgba(200, 218, 255, 0.88);
}

.vp-msg--assistant .vp-body {
  background: rgba(3, 8, 26, 0.45);
  color: rgba(225, 232, 255, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.vp-msg--assistant .vp-body::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(180, 210, 255, 0.09), transparent);
}

/* Markdown inside bubbles (via AkeruRenderer or raw) */
.vp-body p { margin: 0 0 0.55em; }
.vp-body p:last-child { margin-bottom: 0; }
.vp-body strong { font-weight: 600; color: rgba(225, 232, 255, 0.95); }
.vp-body em { font-style: italic; color: rgba(155, 172, 215, 0.7); }
.vp-body code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.73rem;
  background: rgba(143, 180, 232, 0.10);
  padding: 0.1em 0.32em;
  color: #8fb4e8;
  border: 1px solid rgba(143, 180, 232, 0.14);
}
.vp-body pre {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.71rem;
  background: rgba(1, 4, 16, 0.65);
  border: 1px solid rgba(160, 185, 255, 0.09);
  padding: 0.75rem 0.9rem;
  overflow-x: auto;
  margin: 0.6rem 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.vp-body ul, .vp-body ol { padding-left: 1.25rem; margin: 0.3rem 0 0.55rem; }
.vp-body li { margin: 0.15rem 0; }

/* Streaming cursor */
.vp-cursor {
  display: inline-block;
  width: 1.5px;
  height: 0.82em;
  background: rgba(143, 180, 232, 0.40);
  animation: vp-blink 0.85s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}

@keyframes vp-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Input row ──────────────────────────────────────────────────── */
.vp-input-row {
  border-top: 1px solid rgba(160, 185, 255, 0.08);
  padding: 0.85rem 1.1rem;
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  flex-shrink: 0;
  background: rgba(2, 4, 14, 0.3);
}

.vp-input-wrap { flex: 1; }

.vp-textarea {
  width: 100%;
  background: rgba(4, 10, 32, 0.6);
  border: 1px solid rgba(160, 185, 255, 0.09);
  color: rgba(225, 232, 255, 0.92);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.86rem;
  padding: 0.55rem 0.8rem;
  resize: none;
  min-height: 38px;
  max-height: 120px;
  line-height: 1.5;
  transition: border-color 0.2s;
}

.vp-textarea::placeholder { color: rgba(120, 140, 185, 0.30); }

.vp-textarea:focus {
  outline: none;
  border-color: rgba(143, 180, 232, 0.22);
  box-shadow: 0 0 0 2px rgba(143, 180, 232, 0.04);
}

.vp-textarea:disabled { opacity: 0.45; }

.vp-send-btn {
  background: rgba(143, 180, 232, 0.06);
  border: 1px solid rgba(160, 185, 255, 0.10);
  color: rgba(143, 180, 232, 0.45);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  padding: 0.42rem 0.7rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  white-space: nowrap;
  align-self: flex-end;
}

.vp-send-btn:hover:not(:disabled) {
  color: #8fb4e8;
  border-color: rgba(143, 180, 232, 0.22);
  background: rgba(143, 180, 232, 0.10);
}

.vp-send-btn:disabled { opacity: 0.28; cursor: default; }

/* ── Mobile ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .vidhi-panel {
    width: 100vw;
    max-width: 100vw;
    top: auto;
    height: 75vh;
    border-left: none;
    border-top: 1px solid rgba(160, 185, 255, 0.10);
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .vidhi-panel.vp-open { transform: translateY(0); }
  .vidhi-panel::before { display: none; }
}
