/* cv-enhance.css -- progressive-enhancement layer for the live CV.
   Loaded only by the hosted page (public/cv/index.html); the PDF never sees it.
   Palette of the CV: indigo #4338ca, teal #0f8473, IBM Plex. */

:root {
  --cvx-indigo: #4338ca;
  --cvx-indigo-soft: #eef0fd;
  --cvx-teal: #0f8473;
  --cvx-ink: #15181f;
  --cvx-mut: #6b7180;
  --cvx-line: #e2e5ec;
  --cvx-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --cvx-sans: 'IBM Plex Sans', system-ui, sans-serif;
}

/* ---------- 1. scroll progress bar ---------- */
#cvx-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--cvx-indigo), var(--cvx-teal));
  z-index: 9000; transition: width .08s linear;
}

/* ---------- 2. full-width top bar ---------- */
#cvx-topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 46px; z-index: 8500; box-sizing: border-box;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 14px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--cvx-line);
}
.cvx-tb-right { display: flex; align-items: center; gap: 8px; }
.cvx-dl { background: var(--cvx-indigo) !important; color: #fff !important; border-color: var(--cvx-indigo) !important; }
.cvx-dl:hover { background: #3730a3 !important; }
@media (max-width: 700px) { .cvx-dl span { display: none; } }
.cvx-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font: 600 11px/1 var(--cvx-mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--cvx-indigo); background: #fff; border: 1px solid #dcdffa;
  border-radius: 7px; padding: 7px 9px; box-shadow: 0 1px 4px rgba(21,24,31,.08);
  -webkit-user-select: none; user-select: none;
}
.cvx-btn:hover { background: var(--cvx-indigo-soft); }
.cvx-btn svg { width: 14px; height: 14px; }
.cvx-kbd {
  font: 600 10px/1 var(--cvx-mono); color: var(--cvx-mut);
  border: 1px solid var(--cvx-line); border-radius: 4px; padding: 2px 4px; background: #f6f7fb;
}

/* ---------- 3. section rail (wide screens only) ---------- */
#cvx-rail {
  position: fixed; top: 50%; left: 18px; transform: translateY(-50%);
  z-index: 8000; max-height: 84vh; overflow: auto; padding: 4px 0;
  display: none; scrollbar-width: none;
}
#cvx-rail::-webkit-scrollbar { display: none; }
@media (min-width: 1180px) { #cvx-rail { display: block; } }
.cvx-rail-item {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 3px 6px; border-radius: 6px; white-space: nowrap;
}
.cvx-rail-item::before {
  content: ''; flex: none; width: 16px; height: 2px; border-radius: 2px;
  background: var(--cvx-line); transition: background .15s, width .15s;
}
/* collapsed: only the tick marks show; labels reveal on hover */
.cvx-rail-item span {
  font: 500 11px/1.3 var(--cvx-sans); color: var(--cvx-mut);
  max-width: 0; overflow: hidden; opacity: 0; transition: max-width .2s ease, opacity .2s ease;
}
#cvx-rail:hover .cvx-rail-item span { max-width: 240px; opacity: 1; }
.cvx-rail-item.part { margin-top: 8px; }
#cvx-rail:hover { background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border-radius: 10px; box-shadow: 0 4px 20px rgba(21,24,31,.12); }
.cvx-rail-item:hover span { color: var(--cvx-ink); }
.cvx-rail-item.active span { color: var(--cvx-indigo); font-weight: 600; }
.cvx-rail-item.active::before { background: var(--cvx-indigo); width: 22px; }

/* ---------- 4. copy-link on section headers ---------- */
.cvx-copy {
  opacity: 0; margin-left: 8px; cursor: pointer; vertical-align: middle;
  color: var(--cvx-mut); transition: opacity .15s, color .15s; border: 0; background: none;
}
.sec-h:hover .cvx-copy, .cvx-copy:focus { opacity: 1; }
.cvx-copy:hover { color: var(--cvx-indigo); }
.cvx-copy svg { width: 13px; height: 13px; }
.cvx-copy.done { color: var(--cvx-teal); opacity: 1; }

/* ---------- 5. command palette ---------- */
#cvx-palette-bg {
  position: fixed; inset: 0; z-index: 9500; display: none;
  background: rgba(15,18,28,.45); backdrop-filter: blur(3px);
  align-items: flex-start; justify-content: center; padding-top: 12vh;
}
#cvx-palette-bg.open { display: flex; }
#cvx-palette {
  width: min(620px, 92vw); background: #fff; border-radius: 14px;
  box-shadow: 0 24px 70px rgba(15,18,28,.4); overflow: hidden;
  border: 1px solid #e6e8f0;
}
#cvx-palette input {
  width: 100%; box-sizing: border-box; border: 0; outline: 0;
  font: 400 16px/1.4 var(--cvx-sans); color: var(--cvx-ink);
  padding: 16px 18px; border-bottom: 1px solid var(--cvx-line);
}
#cvx-results { max-height: 52vh; overflow: auto; padding: 6px; }
.cvx-res {
  display: flex; align-items: baseline; gap: 10px; padding: 9px 12px;
  border-radius: 9px; cursor: pointer;
}
.cvx-res.sel, .cvx-res:hover { background: var(--cvx-indigo-soft); }
.cvx-res .k { font: 600 9px/1.3 var(--cvx-mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--cvx-teal); flex: none; width: 64px; padding-top: 2px; }
.cvx-res .t { font: 500 13.5px/1.35 var(--cvx-sans); color: var(--cvx-ink); }
.cvx-res .t small { display: block; font-weight: 400; color: var(--cvx-mut); font-size: 11.5px; margin-top: 1px; }
#cvx-palette .empty { padding: 22px; text-align: center; color: var(--cvx-mut); font: 400 13px var(--cvx-sans); }
#cvx-palette .hint { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--cvx-line);
  font: 500 10px/1 var(--cvx-mono); color: var(--cvx-mut); letter-spacing: .04em; }

