/* ───────────────────────────────────────────────────────────
   MeontayLinks — scanner.css
   Styles for the unified camera-scan component (public/js/scanner.js).
   Lives outside body.lc-page so it renders the same way on the
   /scan and /cards pages (gold + navy) AND on the dashboard /
   portfolio (theme.css with --accent-* purple/blue). Tokenless —
   uses a self-contained neutral palette that reads well on both.
   ─────────────────────────────────────────────────────────── */

.ml-scanner {
  --ml-gold: #F5A623;
  --ml-gold-deep: #D4892A;
  --ml-navy: #0D1B2A;
  --ml-fg: #fff5e6;
  --ml-fg-muted: #c7b397;
  --ml-fg-dim: #8a7762;
  --ml-border: rgba(245, 166, 35, 0.32);
  --ml-border-soft: rgba(245, 166, 35, 0.18);
  position: relative;
  max-width: 720px;
  margin: 16px auto;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--ml-border-soft);
  display: flex;
  flex-direction: column;
  color: var(--ml-fg);
  font-family: 'Syne', 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

.ml-scanner-video {
  width: 100%;
  height: auto;
  display: block;
  background: #000;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.ml-scanner[data-facing="user"] .ml-scanner-video {
  transform: scaleX(-1); /* mirror the selfie preview */
}

.ml-frame-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.ml-corner {
  position: absolute;
  width: 38px;
  height: 38px;
  border-color: var(--ml-gold);
  border-style: solid;
  box-shadow: 0 0 12px rgba(245, 166, 35, 0.45);
}
.ml-corner.tl { top: 12%; left: 12%; border-width: 3px 0 0 3px; border-radius: 4px 0 0 0; }
.ml-corner.tr { top: 12%; right: 12%; border-width: 3px 3px 0 0; border-radius: 0 4px 0 0; }
.ml-corner.bl { bottom: 22%; left: 12%; border-width: 0 0 3px 3px; border-radius: 0 0 0 4px; }
.ml-corner.br { bottom: 22%; right: 12%; border-width: 0 3px 3px 0; border-radius: 0 0 4px 0; }

.ml-scanner-state-chip {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  font-family: 'Syne', sans-serif;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-radius: 999px;
  background: rgba(13, 27, 42, 0.85);
  color: var(--ml-fg);
  border: 1px solid var(--ml-border-soft);
  z-index: 5;
  pointer-events: none;
  animation: ml-pulse 2s ease-in-out infinite;
  white-space: nowrap;
}
.ml-scanner-state-chip[data-scan-frame-state="detected"] {
  background: rgba(52, 211, 153, 0.20);
  border-color: rgba(52, 211, 153, 0.55);
  color: #34d399;
  animation: none;
}
.ml-scanner-state-chip[data-scan-frame-state="lowlight"] {
  background: rgba(248, 113, 113, 0.20);
  border-color: rgba(248, 113, 113, 0.55);
  color: #f87171;
}
@keyframes ml-pulse {
  0%, 100% { opacity: 0.85; }
  50%      { opacity: 1; }
}

.ml-scanner-toolbar {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  padding: 12px;
  background: rgba(13, 27, 42, 0.65);
  border-top: 1px solid var(--ml-border-soft);
  flex-wrap: wrap;
}
.ml-scanner-toolbar button {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--ml-border-soft);
  color: var(--ml-fg);
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.18s, transform 0.18s, border-color 0.18s;
}
.ml-scanner-toolbar button:hover {
  background: rgba(245, 166, 35, 0.12);
  border-color: var(--ml-gold);
}
.ml-scanner-toolbar button:active {
  transform: translateY(1px);
}
.ml-scanner-capture {
  background: var(--ml-gold) !important;
  color: var(--ml-navy) !important;
  border-color: var(--ml-gold) !important;
  min-width: 140px;
}
.ml-scanner-capture:hover {
  background: var(--ml-gold-deep) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245, 166, 35, 0.32);
}
.ml-scanner-enable {
  background: var(--ml-gold) !important;
  color: var(--ml-navy) !important;
  border-color: var(--ml-gold) !important;
  min-width: 200px;
}
.ml-scanner-enable:hover {
  background: var(--ml-gold-deep) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245, 166, 35, 0.32);
}
.ml-scanner-enable[hidden] {
  display: none;
}
.ml-scanner-torch[data-unsupported="true"],
.ml-scanner-torch[hidden] {
  display: none;
}
.ml-scanner-torch.is-on {
  background: rgba(245, 166, 35, 0.30) !important;
  border-color: var(--ml-gold) !important;
  color: var(--ml-gold) !important;
}

