/* ============================================================
   Build Vault — Teaching Layer
   Tooltip glossary · technique cards · novice/expert toggle
   All CSS namespaced under [data-bv-teaching] or .bv-* to avoid
   polluting the existing spec sheet styles.
============================================================ */

:root {
  --bv-paper:     oklch(0.956 0.014 80);
  --bv-paper-2:   oklch(0.925 0.020 80);
  --bv-ink:       oklch(0.175 0.004 80);
  --bv-ink-2:     oklch(0.280 0.004 80);
  --bv-muted:     oklch(0.490 0.006 80);
  --bv-hair:      oklch(0.175 0.004 80 / 0.16);
  --bv-red:       oklch(0.610 0.235 28);
  --bv-red-ink:   oklch(0.540 0.215 28);
  --bv-red-tint:  oklch(0.610 0.235 28 / 0.10);
  --bv-ease:      cubic-bezier(.2,.8,.2,1);
}
@supports not (color: oklch(0 0 0)){
  :root{
    --bv-paper:#F4F1EA; --bv-paper-2:#ECE7DB;
    --bv-ink:#111111; --bv-ink-2:#2A2A2A; --bv-muted:#555555;
    --bv-hair:rgba(17,17,17,.16);
    --bv-red:#E52521; --bv-red-ink:#C11A16; --bv-red-tint:rgba(229,37,33,.10);
  }
}

/* ---------- Glossary terms (inline) ---------- */

.bv-term {
  cursor: help;
  position: relative;
  font-style: normal;
  border-bottom: 1px dotted var(--bv-muted);
  transition: border-bottom-color 140ms var(--bv-ease), background 140ms var(--bv-ease);
}
.bv-term:hover,
.bv-term.bv-open {
  border-bottom-color: var(--bv-red-ink);
  background: var(--bv-red-tint);
}
/* Novice mode: add small superscript dot */
body.bv-mode-novice .bv-term::after {
  content: "·";
  display: inline-block;
  margin-left: 2px;
  color: var(--bv-red-ink);
  font-weight: 900;
  vertical-align: super;
  font-size: 0.7em;
  line-height: 1;
}
/* Expert mode: hide the dotted underline too (quiet) */
body.bv-mode-expert .bv-term {
  border-bottom-color: transparent;
}
body.bv-mode-expert .bv-term:hover,
body.bv-mode-expert .bv-term.bv-open {
  border-bottom-color: var(--bv-red-ink);
}

/* ---------- Popover (tooltip) ---------- */

.bv-popover {
  position: fixed;
  z-index: 1000;
  max-width: 340px;
  background: var(--bv-paper);
  color: var(--bv-ink);
  border: 2px solid var(--bv-ink);
  padding: 14px 16px 14px;
  font-family: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 160ms var(--bv-ease), transform 180ms var(--bv-ease);
  box-shadow: 0 12px 30px -8px rgba(0,0,0,.25);
}
.bv-popover.bv-shown {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.bv-popover .bv-pop-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--bv-hair);
}
.bv-popover .bv-pop-term {
  font-family: 'Archivo Black', Impact, sans-serif;
  font-size: 15px;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  color: var(--bv-ink);
  line-height: 1;
}
.bv-popover .bv-pop-cat {
  font-family: 'Geist Mono', ui-monospace, Menlo, monospace;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bv-muted);
}
.bv-popover .bv-pop-short {
  font-size: 13px;
  color: var(--bv-ink);
  margin-bottom: 8px;
  font-weight: 600;
  line-height: 1.4;
}
.bv-popover .bv-pop-body {
  color: var(--bv-ink-2);
  font-size: 12.5px;
  line-height: 1.55;
}
.bv-popover .bv-pop-expert {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--bv-hair);
  font-family: 'Archivo Black', Impact, sans-serif;
  font-size: 13px;
  color: var(--bv-ink);
  letter-spacing: -0.005em;
  line-height: 1.25;
}
.bv-popover .bv-pop-related {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--bv-hair);
  font-family: 'Geist Mono', ui-monospace, Menlo, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bv-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.bv-popover .bv-pop-related a {
  color: var(--bv-red-ink);
  text-decoration: none;
  border-bottom: 1px solid var(--bv-red-ink);
  cursor: pointer;
}
.bv-popover .bv-pop-close {
  background: none;
  border: 0;
  color: var(--bv-muted);
  font-family: 'Archivo Black', Impact, sans-serif;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

/* ---------- Novice-mode inline expansions ---------- */
/* In novice mode, inline prose that should be expanded gets an annotation */

.bv-novice-note {
  display: none;
  margin: 6px 0 4px;
  padding: 8px 10px;
  border-left: 2px solid var(--bv-red-ink);
  background: var(--bv-red-tint);
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--bv-ink);
}
body.bv-mode-novice .bv-novice-note {
  display: block;
}
.bv-novice-note::before {
  content: "NOVICE · ";
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--bv-red-ink);
  margin-right: 4px;
}

/* ---------- Floating Mode Toggle (bottom-right) ---------- */

