/* ============================================================
   Captura imersiva (voz + foto + texto), componente compartilhado
   Usado por index.html (FAB) e modo-aula-mobile.html (Modo Aula).
   Depende só de css/tokens.css (tokens lkt, base, indigo, pastels).
   ============================================================ */

/* FAB global (index) */
.cap-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 120;
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 52px; padding: 14px 20px;
  border-radius: var(--border-radius-pill);
  background: var(--color-accent-pure); color: #fff;
  font-weight: 800; font-size: 15px; border: 0; cursor: pointer;
  box-shadow: var(--theme-modal-shadow);
  transition: transform var(--motion-dur-fast) var(--motion-ease), box-shadow var(--motion-dur-fast) var(--motion-ease), background var(--motion-dur-fast) var(--motion-ease);
}
.cap-fab:hover { transform: translateY(-2px); background: var(--color-accent-dark); }
.cap-fab:active { transform: scale(.97); }
.cap-fab__ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* O FAB é das HOMES, e só delas (decisão do Gustavo, 26/08/2026).
   Ele é filho direto do <body>, fora de qualquer <main class="view">, então até
   aqui aparecia em cima de TODAS as telas da plataforma — inclusive onde a
   própria tela já oferece um jeito melhor de registrar (o compositor do rail da
   Avaliação, o botão "Registro" de cada card de atribuição, o gravador do Modo
   Aula). Registrar de qualquer lugar era a promessa; o efeito era um botão
   repetindo, sobreposto, uma ação que a tela embaixo já fazia melhor.
   A regra é por INVERSÃO, e o markup fica: escondê-lo preserva js/capture.js e o
   drawer global, que o botão do card continua abrindo. Remover o #cap-fab
   deixaria aquele arquivo inteiro sem alvo.
   `.view--inicio` é o que o js/app.js usa para eleger quem serve de Início
   (servirComoInicio) — na plataforma são o dashboard do professor e o quadro do
   gestor. Citar as views pelo id amarraria esta folha à camada do outro produto;
   a classe não amarra. */
body:not(:has(.view--inicio.is-current)) .cap-fab { display: none; }

