/* EGESS live demo. Self-contained so it works on research.html, the home page and egess-lab.html. */
.egess {
  --e-line: rgba(190, 215, 222, 0.11); --e-text: #e9f0f2; --e-dim: rgba(233, 240, 242, 0.56); --e-accent: #7df0b4;
  color: var(--e-text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; text-align: left;
}
.egess * { box-sizing: border-box; }

/* the full demo is one instrument: swarm on the left, readout on the right, controls underneath */
.egess[data-egess="full"] {
  border-radius: 26px; overflow: hidden; border: 1px solid var(--e-line);
  background: linear-gradient(180deg, #0c1215 0%, #080c0e 100%); box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.8);
}
.egess-main { display: grid; grid-template-columns: minmax(0, 1fr) 272px; }
.egess-stage {
  position: relative; overflow: hidden; cursor: crosshair; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  background: radial-gradient(110% 100% at 28% 12%, #12202a 0%, #0a1014 48%, #070a0c 100%);
}
.egess-stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 70px 18px rgba(6, 9, 11, 0.85); }
.egess-canvas { display: block; width: 100%; height: 100%; outline: none; position: relative; z-index: 1; }
.egess-canvas:focus-visible { outline: 2px solid var(--e-accent); outline-offset: -4px; }
.egess-hint {
  position: absolute; z-index: 2; left: 50%; bottom: 16px; transform: translateX(-50%); padding: 7px 15px; border-radius: 999px; pointer-events: none;
  background: rgba(10, 14, 16, 0.6); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid var(--e-line);
  font-size: 0.74rem; letter-spacing: 0.02em; white-space: nowrap; color: var(--e-text); transition: opacity 500ms;
}
.egess-hint.gone { opacity: 0; }

.egess-panel { display: grid; gap: 14px; align-content: start; padding: 22px 22px 20px; border-left: 1px solid var(--e-line); }
.egess-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--e-dim); font-weight: 600; }
.egess-link { font: inherit; font-size: 0.72rem; letter-spacing: 0.02em; text-transform: none; color: var(--e-dim); background: none; border: 1px solid var(--e-line); border-radius: 999px; padding: 4px 11px; cursor: pointer; transition: color 140ms, border-color 140ms; }
.egess-link:hover, .egess-link.on { border-color: var(--e-accent); color: var(--e-accent); }
.egess-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.egess-state { --c: #4b6a6c; display: flex; align-items: center; gap: 11px; font-family: Georgia, "Times New Roman", serif; font-size: 1.85rem; line-height: 1.05; letter-spacing: -0.02em; }
.egess-state::before { content: ""; width: 13px; height: 13px; flex: none; background: var(--c); clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); filter: drop-shadow(0 0 6px var(--c)); transition: background 200ms; }
.egess-dial { position: relative; width: 52px; height: 52px; flex: none; color: #fff; }
.egess-dial svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.egess-needle { transition: transform 220ms, opacity 200ms; }
.egess-grid { display: grid; grid-template-columns: auto 1fr; margin: 0; font-size: 0.84rem; }
.egess-grid dt, .egess-grid dd { padding: 8px 0; border-top: 1px solid var(--e-line); }
.egess-grid dt { color: var(--e-dim); }
.egess-grid dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.egess-bar { height: 3px; border-radius: 2px; background: var(--e-line); overflow: hidden; margin-top: 7px; }
.egess-bar i { display: block; height: 100%; width: 100%; background: var(--e-accent); transition: width 200ms; }
.egess-small { font-size: 0.74rem; color: var(--e-dim); line-height: 1.45; margin: 0; }
.egess-compare { min-height: 3.4em; font-size: 0.76rem; line-height: 1.5; color: var(--e-text); margin: 0; }

.egess-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--e-line); }
.egess-seg { display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--e-line); }
.egess-seg button, .egess-pill {
  font: inherit; font-size: 0.8rem; color: var(--e-dim); background: transparent; border: 0; border-radius: 999px; padding: 7px 14px; cursor: pointer; transition: background 140ms, color 140ms, border-color 140ms;
}
.egess-seg button.on { background: rgba(125, 240, 180, 0.14); color: var(--e-accent); font-weight: 600; box-shadow: inset 0 0 0 1px rgba(125, 240, 180, 0.4); }
.egess-pill { border: 1px solid var(--e-line); }
.egess-pill:hover { color: var(--e-text); border-color: rgba(190, 215, 222, 0.35); }
.egess-pill[aria-pressed="true"], .egess-pill.on { color: var(--e-accent); border-color: rgba(125, 240, 180, 0.45); }
.egess :where(button, canvas):focus-visible { outline: 2px solid var(--e-accent); outline-offset: 2px; }
.egess-note-line { flex: 1 1 200px; margin: 0; font-size: 0.78rem; color: var(--e-dim); text-align: right; }