.ml-scanner-drop {
  display: block;
  margin: 12px;
  padding: 24px;
  border: 2px dashed var(--ml-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.ml-scanner-drop:hover {
  background: rgba(245, 166, 35, 0.06);
  border-color: var(--ml-gold);
}
.ml-scanner-drop.is-over {
  background: rgba(245, 166, 35, 0.12);
  border-color: var(--ml-gold);
}
.ml-scanner-drop-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--ml-fg);
  margin-bottom: 4px;
}
.ml-scanner-drop-sub {
  font-size: 12px;
  color: var(--ml-fg-dim);
}
.ml-scanner-drop-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.ml-scanner-progress {
  height: 4px;
  margin: 0 12px 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.ml-scanner-progress-bar {
  width: 0%;
  height: 100%;
  background: var(--ml-gold);
  border-radius: 999px;
  transition: width 0.6s ease;
}

.ml-scanner-msg {
  text-align: center;
  font-size: 13px;
  color: var(--ml-fg-muted);
  padding: 6px 12px 12px;
  margin: 0;
}
.ml-scanner-msg-err {
  color: #f87171;
}

.ml-scanner-permission-err {
  margin: 12px;
  padding: 14px 16px;
  background: rgba(248, 113, 113, 0.10);
  border: 1px solid rgba(248, 113, 113, 0.30);
  border-radius: 12px;
  color: var(--ml-fg);
}
.ml-scanner-permission-head {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  color: #fca5a5;
}
.ml-scanner-permission-body {
  font-size: 13px;
  color: var(--ml-fg-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}
.ml-scanner-permission-cta {
  display: inline-block;
  background: var(--ml-gold);
  color: var(--ml-navy);
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s;
}
.ml-scanner-permission-cta:hover {
  background: var(--ml-gold-deep);
  transform: translateY(-1px);
}

/* Off-screen helper canvases — never visible to users. */
.ml-scanner-capture-canvas,
.ml-scanner-frame-canvas {
  display: none;
}

/* Dashboard variant — narrower reset for the inline tile. */
.ml-scanner-dash {
  max-width: 440px;
  margin: 0 0 20px;
}
.ml-scanner-dash .ml-scanner-video {
  aspect-ratio: 16 / 9;
}
.ml-scanner-dash .ml-corner.tl,
.ml-scanner-dash .ml-corner.tr { top: 18%; }
.ml-scanner-dash .ml-corner.bl,
.ml-scanner-dash .ml-corner.br { bottom: 28%; }

/* Inline button row used on the portfolio "Scan to add" tile.
   Visually identical to the .scan-btn used by cards.css. */
.ml-scan-launch {
  display: inline-block;
  cursor: pointer;
  font-family: 'Syne', sans-serif;
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  border: 1px solid var(--ml-border);
  transition: background 0.18s, transform 0.18s;
  text-decoration: none;
}
.ml-scan-launch:hover {
  background: rgba(245, 166, 35, 0.08);
  transform: translateY(-1px);
}
.ml-scan-launch.is-open {
  background: var(--ml-gold);
  color: var(--ml-navy);
  border-color: var(--ml-gold);
}
