/* ============================================================
   Edge Enhancement Layer — Masters 2026 Intelligence
   Injected alongside existing SPA. Does NOT replace anything.
   Uses the existing Masters theme tokens.
   ============================================================ */

/* ---------- Intelligence Briefing Strip ---------- */

.edge-briefing-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 14px 16px;
  margin: 0 0 6px;
  border-radius: 12px;
  border: 1px solid hsl(160 18% 14%);
  background: linear-gradient(135deg, hsla(160, 20%, 8%, 0.85), hsla(160, 25%, 6%, 0.9));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: 'Inter', system-ui, sans-serif;
  opacity: 0;
  transform: translateY(8px);
  animation: edge-fade-in 0.5s ease 0.3s forwards;
}

.edge-briefing-strip .ebs-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: hsla(160, 18%, 12%, 0.5);
  border: 1px solid hsla(160, 18%, 18%, 0.4);
  transition: border-color 0.2s ease, background 0.2s ease;
  cursor: default;
  min-width: 0;
}

.edge-briefing-strip .ebs-card:hover {
  border-color: hsla(51, 100%, 50%, 0.25);
  background: hsla(160, 18%, 14%, 0.6);
}

.edge-briefing-strip .ebs-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: hsla(40, 15%, 90%, 0.45);
  white-space: nowrap;
}

.edge-briefing-strip .ebs-player {
  font-size: 16px;
  font-weight: 700;
  color: hsl(40, 15%, 92%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.edge-briefing-strip .ebs-detail {
  font-size: 14px;
  color: hsla(40, 15%, 90%, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.edge-briefing-strip .ebs-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 600;
}

.ebs-value.gold { color: hsl(51, 100%, 55%); }
.ebs-value.green { color: hsl(161, 80%, 45%); }
.ebs-value.red { color: hsl(350, 73%, 58%); }
.ebs-value.cyan { color: hsl(187, 85%, 55%); }

@media (max-width: 900px) {
  .edge-briefing-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px 12px;
  }
}
@media (max-width: 500px) {
  .edge-briefing-strip {
    grid-template-columns: 1fr;
  }
  .edge-briefing-strip .ebs-label { font-size: 13px !important; }
  .edge-briefing-strip .ebs-player { font-size: 15px !important; }
  .edge-briefing-strip .ebs-detail { font-size: 13px !important; }
  .edge-briefing-strip .ebs-value { font-size: 13px !important; }
  .edge-conviction-tag { font-size: 13px !important; }
  .edge-mini-metric { font-size: 13px !important; }
  .edge-mini-metric .mm-label { font-size: 12px !important; }
  .edge-metric-explainer { font-size: 13px !important; }
  .edge-focus-toggle { font-size: 13px !important; }
  .edge-section-intro { font-size: 15px !important; }
}

/* ---------- Focus Mode Toggle ---------- */

.edge-focus-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid hsla(160, 18%, 18%, 0.5);
  background: hsla(160, 18%, 10%, 0.6);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: hsla(40, 15%, 90%, 0.6);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
}

.edge-focus-toggle:hover {
  border-color: hsla(51, 100%, 50%, 0.3);
  color: hsla(40, 15%, 90%, 0.85);
}

.edge-focus-toggle.active {
  border-color: hsl(51, 100%, 50%);
  background: hsla(51, 100%, 50%, 0.1);
  color: hsl(51, 100%, 60%);
}

.edge-focus-toggle .toggle-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: hsla(40, 15%, 90%, 0.3);
  transition: background 0.2s ease;
}

.edge-focus-toggle.active .toggle-dot {
  background: hsl(51, 100%, 50%);
  box-shadow: 0 0 6px hsla(51, 100%, 50%, 0.5);
}

/* ---------- Conviction Tags ---------- */

.edge-conviction-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
  line-height: 1.6;
  border: 1px solid transparent;
}

.edge-conviction-tag.true-contender {
  background: hsla(51, 100%, 50%, 0.1);
  border-color: hsla(51, 100%, 50%, 0.2);
  color: hsl(51, 100%, 60%);
}

.edge-conviction-tag.placement-machine {
  background: hsla(161, 80%, 30%, 0.12);
  border-color: hsla(161, 80%, 35%, 0.2);
  color: hsl(161, 80%, 50%);
}

.edge-conviction-tag.fragile-favorite {
  background: hsla(350, 73%, 55%, 0.1);
  border-color: hsla(350, 73%, 55%, 0.2);
  color: hsl(350, 73%, 62%);
}

.edge-conviction-tag.mispriced-value {
  background: hsla(187, 85%, 55%, 0.1);
  border-color: hsla(187, 85%, 55%, 0.2);
  color: hsl(187, 85%, 60%);
}