/* controles do detalhamento */
.cap-label { display: block; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--theme-text-muted); }
.cap-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.cap-field em { font-style: normal; text-transform: none; letter-spacing: 0; color: var(--color-surface-pure); font-weight: 700; }
.cap-select {
  font: inherit; font-weight: 700; color: var(--theme-text-heading); min-height: 44px;
  padding: 11px 14px; background: var(--base-50);
  border: 1.5px solid var(--theme-border-subtle); border-radius: var(--border-radius-sm); outline: none;
}
.cap-select:focus { border-color: var(--color-accent-pure); box-shadow: var(--theme-input-focus-ring); }
.cap-select:disabled { opacity: .9; cursor: default; background: var(--theme-surface-muted); color: var(--theme-text-muted); }
.cap-detail__grid { display: grid; grid-template-columns: 1fr; gap: 12px; width: 100%; }
.cap-field--note { width: 100%; }
.cap-aset__hint { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; color: var(--color-accent-dark); }
.cap-aset__hint[hidden] { display: none; }
.cap-aset__badge { font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 2px 6px; border-radius: var(--border-radius-pill); background: var(--color-accent-pure); color: #fff; }
.cap-note {
  width: 100%; font: inherit; font-size: 13.5px; font-weight: 400; color: var(--theme-text-heading);
  padding: 12px 14px; background: var(--base-50); line-height: 1.55;
  border: 1.5px solid var(--theme-border-subtle); border-radius: var(--border-radius-sm);
  outline: none; resize: vertical; min-height: clamp(72px, 16vh, 150px);
  transition: border-color var(--motion-dur-fast), box-shadow var(--motion-dur-fast);
}
.cap-note:focus { border-color: var(--color-accent-pure); box-shadow: var(--theme-input-focus-ring); }
.cap-note::placeholder { font-size: 13px; color: var(--color-surface-soft); }

/* ---- palco imersivo (mobile: tela toda; desktop: modal maior) ---- */
.cap-stage { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; }
.cap-stage[hidden] { display: none; }
.cap-stage__scrim { position: absolute; inset: 0; background: var(--theme-modal-overlay-bg-strong); backdrop-filter: blur(10px); }
.cap-stage__panel {
  position: relative; width: 100%; height: 100%;
  display: flex; flex-direction: column; overflow: hidden; color: #fff;
  background:
    radial-gradient(125% 76% at 50% 122%, var(--color-accent-deep) 0%, rgba(37,8,53,0) 58%),
    linear-gradient(180deg, var(--color-surface-deepest) 0%, var(--color-surface-deep) 64%, var(--color-surface-deepest) 100%);
}
.cap-stage__panel::after { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: var(--grain); opacity: .5; mix-blend-mode: soft-light; }
@media (min-width: 769px) {
  .cap-stage { padding: 32px; }
  .cap-stage__panel { width: min(900px, 94vw); height: min(620px, 88vh); border-radius: var(--border-radius-lg); box-shadow: var(--theme-modal-shadow); }
  .cap-stage__top { padding: 22px 30px 4px; }
  .cap-stage__prompt { padding: 0 48px; }
  .cap-stage__eyebrow { font-size: 13px; }
  .cap-stage__q { font-size: clamp(30px, 3.2vw, 40px); max-width: 26ch; }
  .cap-stage__foot { padding: 20px 30px 34px; gap: 14px; }
  .cap-stage__controls { gap: 28px; }
  .cap-mic { width: 92px; height: 92px; }
  .cap-mic__dot { width: 32px; height: 32px; }
  .cap-cam, .cap-stage__save { width: 60px; height: 60px; }
  .cap-detail { padding: 16px 34px 30px; gap: 16px; }
  .cap-detail__grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .cap-detail__title { font-size: 20px; }
}
.cap-stage__top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(18px, env(safe-area-inset-top)) 18px 4px; }
.cap-stage__close, .cap-stage__detail {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border-radius: var(--border-radius-pill); background: rgba(255,255,255,.12); color: #fff;
  font-weight: 700; font-size: 13px; border: 0; cursor: pointer; backdrop-filter: blur(6px);
  transition: background var(--motion-dur-fast) var(--motion-ease), transform var(--motion-dur-fast) var(--motion-ease);
}
.cap-stage__close { width: 40px; padding: 0; justify-content: center; }
.cap-stage__close:hover, .cap-stage__detail:hover { background: rgba(255,255,255,.2); }
.cap-stage__close:active, .cap-stage__detail:active { transform: scale(.96); }
.cap-stage__close svg, .cap-stage__detail svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cap-stage__detail[aria-expanded="true"] { background: rgba(255,255,255,.22); }
.cap-stage__title { font-size: 13px; font-weight: 700; color: rgba(255,255,255,.72); }