.bv-mode-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 900;
  display: inline-flex;
  border: 2px solid var(--bv-ink);
  background: var(--bv-paper);
  font-family: 'Geist Mono', ui-monospace, Menlo, monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  box-shadow: 0 8px 24px -6px rgba(0,0,0,.25);
}
.bv-mode-toggle .bv-mode-btn {
  background: var(--bv-paper);
  color: var(--bv-muted);
  border: 0;
  padding: 10px 16px;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  transition: background 140ms var(--bv-ease), color 140ms var(--bv-ease);
  min-height: 42px;
}
.bv-mode-toggle .bv-mode-btn + .bv-mode-btn {
  border-left: 2px solid var(--bv-ink);
}
body.bv-mode-expert .bv-mode-toggle .bv-mode-btn[data-mode="expert"],
body.bv-mode-novice .bv-mode-toggle .bv-mode-btn[data-mode="novice"] {
  background: var(--bv-ink);
  color: var(--bv-paper);
}
.bv-mode-toggle .bv-mode-btn::before {
  content: "· ";
  color: var(--bv-red);
  font-weight: 900;
  opacity: 0;
  margin-right: 2px;
  transition: opacity 140ms var(--bv-ease);
}
body.bv-mode-expert .bv-mode-toggle .bv-mode-btn[data-mode="expert"]::before,
body.bv-mode-novice .bv-mode-toggle .bv-mode-btn[data-mode="novice"]::before {
  opacity: 1;
}

/* ---------- Technique Card (dedicated entity) ---------- */

.bv-technique-card {
  max-width: 720px;
  margin: 24px auto;
  background: var(--bv-paper);
  color: var(--bv-ink);
  border: 2px solid var(--bv-ink);
  padding: 24px 28px;
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
.bv-technique-card .bv-tc-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--bv-ink);
  margin-bottom: 16px;
}
.bv-technique-card .bv-tc-num {
  font-family: 'Geist Mono', ui-monospace, Menlo, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bv-muted);
}
.bv-technique-card .bv-tc-title {
  font-family: 'Archivo Black', Impact, sans-serif;
  font-size: 28px;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  line-height: 0.95;
  color: var(--bv-ink);
}
.bv-technique-card .bv-tc-title .bv-red { color: var(--bv-red); }
.bv-technique-card .bv-tc-meta {
  font-family: 'Geist Mono', ui-monospace, Menlo, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bv-muted);
}
.bv-technique-card .bv-tc-law {
  margin: 14px 0;
  padding: 10px 12px;
  background: var(--bv-ink);
  color: var(--bv-paper);
  font-family: 'Archivo Black', Impact, sans-serif;
  font-size: 15px;
  letter-spacing: 0.005em;
  line-height: 1.25;
  text-transform: uppercase;
}
.bv-technique-card .bv-tc-law .bv-red { color: var(--bv-red); }
.bv-technique-card h3 {
  font-family: 'Archivo Black', Impact, sans-serif;
  font-size: 14px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--bv-ink);
  margin: 18px 0 8px;
}
.bv-technique-card p {
  margin: 0 0 12px;
  color: var(--bv-ink-2);
}
.bv-technique-card p:last-child { margin: 0; }
.bv-technique-card p b { color: var(--bv-ink); font-weight: 700; }
.bv-technique-card p .bv-red { color: var(--bv-red-ink); font-weight: 700; }
.bv-technique-card ul {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}
.bv-technique-card ul li {
  padding: 6px 0 6px 18px;
  position: relative;
  color: var(--bv-ink-2);
  font-size: 14px;
  line-height: 1.5;
  border-top: 1px dashed var(--bv-hair);
}
.bv-technique-card ul li:first-child { border-top: 0; }
.bv-technique-card ul li::before {
  content: "·";
  position: absolute;
  left: 0;
  top: 6px;
  color: var(--bv-ink);
  font-weight: 700;
  font-family: 'Archivo Black', Impact, sans-serif;
  font-size: 15px;
  line-height: 1;
}
.bv-technique-card .bv-tc-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 2px solid var(--bv-ink);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-family: 'Geist Mono', ui-monospace, Menlo, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.bv-technique-card .bv-tc-footer .bv-label {
  color: var(--bv-muted);
}
.bv-technique-card .bv-tc-footer a {
  color: var(--bv-ink);
  text-decoration: none;
  border: 1.5px solid var(--bv-ink);
  padding: 4px 9px;
  transition: background 140ms var(--bv-ease), color 140ms var(--bv-ease);
}
.bv-technique-card .bv-tc-footer a:hover {
  background: var(--bv-ink);
  color: var(--bv-paper);
}

/* ---------- Print / Reduced Motion ---------- */

@media print {
  .bv-mode-toggle,
  .bv-popover {
    display: none !important;
  }
  .bv-term {
    border-bottom-color: transparent !important;
  }
  body.bv-mode-novice .bv-term::after {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bv-term, .bv-popover, .bv-mode-toggle .bv-mode-btn {
    transition-duration: 0.001ms !important;
  }
}