.edge-conviction-tag.false-signal {
  background: hsla(40, 10%, 50%, 0.1);
  border-color: hsla(40, 10%, 50%, 0.15);
  color: hsl(40, 10%, 55%);
}

.edge-conviction-tag.stable-grinder {
  background: hsla(161, 60%, 40%, 0.1);
  border-color: hsla(161, 60%, 40%, 0.2);
  color: hsl(161, 60%, 55%);
}

/* ---------- Metric Explainer Tooltips ---------- */

.edge-metric-explainer {
  display: block;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: hsla(40, 15%, 90%, 0.38);
  margin-top: 2px;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
}

/* ---------- Section Story Intros ---------- */

.edge-section-intro {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: hsla(40, 15%, 90%, 0.42);
  line-height: 1.5;
  margin-bottom: 12px;
  max-width: 680px;
  padding-left: 1px;
  opacity: 0;
  animation: edge-fade-in 0.4s ease 0.5s forwards;
}

/* ---------- Enhanced Metrics Row (injected into table) ---------- */

.edge-metrics-row {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.edge-mini-metric {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  background: hsla(160, 18%, 12%, 0.4);
  border: 1px solid hsla(160, 18%, 18%, 0.25);
  color: hsla(40, 15%, 90%, 0.65);
  white-space: nowrap;
}

.edge-mini-metric .mm-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: hsla(40, 15%, 90%, 0.35);
}

.edge-mini-metric.highlight {
  border-color: hsla(51, 100%, 50%, 0.2);
  background: hsla(51, 100%, 50%, 0.06);
}

/* ---------- Focus Mode: dim non-essential columns ---------- */

body.edge-focus-mode main table th.edge-dim,
body.edge-focus-mode main table td.edge-dim {
  opacity: 0.25;
  transition: opacity 0.3s ease;
}

body.edge-focus-mode main table th.edge-dim:hover,
body.edge-focus-mode main table td.edge-dim:hover {
  opacity: 0.8;
}

/* ---------- Shared Animations ---------- */

@keyframes edge-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes edge-pulse-subtle {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ---------- Light mode support ---------- */

:root:not(.dark) .edge-briefing-strip,
[data-theme="light"] .edge-briefing-strip {
  background: linear-gradient(135deg, hsla(40, 20%, 95%, 0.9), hsla(40, 15%, 93%, 0.95));
  border-color: hsl(40, 12% ,85%);
}

:root:not(.dark) .edge-briefing-strip .ebs-card,
[data-theme="light"] .edge-briefing-strip .ebs-card {
  background: hsla(40, 15%, 97%, 0.7);
  border-color: hsla(40, 12%, 85%, 0.6);
}

:root:not(.dark) .edge-briefing-strip .ebs-label,
[data-theme="light"] .edge-briefing-strip .ebs-label {
  color: hsla(156, 30%, 8%, 0.45);
}

:root:not(.dark) .edge-briefing-strip .ebs-player,
[data-theme="light"] .edge-briefing-strip .ebs-player {
  color: hsl(156, 30%, 10%);
}

:root:not(.dark) .edge-briefing-strip .ebs-detail,
[data-theme="light"] .edge-briefing-strip .ebs-detail {
  color: hsla(156, 30%, 8%, 0.5);
}

:root:not(.dark) .edge-section-intro,
[data-theme="light"] .edge-section-intro {
  color: hsla(156, 30%, 8%, 0.4);
}

:root:not(.dark) .edge-metric-explainer,
[data-theme="light"] .edge-metric-explainer {
  color: hsla(156, 30%, 8%, 0.35);
}

:root:not(.dark) .edge-focus-toggle,
[data-theme="light"] .edge-focus-toggle {
  background: hsla(40, 15%, 92%, 0.7);
  border-color: hsl(40, 12%, 82%);
  color: hsla(156, 30%, 8%, 0.55);
}

:root:not(.dark) .edge-conviction-tag.true-contender {
  background: hsla(51, 100%, 50%, 0.08);
  color: hsl(42, 80%, 38%);
}

:root:not(.dark) .edge-conviction-tag.placement-machine {
  background: hsla(161, 80%, 30%, 0.08);
  color: hsl(161, 80%, 28%);
}

:root:not(.dark) .edge-conviction-tag.fragile-favorite {
  background: hsla(350, 73%, 55%, 0.08);
  color: hsl(350, 73%, 42%);
}

:root:not(.dark) .edge-conviction-tag.mispriced-value {
  background: hsla(187, 85%, 55%, 0.08);
  color: hsl(187, 85%, 35%);
}

:root:not(.dark) .edge-mini-metric {
  background: hsla(40, 15%, 92%, 0.5);
  border-color: hsla(40, 12%, 82%, 0.4);
  color: hsla(156, 30%, 8%, 0.6);
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .edge-briefing-strip,
  .edge-section-intro {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