/* ---------- 6. search highlight + filter ---------- */
mark.cvx-hit { background: #fde68a; color: inherit; border-radius: 2px; padding: 0 1px; }
mark.cvx-hit.cur { background: #f59e0b; color: #fff; }
.cvx-dim { opacity: .16; transition: opacity .2s; }
#cvx-searchbar {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%) translateY(-150%);
  z-index: 8600; background: #fff; border: 1px solid #dcdffa; border-radius: 9px;
  box-shadow: 0 6px 24px rgba(21,24,31,.16); display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; transition: transform .2s ease;
}
#cvx-searchbar.open { transform: translateX(-50%) translateY(0); }
#cvx-searchbar input { border: 0; outline: 0; font: 400 13px var(--cvx-sans); width: 220px; color: var(--cvx-ink); }
#cvx-searchbar .count { font: 600 11px/1 var(--cvx-mono); color: var(--cvx-mut); min-width: 42px; text-align: right; }
#cvx-searchbar button { border: 0; background: none; cursor: pointer; color: var(--cvx-mut); font: 600 13px var(--cvx-mono); padding: 2px 5px; border-radius: 5px; }
#cvx-searchbar button:hover { background: var(--cvx-indigo-soft); color: var(--cvx-indigo); }

/* ---------- 7. count-up + scroll-reveal ---------- */
.cvx-reveal { opacity: 0; transform: translateY(14px); }
.cvx-reveal.in { opacity: 1; transform: none; transition: opacity .5s ease, transform .5s ease; }
@media (prefers-reduced-motion: reduce) {
  .cvx-reveal, .cvx-reveal.in { opacity: 1; transform: none; transition: none; }
}

/* ---------- 8. dark mode (curated palette map) ----------
   The captured page's colors are serialized inline rgb() values drawn from a
   small fixed palette, so each one is remapped explicitly. If the master's
   palette changes, update this map. */
html.cvx-dark { background: #0d0e12; }
html.cvx-dark body, html.cvx-dark #dc-root { background: #0d0e12; }
html.cvx-dark .doc { background: #14161d !important; box-shadow: none !important; }
/* text grays */
html.cvx-dark #dc-root [style*="color: rgb(21, 24, 31)"]    { color: #e7e9f0 !important; }
html.cvx-dark #dc-root [style*="color: rgb(58, 63, 76)"]    { color: #c2c8d4 !important; }
html.cvx-dark #dc-root [style*="color: rgb(91, 97, 112)"]   { color: #a2a9b8 !important; }
html.cvx-dark #dc-root [style*="color: rgb(107, 113, 128)"] { color: #979fae !important; }
html.cvx-dark #dc-root [style*="color: rgb(138, 144, 160)"] { color: #848c9c !important; }
/* part accents, brightened for contrast on dark */
html.cvx-dark #dc-root [style*="color: rgb(67, 56, 202)"]   { color: #9aa2ff !important; }
html.cvx-dark #dc-root [style*="color: rgb(15, 132, 115)"]  { color: #3cc7b0 !important; }
html.cvx-dark #dc-root [style*="color: rgb(180, 83, 9)"]    { color: #e8964a !important; }
html.cvx-dark #dc-root [style*="color: rgb(30, 78, 140)"]   { color: #7fabe2 !important; }
html.cvx-dark #dc-root [style*="color: rgb(109, 40, 217)"]  { color: #b490f4 !important; }
/* surfaces (masthead navy rgb(30, 27, 78) stays as designed) */
html.cvx-dark #dc-root [style*="background: rgb(255, 255, 255)"] { background: #14161d !important; }
html.cvx-dark #dc-root [style*="background: rgb(246, 247, 251)"] { background: #191c25 !important; }
html.cvx-dark #dc-root [style*="background: rgb(238, 240, 253)"] { background: #1b1d31 !important; }
html.cvx-dark #dc-root [style*="background: rgb(220, 223, 250)"] { background: #20233c !important; }
html.cvx-dark #dc-root [style*="background: rgb(251, 240, 228)"] { background: #262017 !important; }
html.cvx-dark #dc-root [style*="background: rgb(240, 224, 204)"] { background: #2b2318 !important; }
html.cvx-dark #dc-root [style*="background: rgb(210, 234, 223)"] { background: #16231e !important; }
html.cvx-dark #dc-root [style*="background: rgb(236, 238, 243)"] { background: #262a35 !important; }
/* hairlines and borders */
html.cvx-dark #dc-root [style*="rgb(240, 241, 245)"],
html.cvx-dark #dc-root [style*="rgb(243, 244, 247)"],
html.cvx-dark #dc-root [style*="rgb(236, 238, 243)"],
html.cvx-dark #dc-root [style*="rgb(231, 233, 241)"],
html.cvx-dark #dc-root [style*="rgb(228, 230, 236)"] { border-color: #262a35 !important; }
/* imagery sits back a touch */
html.cvx-dark #dc-root img { filter: brightness(.85); }
/* chrome */
html.cvx-dark #cvx-topbar { background: rgba(18,20,26,.92); border-color: #2c2f3a; }
html.cvx-dark #cvx-topbar .cvx-btn,
html.cvx-dark #cvx-rail:hover { background: #1b1d24; color: #c7c9f5; border-color: #2c2f3a; }
html.cvx-dark mark.cvx-hit { background: #7c5e00; color: #fff; }
html.cvx-dark #cvx-palette { background: #15171f; border-color: #2c2f3a; }
html.cvx-dark #cvx-palette input { color: #e7e9f0; border-color: #2c2f3a; background: #15171f; }
html.cvx-dark .cvx-res .t { color: #d8dce4; }
html.cvx-dark .cvx-res.sel, html.cvx-dark .cvx-res:hover { background: #20233c; }

/* ---------- 10. Ask my CV chat (reuses the live /api/query backend) ---------- */
#cvx-ask-btn {
  position: fixed; right: 18px; bottom: 18px; z-index: 8700;
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font: 600 12px/1 var(--cvx-mono); letter-spacing: .04em; color: #fff;
  background: var(--cvx-indigo); border: 0; border-radius: 999px; padding: 12px 16px;
  box-shadow: 0 6px 22px rgba(67,56,202,.4);
}
#cvx-ask-btn:hover { background: #3730a3; }
#cvx-ask-btn svg { width: 16px; height: 16px; }
#cvx-ask {
  position: fixed; right: 18px; bottom: 18px; z-index: 8800;
  width: min(390px, 94vw); height: min(600px, 76vh);
  display: none; flex-direction: column; background: #fff; border-radius: 16px;
  overflow: hidden; box-shadow: 0 24px 70px rgba(15,18,28,.42); border: 1px solid #e6e8f0;
}
#cvx-ask.open { display: flex; }
.cvx-ask-hd { display: flex; align-items: center; gap: 10px; padding: 13px 15px;
  background: linear-gradient(135deg, var(--cvx-indigo), #5b21b6); color: #fff; }
.cvx-ask-hd .ttl { font: 600 13px/1.2 var(--cvx-sans); }
.cvx-ask-hd .sub { font: 400 9.5px/1.2 var(--cvx-mono); opacity: .8; letter-spacing: .04em; }
.cvx-ask-hd button { margin-left: auto; background: none; border: 0; color: #fff; cursor: pointer; opacity: .85; font: 600 15px/1 var(--cvx-mono); }
.cvx-ask-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #f7f8fc; }
.cvx-msg { max-width: 86%; font: 400 12.5px/1.5 var(--cvx-sans); padding: 9px 12px; border-radius: 12px; white-space: pre-wrap; word-wrap: break-word; }
.cvx-msg.user { align-self: flex-end; background: var(--cvx-indigo); color: #fff; border-bottom-right-radius: 4px; }
.cvx-msg.bot { align-self: flex-start; background: #fff; color: var(--cvx-ink); border: 1px solid var(--cvx-line); border-bottom-left-radius: 4px; }
.cvx-msg .meta { display: block; margin-top: 6px; font: 600 8.5px/1 var(--cvx-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--cvx-teal); }
.cvx-typing span { display: inline-block; width: 6px; height: 6px; margin: 0 1px; border-radius: 50%; background: var(--cvx-mut); animation: cvxbounce 1s infinite; }
.cvx-typing span:nth-child(2) { animation-delay: .15s; } .cvx-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes cvxbounce { 0%,60%,100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.cvx-sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.cvx-sugg button { font: 500 11px/1.3 var(--cvx-sans); color: var(--cvx-indigo); background: var(--cvx-indigo-soft);
  border: 1px solid #dcdffa; border-radius: 999px; padding: 6px 10px; cursor: pointer; text-align: left; }
.cvx-sugg button:hover { background: #e4e7fc; }
.cvx-ask-in { display: flex; gap: 8px; padding: 11px; border-top: 1px solid var(--cvx-line); background: #fff; }
.cvx-ask-in input { flex: 1; border: 1px solid var(--cvx-line); border-radius: 9px; padding: 9px 11px; font: 400 12.5px var(--cvx-sans); outline: 0; }
.cvx-ask-in input:focus { border-color: var(--cvx-indigo); }
.cvx-ask-in button { background: var(--cvx-indigo); color: #fff; border: 0; border-radius: 9px; padding: 0 14px; cursor: pointer; display: flex; align-items: center; }
.cvx-ask-in button:disabled { opacity: .5; cursor: default; }
.cvx-ask-in button svg { width: 15px; height: 15px; }

/* ---------- 11. one-page summary CTA with animated snake border ---------- */
@property --cvx-ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.cvx-1pager {
  position: relative; flex: none;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  font: 600 11px/1 var(--cvx-mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--cvx-indigo); background: #fff; border-radius: 999px; padding: 9px 14px;
}
.cvx-1pager:hover { color: #3730a3; }
.cvx-1pager::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 2px; pointer-events: none;
  background: conic-gradient(from var(--cvx-ang), transparent 52%, #6366f1 76%, #14b8a6 88%, #6366f1 96%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
  animation: cvx-snake 2.6s linear infinite;
}
@keyframes cvx-snake { to { --cvx-ang: 360deg; } }
@media (max-width: 720px) { .cvx-1pager span { display: none; } }
html.cvx-dark .cvx-1pager { background: #1b1d24; }

/* ---------- 11. mobile: reflow the fixed-width page under 700px ---------- */
@media (max-width: 700px) {
  .doc { width: auto !important; min-width: 0 !important; max-width: 100vw !important;
         padding: 16px 14px !important; box-sizing: border-box !important; }
  #dc-root [style*="width: 826px"] { width: auto !important; min-width: 0 !important; }
  #dc-root [style*="display: grid"] { display: block !important; }
  #dc-root [style*="display: flex"] { flex-wrap: wrap; }
  .pub > div:last-child, .entry > div:last-child,
  .card > div:last-child, .award > div:last-child { padding-top: 6px !important; }
}

/* print: hide everything we added */
@media print { #cvx-progress, #cvx-topbar, #cvx-rail, #cvx-palette-bg, #cvx-searchbar, #cvx-ask, #cvx-ask-btn, .cvx-copy { display: none !important; } }
