/* ══════════════════════════════════════════════
   PAGE GUIDE SYSTEM — Contextual navigation help
   5 layers: glossary, taglines, briefs, guide panel, hints
   ══════════════════════════════════════════════ */

/* ── Layer 1: Glossary term underlines + tooltips ── */
.pg-term {
  border-bottom: 1px dotted var(--text3);
  cursor: help;
  position: relative;
  white-space: nowrap;
}
.pg-term::after {
  content: attr(data-pg-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: normal;
  width: max-content;
  max-width: 280px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
  pointer-events: none;
  z-index: 200;
  text-align: left;
}
.pg-term::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--text);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
  pointer-events: none;
  z-index: 200;
}
.pg-term:hover::after,
.pg-term:hover::before {
  opacity: 1;
  visibility: visible;
}

/* ── Layer 4: "How to read this" guide panel ── */
.pg-guide-wrap {
  margin: 12px 0 20px;
}
.pg-guide-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px 6px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text3);
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
}
.pg-guide-toggle:hover {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-bg);
}
.pg-guide-icon {
  opacity: 0.7;
  flex-shrink: 0;
}
.pg-guide-toggle:hover .pg-guide-icon {
  opacity: 1;
}
.pg-guide-chevron {
  opacity: 0.5;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.pg-expanded .pg-guide-chevron {
  transform: rotate(180deg);
}
.pg-guide-toggle-text {
  font-size: 12.5px;
  letter-spacing: 0.01em;
}

.pg-guide-body {
  margin-top: 10px;
  padding: 14px 18px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  animation: pgSlideIn 0.2s ease;
}
@keyframes pgSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.pg-guide-list {
  margin: 0;
  padding: 0 0 0 18px;
  list-style: none;
}
.pg-guide-list li {
  position: relative;
  font-size: 13px;
  color: var(--text2);
  line-height: 1.65;
  margin-bottom: 8px;
  padding-left: 4px;
}
.pg-guide-list li:last-child {
  margin-bottom: 0;
}
.pg-guide-list li::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}
.pg-guide-list li strong {
  font-weight: 600;
  color: var(--text);
}

/* ── Layer 5: Freshness badge ── */
.pg-freshness {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text3);
  font-weight: 400;
  letter-spacing: 0.01em;
}
.pg-freshness svg {
  opacity: 0.6;
}

/* ── Layer 5: First-visit pulse animation ── */
.pg-pulse {
  animation: pgPulseGlow 1.5s ease-in-out 2;
}
@keyframes pgPulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
  50% { box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15); }
}

/* ── Dark mode adjustments ── */
[data-theme="dark"] .pg-term::after {
  background: #e2e8f0;
  color: #1e293b;
}
[data-theme="dark"] .pg-term::before {
  border-top-color: #e2e8f0;
}
[data-theme="dark"] .pg-guide-body {
  background: rgba(255,255,255,0.03);
}