.egess-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 12px 18px 16px; border-top: 1px solid var(--e-line); list-style: none; font-size: 0.74rem; color: var(--e-dim); }
.egess-legend li { display: inline-flex; align-items: center; gap: 7px; }
.egess-legend i { width: 12px; height: 12px; display: inline-block; clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); position: relative; }
.egess-legend i.s-warn::after, .egess-legend i.s-imp::after { content: ""; position: absolute; inset: 0; margin: auto; border-radius: 50%; }
.egess-legend i.s-warn::after { width: 3px; height: 3px; background: rgba(14, 16, 18, 0.6); }
.egess-legend i.s-imp::after { width: 5px; height: 5px; background: rgba(255, 245, 240, 0.95); }
.egess-legend i.s-rec::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; border: 1.3px solid rgba(8, 48, 40, 0.75); }
.egess-legend i.s-miss { background: rgba(255, 255, 255, 0.12); clip-path: none; border-radius: 50%; width: 4px; height: 4px; margin: 0 4px; }
.egess-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* compact: the little live swarm on the home page */
.egess[data-egess="compact"] .egess-stage { border-radius: 20px; border: 1px solid var(--e-line); }
.egess[data-egess="compact"] .egess-hint { font-size: 0.7rem; bottom: 12px; }
.work-media.egess-media { background: #0a0f12; padding: 14px; }
.work-media.egess-media::before, .work-media.egess-media::after { display: none; }
.egess-media .egess { width: 100%; }

@media (max-width: 900px) {
  .egess-main { grid-template-columns: 1fr; }
  .egess-panel { border-left: 0; border-top: 1px solid var(--e-line); }
  .egess-note-line { text-align: left; }
}
@media (prefers-reduced-motion: reduce) { .egess-hint, .egess-bar i, .egess-needle, .egess-state::before { transition: none; } }

/* affected-nodes table, under the swarm */
.egess-left { min-width: 0; display: flex; flex-direction: column; }
.egess-nodes { border-top: 1px solid var(--e-line); padding: 14px 18px 12px; }
.egess-nodes-head { display: flex; justify-content: space-between; gap: 10px; font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--e-dim); font-weight: 600; margin-bottom: 6px; }
.egess-nodes-head span:last-child { letter-spacing: 0.02em; text-transform: none; font-weight: 500; }
.egess-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; font-variant-numeric: tabular-nums; table-layout: fixed; }
.egess-table th { text-align: left; font-weight: 500; font-size: 0.7rem; color: var(--e-dim); padding: 6px 8px 6px 0; }
.egess-table td { padding: 0 8px 0 0; height: 30px; border-top: 1px solid var(--e-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.egess-table th:nth-child(1) { width: 24%; } .egess-table th:nth-child(2) { width: 22%; } .egess-table th:nth-child(3) { width: 10%; } .egess-table th:nth-child(4) { width: 18%; }
.egess-table td:nth-child(3), .egess-table td:nth-child(4) { font-weight: 600; }
.egess-table td .dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; background: var(--c); clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); }
.egess-table tr.is-probe td { color: #fff; background: rgba(255, 255, 255, 0.04); }
.egess-table td em { font-style: normal; font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--e-accent); margin-left: 4px; }
.egess-table tr.empty td { color: var(--e-dim); font-weight: 400; }
@media (max-width: 560px) { .egess-table { font-size: 0.72rem; } .egess-table th:nth-child(5), .egess-table td:nth-child(5) { display: none; } .egess-table th:nth-child(1) { width: 30%; } .egess-table th:nth-child(2) { width: 30%; } }
