/* ============================================================
   Feed-the-Intelligence widget — canonical styles.
   Class prefix: .fi-
   No collisions with .ab- .ai- .cs- .hf- .hm- .li- .no- .pa- .pf-
   .pk- .ra- .rs- .tt- .wl- (verified 2026-05-13).

   Visual spec — Brief 2, intelligence-loop:
   - 1px dashed cyan border rgba(0,200,200,0.45), rounded 12px
   - Navy-tinted fill rgba(0,200,200,0.05)
   - 96px tall desktop, 80px mobile
   - JetBrains-Mono eyebrow + Inter 14px prompt
   - Hover: fill → rgba(0,200,200,0.10), solid border, 16px cyan glow
   ============================================================ */

.fi-root {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 96px;
  padding: 16px 24px;
  border: 1px dashed rgba(0, 200, 200, 0.45);
  border-radius: 12px;
  background: rgba(0, 200, 200, 0.05);
  color: #f0f4f8;
  cursor: pointer;
  user-select: none;
  text-align: center;
  box-sizing: border-box;
  transition:
    border-color 180ms ease,
    border-style 180ms ease,
    background-color 180ms ease,
    box-shadow 220ms ease,
    transform 180ms ease;
  -webkit-tap-highlight-color: transparent;
}

.fi-root:focus { outline: none; }
.fi-root:focus-visible {
  box-shadow: 0 0 0 2px rgba(0, 200, 200, 0.55);
  border-color: rgba(0, 200, 200, 0.85);
}

/* Hover / drag-over — page version (email static cell relies on this via :hover too where supported). */
.fi-root:hover,
.fi-root[data-fi-state="dragover"] {
  background: rgba(0, 200, 200, 0.10);
  border-color: rgba(0, 200, 200, 0.85);
  border-style: solid;
  box-shadow: 0 0 16px rgba(0, 200, 200, 0.35);
}

.fi-root[data-fi-state="dragover"] { transform: translateY(-1px); }

/* Stages — exactly one is visible at a time. */
.fi-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.fi-stage[hidden] { display: none; }

/* Eyebrow — JetBrains Mono. */
.fi-eyebrow {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(0, 200, 200, 0.85);
}
.fi-eyebrow--error { color: rgba(255, 168, 88, 0.92); }

/* Prompt row — Inter 14px. */
.fi-prompt {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: #cdd6e4;
  min-height: 1.4em;
}

.fi-prompt-static { font-weight: 500; color: #f0f4f8; }
.fi-prompt-mobile { display: none; font-weight: 500; color: #f0f4f8; }

/* Upload glyph — Material-style file_upload (arrow rising off a baseline).
   Small delight: on hover / drag-over the arrow lifts 2px while the
   baseline stays put, signalling "lift your file up here". */
.fi-icon {
  flex: 0 0 auto;
  color: rgba(0, 200, 200, 0.9);
  transform: translateY(0);
}
.fi-icon-arrow {
  transition: transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
  transform-origin: center;
}
.fi-root:hover .fi-icon-arrow,
.fi-root[data-fi-state="dragover"] .fi-icon-arrow { transform: translateY(-2px); }
.fi-root[data-fi-state="dragover"] .fi-icon { color: #00e5e5; }
.fi-icon-baseline { opacity: 0.85; }

.fi-ghost {
  display: inline-block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: rgba(205, 214, 228, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 280ms ease, transform 280ms ease;
}
.fi-ghost[data-fi-visible="1"] {
  opacity: 1;
  transform: translateY(0);
}

/* Progress bar (uploading state). */
.fi-progress {
  width: 60%;
  max-width: 280px;
  height: 4px;
  background: rgba(0, 200, 200, 0.18);
  border-radius: 2px;
  overflow: hidden;
}
.fi-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, rgba(0, 200, 200, 0.95), rgba(0, 229, 229, 1));
  transition: width 220ms ease;
}
.fi-progress-label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(205, 214, 228, 0.75);
}

/* Success — dashed border solidifies via state attribute. */
.fi-root[data-fi-state="success"] {
  border-style: solid;
  border-color: rgba(0, 200, 200, 0.85);
  background: rgba(0, 200, 200, 0.08);
}

.fi-receipt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.fi-receipt-code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: #00e5e5;
}
.fi-receipt-next {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #cdd6e4;
  max-width: 480px;
}

/* Caller-populated follow-on CTA slot. Hidden when empty so the
   success state collapses cleanly on surfaces that don't use it
   (email-static, /tools without the adviser, etc.). Integrators
   populate this with their own anchor / button markup; we just
   provide the typographic baseline. */
.fi-success-extra {
  margin-top: 6px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.fi-success-extra:empty { display: none; }
.fi-success-extra a,
.fi-success-extra button {
  color: rgba(0, 200, 200, 0.95);
  background: transparent;
  border: none;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  padding: 2px 0;
}
.fi-success-extra a:hover,
.fi-success-extra button:hover { color: #00e5e5; }

/* Error state. */
.fi-error {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #f0d4b0;
  max-width: 480px;
}
.fi-retry {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(0, 200, 200, 0.95);
  background: transparent;
  border: none;
  padding: 4px 0;
  cursor: pointer;
}
.fi-retry:hover { color: #00e5e5; }

/* Mobile — 80px tall, swap desktop/mobile prompt copy. */
@media (max-width: 600px) {
  .fi-root { height: 80px; padding: 12px 16px; }
  .fi-prompt-static { display: none; }
  .fi-prompt-mobile { display: inline; }
  .fi-ghost { display: none; }
  .fi-eyebrow { font-size: 10px; }
  .fi-prompt { font-size: 13px; }
  .fi-receipt-next { font-size: 12px; }
}

/* Reduced motion. */
@media (prefers-reduced-motion: reduce) {
  .fi-root,
  .fi-ghost,
  .fi-progress-fill { transition: none; }
}

/* ============================================================
   Brief 70T (2026-05-21) — anon-mode gate. Surfaces that
   explicitly set body[data-auth-mode="anon"] hide the upload
   surface entirely; the enclosing surface is expected to
   render its own "Sign in to upload" CTA in place of the
   widget (see /tools .b70-anon-cta pattern). /for-capital
   does NOT set this attribute, so the widget continues to
   render normally for anon capital readers — uploads there
   are the canonical anon-collection path, not a private
   feature gated on sign-in. The CSS guard is opt-in by
   surface to avoid breaking the for-capital anon-upload flow.
   ============================================================ */
body[data-auth-mode="anon"] .fi-root { display: none !important; }