.cap-wave { position: relative; z-index: 1; flex: 1; min-height: 0; }
.cap-wave__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.cap-stage__prompt { position: relative; z-index: 2; padding: 0 28px; }
.cap-stage__eyebrow { font-family: var(--theme-font-family-heading); display: block; font-size: 12.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: rgba(255,255,255,.55); margin-bottom: 8px; }
.cap-stage__q { font-family: var(--theme-font-family-heading); font-weight: 800; font-size: clamp(25px, 6vw, 33px); line-height: 1.12; letter-spacing: -.01em; color: #fff; max-width: 20ch; }

.cap-stage__foot { position: relative; z-index: 2; display: grid; justify-items: center; gap: 12px; padding: 22px 24px max(28px, env(safe-area-inset-bottom)); }
.cap-stage__controls { display: flex; align-items: center; justify-content: center; gap: 24px; }
.cap-cam { width: 56px; height: 56px; border-radius: var(--border-radius-circle); display: grid; place-items: center; background: rgba(255,255,255,.14); color: #fff; border: 0; cursor: pointer; backdrop-filter: blur(6px); transition: transform var(--motion-dur-fast) var(--motion-ease), background var(--motion-dur-fast) var(--motion-ease); }
.cap-cam:hover { background: rgba(255,255,255,.22); transform: translateY(-1px); }
.cap-cam:active { transform: scale(.95); }
.cap-cam svg { width: 23px; height: 23px; }
.cap-mic { position: relative; width: 84px; height: 84px; display: grid; place-items: center; border-radius: var(--border-radius-circle); background: rgba(255,255,255,.14); border: 0; cursor: pointer; backdrop-filter: blur(6px); transition: transform var(--motion-dur-fast) var(--motion-ease); }
.cap-mic:hover { transform: translateY(-1px); }
.cap-mic:active { transform: scale(.96); }
.cap-mic__ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.cap-mic__ring circle { fill: none; stroke-width: 3; stroke-linecap: round; }
.cap-mic__ring-bg { stroke: rgba(255,255,255,.2); }
.cap-mic__ring-fg { stroke: rgba(255,255,255,.85); stroke-dasharray: 289; stroke-dashoffset: 289; transition: stroke-dashoffset .25s linear; }
.cap-mic__dot { width: 30px; height: 30px; border-radius: var(--border-radius-circle); background: #fff; transition: width .3s var(--motion-ease), height .3s var(--motion-ease), border-radius .3s var(--motion-ease), background .3s var(--motion-ease); }
.cap-mic.is-rec .cap-mic__dot { width: 24px; height: 24px; border-radius: var(--border-radius-nano); background: var(--color-error-pure); }
.cap-mic__time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13.5px; color: rgba(255,255,255,.7); }
.cap-stage__save { width: 56px; height: 56px; border-radius: var(--border-radius-circle); display: grid; place-items: center; background: #fff; color: var(--theme-text-heading); border: 0; cursor: pointer; box-shadow: var(--lkt-shadow-level4); transition: transform var(--motion-dur-fast) var(--motion-ease), opacity var(--motion-dur-fast) var(--motion-ease); }
.cap-stage__save:hover { transform: translateY(-2px); }
.cap-stage__save:active { transform: scale(.95); }
.cap-stage__save[data-empty="true"] { opacity: .3; pointer-events: none; }
.cap-stage__save svg { width: 22px; height: 22px; }

.cap-thumb { position: relative; width: 64px; height: 64px; border-radius: var(--border-radius-sm); overflow: hidden; box-shadow: var(--lkt-shadow-level4); }
.cap-thumb[hidden] { display: none; }
.cap-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cap-thumb__del { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: var(--border-radius-circle); display: grid; place-items: center; background: rgba(15,1,26,.65); color: #fff; border: 0; cursor: pointer; }
.cap-thumb__del svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

/* menu de detalhamento (sheet) */
.cap-detail {
  position: absolute; z-index: 5; left: 0; right: 0; bottom: 0;
  background: #fff; color: var(--theme-text-heading);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  box-shadow: var(--theme-modal-shadow);
  padding: 12px 20px max(20px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 13px;
  transform: translateY(101%); pointer-events: none;
  transition: transform .32s var(--motion-ease); max-height: 84%; overflow: auto;
}
.cap-detail.is-open { transform: translateY(0); pointer-events: auto; }
.cap-detail__handle { width: 40px; height: 4px; border-radius: var(--border-radius-pill); background: var(--color-surface-light); align-self: center; margin-bottom: 2px; }
.cap-detail__title { font-family: var(--theme-font-family-heading); font-weight: 800; font-size: 18px; }
.cap-detail__foot { width: 100%; display: flex; justify-content: flex-end; }
.cap-detail__close-btn { min-height: 40px; padding: 10px 18px; border-radius: var(--border-radius-sm); border: 1.5px solid var(--theme-border-subtle); background: #fff; color: var(--theme-text-heading); font-weight: 700; font-size: 14px; cursor: pointer; transition: border-color var(--motion-dur-fast), transform var(--motion-dur-fast) var(--motion-ease); }
.cap-detail__close-btn:hover { border-color: var(--color-surface-soft); transform: translateY(-1px); }

@media (max-width: 768px) {
  .cap-fab { right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); padding: 0; width: 56px; height: 56px; justify-content: center; }
  .cap-fab__lbl { display: none; }
}

/* ---- modo docado: o palco preenche o painel do drawer de registros ----
   Sem scrim próprio (o do chat já escurece o resto); o painel imersivo ocupa
   exatamente o footprint do drawer à direita, morfando o chat no gravador. */
.cap-stage.cap-stage--dock { inset: 0 0 0 auto; width: min(420px, 92vw); padding: 0; place-items: stretch; }
.cap-stage--dock .cap-stage__scrim { display: none; }
.cap-stage--dock .cap-stage__panel { width: 100%; height: 100%; max-width: none; border-radius: 0; box-shadow: var(--theme-modal-shadow); }
.cap-stage--dock .cap-detail__grid { grid-template-columns: 1fr; }
@media (prefers-reduced-motion: reduce) {
  .cap-mic__dot, .cap-detail, .cap-mic__ring-fg { transition: none; }
}
