/* =====================================================================
   Clarifyed.ai - Live whiteboard showcase
   EXACT ports of the clarifyed-frontend card UI (card-view.css) +
   the Meeting ControlBar, dropped onto a claymorphic cream board.
   ===================================================================== */

/* ---- Claymorphic whiteboard board (sits inside dark .bv2-wb section) ---- */
.bv2-board {
  position: relative;
  max-width: 880px;
  margin: 0 auto;
  background: transparent;     /* no whiteboard surface — cards sit on the black section */
  padding: 0;
}
.bv2-board__canvas {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 10px 0 120px;
}

/* ===========================================================
   cv-note — the card shell (EXACT from card-view.css)
   =========================================================== */
.cv-note {
  width: auto;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 0;
  padding: 0 0 28px;
  font-family: 'Caveat', cursive;
}
.bv2-board__canvas > .cv-note:last-child { border-bottom: none; }
.cv-note--new { animation: cv-write-in 0.5s ease-out; }
@keyframes cv-write-in {
  0%   { opacity: 1; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}
.cv-note-title {
  font-family: 'Caveat', cursive;
  font-size: clamp(2rem, 1.6rem + 0.9vw, 2.5rem);
  font-weight: 700;
  color: #ea580c;
  margin: 0 0 14px;
  letter-spacing: 0.01em;
  line-height: 1.15;
}
/* Colour rotation across the lesson — each card title picks a different
   palette colour by its DOM position (EXACT from card-view.css). */
[data-card-id]:nth-child(6n+1) .cv-note-title { color: #2563eb; } /* blue */
[data-card-id]:nth-child(6n+2) .cv-note-title { color: #c2410c; } /* coral */
[data-card-id]:nth-child(6n+3) .cv-note-title { color: #7a9e7e; } /* sage */
[data-card-id]:nth-child(6n+4) .cv-note-title { color: #8e6e8b; } /* plum */
[data-card-id]:nth-child(6n+5) .cv-note-title { color: #6fa8c9; } /* sky */
[data-card-id]:nth-child(6n+6) .cv-note-title { color: #e8b85f; } /* butter */

/* Image (EXACT) */
.cv-note-image-wrap { margin-top: 12px; }
.cv-note-image { width: 100%; border-radius: 10px; display: block; }

/* Tailwind utilities used verbatim by CardDesmos */
.w-full { width: 100%; }
.aspect-\[4\/3\] { aspect-ratio: 4 / 3; }
.rounded-lg { border-radius: 0.5rem; }
.overflow-hidden { overflow: hidden; }

/* ===========================================================
   .cvcode — editor-style fenced code block (EXACT card-view.css)
   =========================================================== */
.cvcode {
  --cvcode-bg: #0d1117;
  --cvcode-bar: #161b22;
  --cvcode-border: #30363d;
  --cvcode-fg: #e6edf3;
  --cvcode-muted: #8b949e;
  width: 100%;
  margin: 0.7em 0 0;
  border: 1px solid var(--cvcode-border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--cvcode-bg);
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}
.cvcode__bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; row-gap: 6px;
  padding: 7px 10px;
  background: var(--cvcode-bar);
  border-bottom: 1px solid var(--cvcode-border);
}
.cvcode__lang {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
  color: var(--cvcode-fg);
}
.cvcode__btn { flex-shrink: 0; }
.cvcode__lang svg { display: block; }
.cvcode__file {
  font-size: 0.7rem; color: var(--cvcode-muted);
  padding: 1px 7px; border: 1px solid var(--cvcode-border); border-radius: 6px;
}
.cvcode__spacer { flex: 1; }
.cvcode__btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 8px;
  border: 1px solid var(--cvcode-border); border-radius: 7px;
  background: transparent; color: var(--cvcode-muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem; font-weight: 600; cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.cvcode__btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--cvcode-fg); }
.cvcode__btn--run { color: #3fb950; border-color: rgba(63, 185, 80, 0.4); }
.cvcode__btn--run:hover:not(:disabled) { background: rgba(63, 185, 80, 0.12); color: #56d364; }
.cvcode__btn:disabled { opacity: 0.55; cursor: default; }
.cvcode__spin { display: inline-flex; animation: cvcode-spin 0.8s linear infinite; }
@keyframes cvcode-spin { to { transform: rotate(360deg); } }
.cvcode__scroll {
  display: flex; align-items: stretch; overflow: auto; max-height: 460px;
  background: var(--cvcode-bg);
}
.cvcode__gutter {
  position: sticky; left: 0; z-index: 1;
  display: flex; flex-direction: column; flex: 0 0 auto;
  padding: 12px 10px 12px 12px; text-align: right;
  background: var(--cvcode-bg); color: #484f58;
  font-size: 12.5px; line-height: 1.55; user-select: none;
  border-right: 1px solid var(--cvcode-border);
}
.cvcode__gutter span { display: block; }
.cvcode .cvcode__pre {
  margin: 0; padding: 12px 14px; flex: 1 1 auto; overflow: visible;
  background: transparent; border-radius: 0; white-space: pre;
  font-size: 12.5px; line-height: 1.55; color: var(--cvcode-fg);
}
.cvcode .cvcode__pre code,
.cvcode .cvcode__pre code.hljs {
  background: transparent; padding: 0; font-family: inherit;
  font-size: 12.5px; line-height: 1.55; color: var(--cvcode-fg);
}
.cvcode__out {
  border-top: 1px solid var(--cvcode-border);
  background: #0a0d12; padding: 8px 12px 10px;
}
.cvcode__out-meta {
  display: flex; gap: 6px; align-items: center;
  font-size: 0.68rem; color: var(--cvcode-muted); margin-bottom: 6px;
}
.cvcode__out-prompt {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700; color: #ff7b72;
}
.cvcode .cvcode__out-std,
.cvcode .cvcode__out-err {
  margin: 0; padding: 0; background: transparent; border-radius: 0;
  white-space: pre-wrap; word-break: break-word;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px; line-height: 1.5;
}
.cvcode .cvcode__out-std { color: #c9d1d9; }
.cvcode .cvcode__out-err { color: #ff7b72; }

/* ===========================================================
   Interactive card — canvas + sidebar (mirrors cv-ghost-interactive)
   =========================================================== */
.cv-interactive {
  display: flex; gap: 14px; margin-top: 0.6em;
  background: #fff; border: 1px solid rgba(26, 24, 20, 0.1);
  border-radius: 12px; padding: 12px; overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.6);
}
.cv-interactive__canvas { flex: 1; height: 240px; display: block; }
.cv-interactive__sidebar {
  width: 150px; flex: 0 0 auto;
  display: flex; flex-direction: column; gap: 14px;
  padding: 6px 4px;
}
.cv-interactive__slider label {
  display: block; font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-muted); margin-bottom: 8px;
}
.cv-interactive__slider label b { color: var(--coral-deep); font-weight: 700; }
.cv-interactive__slider input[type="range"] { width: 100%; accent-color: var(--coral); }
@media (max-width: 640px) {
  .cv-interactive { flex-direction: column; }
  .cv-interactive__canvas { height: 200px; width: 100%; }
  .cv-interactive__sidebar { width: 100%; }
}

/* ===========================================================
   AnimationCard — seamless code-rendered video (EXACT cv-anim)
   =========================================================== */
.cv-anim { background: transparent; border: none; padding: 0; margin: 0.4em 0 0; }
.cv-anim-video {
  display: block; width: 100%; height: auto; max-height: 70vh;
  object-fit: contain; background: transparent; border: none;
  border-radius: 10px; mix-blend-mode: multiply;
}
.bv2-anim__frame { position: relative; aspect-ratio: 16 / 10; }
.bv2-anim__cv { width: 100%; height: 100%; display: block; }
.bv2-anim__play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: rgba(255, 255, 255, 0.92); color: var(--ink);
  cursor: pointer; display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); transition: transform 0.15s ease;
}
.bv2-anim__play:hover { transform: translate(-50%, -50%) scale(1.06); }
.bv2-anim__play.is-playing { opacity: 0; pointer-events: none; }

/* ===========================================================
   ImageProcessingOverlay (EXACT from the component, looped)
   =========================================================== */
.cv-img-proc {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
  border-radius: inherit; --inset: 5%; --grow: 2.8s;
}
.cv-img-proc-box {
  position: absolute; top: var(--inset); left: var(--inset);
  width: 0; height: 0;
  border: 2px dashed rgba(26, 60, 160, 0.92); background: transparent;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.45);
}
.cv-img-proc--diag .cv-img-proc-box { animation: cv-proc-box-diag var(--grow) cubic-bezier(0.22, 0.61, 0.36, 1) forwards; }
.cv-img-proc--l .cv-img-proc-box { animation: cv-proc-box-l var(--grow) cubic-bezier(0.22, 0.61, 0.36, 1) forwards; }
@keyframes cv-proc-box-diag {
  0% { width: 4px; height: 4px; }
  100% { width: calc(100% - 2 * var(--inset)); height: calc(100% - 2 * var(--inset)); }
}
@keyframes cv-proc-box-l {
  0% { width: 4px; height: 4px; }
  35% { width: calc((100% - 2 * var(--inset)) * 0.92); height: calc((100% - 2 * var(--inset)) * 0.16); }
  100% { width: calc(100% - 2 * var(--inset)); height: calc(100% - 2 * var(--inset)); }
}
.cv-img-proc-shimmer {
  position: absolute; inset: 0;
  background-image: linear-gradient(115deg,
    rgba(80, 130, 220, 0.06) 0%, rgba(80, 130, 220, 0.20) 40%,
    rgba(140, 185, 255, 0.62) 50%, rgba(80, 130, 220, 0.20) 60%,
    rgba(80, 130, 220, 0.06) 100%);
  background-size: 220% 100%; background-repeat: no-repeat;
  animation: cv-proc-shimmer 1.6s ease-in-out 2 forwards; mix-blend-mode: screen;
}
@keyframes cv-proc-shimmer { 0% { background-position: 220% 0; } 100% { background-position: -120% 0; } }
.cv-img-proc-corner {
  position: absolute; width: 9px; height: 9px; margin: -5px;
  background: #ffffff; border: 1.5px solid rgba(26, 60, 160, 0.95);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.cv-img-proc-corner--tl { top: 0; left: 0; }
.cv-img-proc-corner--tr { top: 0; right: 0; }
.cv-img-proc-corner--br { bottom: 0; right: 0; }
.cv-img-proc-corner--bl { bottom: 0; left: 0; }
.cv-img-proc-pfp {
  position: absolute; width: 34px; height: 34px; margin: -17px;
  border-radius: 50%; background: white; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  top: var(--inset); left: var(--inset);
}
.cv-img-proc--diag .cv-img-proc-pfp { animation: cv-proc-pfp-diag var(--grow) cubic-bezier(0.22, 0.61, 0.36, 1) forwards; }
.cv-img-proc--l .cv-img-proc-pfp { animation: cv-proc-pfp-l var(--grow) cubic-bezier(0.22, 0.61, 0.36, 1) forwards; }
@keyframes cv-proc-pfp-diag {
  0% { top: var(--inset); left: var(--inset); }
  100% { top: calc(100% - var(--inset)); left: calc(100% - var(--inset)); }
}
@keyframes cv-proc-pfp-l {
  0% { top: var(--inset); left: var(--inset); }
  35% { top: calc(var(--inset) + (100% - 2 * var(--inset)) * 0.16); left: calc(var(--inset) + (100% - 2 * var(--inset)) * 0.92); }
  100% { top: calc(100% - var(--inset)); left: calc(100% - var(--inset)); }
}

/* ===========================================================
   Meeting bottom bar (ControlBar) — translated from Tailwind, exact values
   =========================================================== */
.cv-ctrlbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; justify-content: center;
  padding: 0 16px 18px; pointer-events: none;
}
.cv-ctrlbar__inner {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-radius: 9999px; padding: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.10);
  border: 1px solid rgba(0, 0, 0, 0.10);
}
.cv-ptt {
  width: 56px; height: 56px; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: 1px solid #ea580c; background: #ea580c; color: #fff;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.30);
  transition: all 0.15s ease; touch-action: none; user-select: none;
}
.cv-ptt:hover { background: #f97316; }
.cv-ptt:active { transform: scale(0.95); }
.cv-ptt.is-on {
  background: #ff3b30; border-color: #ff3b30; transform: scale(1.1);
  box-shadow: 0 0 0 10px rgba(255, 59, 48, 0.18), 0 4px 14px rgba(234, 88, 12, 0.30);
}
.cv-pill {
  width: 48px; height: 48px; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none; background: transparent; color: #1a1a2e;
  transition: all 0.15s ease;
}
.cv-pill:hover { background: rgba(0, 0, 0, 0.05); }
.cv-pill:active { transform: scale(0.95); }
.cv-pill.is-active { color: #ea580c; background: rgba(234, 88, 12, 0.10); }
.cv-pill--leave { background: #ff3b30; color: #fff; border: 1px solid #ff3b30; box-shadow: 0 2px 8px rgba(255, 59, 48, 0.25); }
.cv-pill--leave:hover { background: #ff5347; }
.cv-tutorchip { position: relative; width: 44px; height: 44px; flex-shrink: 0; }
.cv-tutorchip__glow {
  position: absolute; inset: -4px; border-radius: 9999px;
  filter: blur(12px); pointer-events: none;
  background: rgba(249, 115, 22, 0.6);
  animation: tb-idle 3.5s ease-in-out infinite;
}
.cv-tutorchip__img {
  position: relative; width: 44px; height: 44px; border-radius: 9999px;
  object-fit: cover; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
@keyframes tb-idle {
  0%, 100% { opacity: 0.55; transform: scale(1.0); }
  50%      { opacity: 0.75; transform: scale(1.03); }
}

/* ===========================================================
   Lesson prose (cv-note-prose subset from card-view.css)
   =========================================================== */
.cv-note-prose {
  font-family: 'Caveat', cursive; color: #e6ded0;
  font-size: clamp(1.35rem, 1.15rem + 0.45vw, 1.6rem); line-height: 1.4;
}
.cv-note-prose p { margin: 0.3rem 0; }
.cv-note-prose p:first-child { margin-top: 0; }
.cv-note-prose p:last-child { margin-bottom: 0; }
.cv-note-prose b, .cv-note-prose strong { color: #fff; }
/* Equation written in the handwriting font (Caveat), circled by BV2_Circle */
.cv-eq { font-family: 'Caveat', cursive; font-weight: 700; font-size: 1.2em; color: #fff; white-space: nowrap; }

/* The frontend arrow list (cv-arrow-list) — orange → bullets */
.cv-note-prose .cv-arrow-list { list-style: none !important; padding-left: 1.4rem; margin: 0.5rem 0 0; }
.cv-note-prose .cv-arrow-list li { position: relative; margin: 0.14rem 0; padding-left: 0.2rem; list-style: none !important; }
.cv-note-prose .cv-arrow-list li::marker { content: none !important; }
.cv-note-prose .cv-arrow-list li::before {
  content: ''; position: absolute; left: -1.5rem; top: 0.5em;
  width: 1.1em; height: 0.78em; background-color: #ea580c;
  -webkit-mask: url("assets/icon-arrow.png") center / contain no-repeat;
          mask: url("assets/icon-arrow.png") center / contain no-repeat;
}

/* Hero greeting in ALL CAPS (Bristol stays) */
.bv2-hero__title { text-transform: uppercase; }

/* Hand-drawn arrow (frontend icon-arrow.png) as a mask, so it takes the
   element's text colour. Used in place of every "->" on the page. */
.bv2-arrow {
  display: inline-block; width: 1.05em; height: 0.72em; margin-left: 0.4em;
  vertical-align: -0.04em; background-color: currentColor;
  -webkit-mask: url("assets/icon-arrow.png") center / contain no-repeat;
          mask: url("assets/icon-arrow.png") center / contain no-repeat;
}

/* small mono hint next to a note title (e.g. "drag to rotate") */
.cv-note-hint { font-family: var(--mono); font-size: 0.5em; font-weight: 500; color: rgba(255, 255, 255, 0.42); letter-spacing: 0.04em; margin-left: 10px; vertical-align: middle; white-space: nowrap; }

/* Taller Desmos */
.cv-desmos-tall { height: 520px; }

/* Code run output image (matplotlib figure) — transparent png on the dark output panel */
.cvcode__out-img { max-width: 100%; border-radius: 8px; margin-top: 4px; background: transparent; display: block; }

/* Interactive iframe (CardInteractive) — transparent so the black board shows through */
.cv-interactive-frame {
  width: 100%; height: 400px; border: none; border-radius: 12px; margin-top: 0.5em;
  background: transparent; display: block;
}
@media (max-width: 640px) { .cv-interactive-frame { height: 460px; } }

/* 3D molecule card (CardChemistry — transparent, sits on the paper) */
.cv-chem-note { }
.cv-chem-wrap { position: relative; margin-top: 0.5em; height: 360px; }
.cv-chem-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: none; background: transparent; }
.cv-ghost-chem { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.cv-ghost-chem svg { width: 200px; height: 200px; animation: cv-chem-bob 3.2s ease-in-out infinite; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.05)); }
.cv-ghost-chem svg path, .cv-ghost-chem svg circle {
  stroke: rgba(0, 0, 0, 0.22); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; fill: none;
}
.cv-ghost-chem svg .cv-chem-atom { fill: rgba(0, 0, 0, 0.12); animation: cv-chem-pulse 1.6s ease-in-out infinite; }
@keyframes cv-chem-bob { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-6px) rotate(8deg); } }
@keyframes cv-chem-pulse { 0%, 100% { opacity: 0.30; } 50% { opacity: 0.95; } }

/* ---- Hand-drawn circle overlay (CircleEm / CircleOverlay port) ---- */
.bv2-circ { position: relative; display: inline-block; }
.bv2-circ__svg { position: absolute; overflow: visible; pointer-events: none; z-index: 2; }
.bv2-circ__svg path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.bv2-circ__svg.is-drawn path {
  animation: bv2-circ-draw 0.5s cubic-bezier(0.6, 0.1, 0.3, 1) var(--bv2-circ-delay, 0ms) forwards;
}
@keyframes bv2-circ-draw { to { stroke-dashoffset: 0; } }

@media (max-width: 760px) {
  .bv2-board__canvas { padding: 22px 16px 110px; gap: 20px; }
}
