/* ==========================================================================
   AI VIDEO SURVEILLANCE CASE STUDY — page-scoped components

   Linked ONLY from /work/ai-video-surveillance/. Kept out of main.css so the
   other 26 pages don't download visuals they never render.

   Every graphic here is CSS/SVG — no raster images, no stock photography.
   That keeps the page fast, crisp at any DPI, and theme-consistent, and it is
   why the "camera feeds" are constructed from gradients rather than footage:
   publishing real surveillance stills would be both a privacy problem and an
   unsubstantiated claim about a specific deployment.

   All values come from css/tokens.css. Nothing here hardcodes a raw colour.
   ========================================================================== */

/* ---------- shared: illustrative-mockup marker ---------------------------
   Any product UI on this page is a reconstruction, not a screenshot of a live
   deployment. Every mockup carries this label so a reader can never mistake
   the figures inside it for measured results. */

.mock {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.mock__chrome {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-2);
}

.mock__dots {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.mock__dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border-strong);
  display: block;
}

.mock__title {
  font-family: var(--font-mono);
  font-size: var(--text-mono-label);
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.mock__tag {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warning);
  border: 1px solid rgb(255 178 107 / 35%);
  background: rgb(255 178 107 / 10%);
  padding: 3px var(--space-2);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.mock__body {
  padding: var(--space-4);
}

/* ---------- camera feed tile -------------------------------------------
   A "feed" is layered gradients suggesting depth (floor plane + wall wash +
   vignette) plus a faint scan texture. Deliberately abstract. */

.feed {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 4%) 0%, transparent 38%),
    linear-gradient(
      175deg,
      var(--surface-3) 0%,
      var(--surface-2) 52%,
      var(--surface-inset) 100%
    );
  border: 1px solid var(--border-subtle);
  isolation: isolate;
}

/* perspective floor lines — reads as a monitored space */
.feed::before {
  content: "";
  position: absolute;
  inset: 55% 0 0;
  background-image:
    linear-gradient(90deg, rgb(255 255 255 / 5%) 1px, transparent 1px),
    linear-gradient(rgb(255 255 255 / 5%) 1px, transparent 1px);
  background-size: 22% 34%;
  transform: perspective(60px) rotateX(32deg);
  transform-origin: bottom;
  opacity: 0.7;
}

/* scan texture + vignette */
.feed::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      0deg,
      rgb(0 0 0 / 16%) 0 1px,
      transparent 1px 3px
    ),
    radial-gradient(ellipse at 50% 40%, transparent 45%, rgb(0 0 0 / 55%) 100%);
}

.feed__label {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: rgb(8 9 11 / 72%);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.feed__live {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
  animation: feed-pulse 2s var(--ease-in-out) infinite;
}

@keyframes feed-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.feed__time {
  position: absolute;
  bottom: var(--space-2);
  right: var(--space-2);
  z-index: 3;
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  color: var(--text-tertiary);
  background: rgb(8 9 11 / 72%);
  padding: 2px 5px;
  border-radius: var(--radius-sm);
}

/* AI detection box drawn over the feed */
.det {
  position: absolute;
  z-index: 2;
  border: 1.5px solid var(--flame-500);
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgb(8 9 11 / 60%), var(--glow-flame-sm);
}

.det::after {
  content: attr(data-label);
  position: absolute;
  top: -1.5px;
  left: -1.5px;
  transform: translateY(-100%);
  font-family: var(--font-mono);
  font-size: 0.5rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: var(--text-on-flame);
  background: var(--flame-500);
  padding: 1px 4px;
  border-radius: 2px 2px 0 0;
}

.det--risk {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px rgb(8 9 11 / 60%), 0 4px 16px rgb(255 122 107 / 30%);
}

.det--risk::after {
  background: var(--danger);
  color: var(--surface-inset);
}

/* sweep line — enhancement only, removed under reduced-motion */
.feed__sweep {
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  z-index: 1;
  background: linear-gradient(
    180deg,
    transparent,
    var(--flame-400),
    transparent
  );
  opacity: 0.5;
  animation: feed-sweep 5.5s linear infinite;
}

@keyframes feed-sweep {
  0% { transform: translateX(0); }
  100% { transform: translateX(var(--sweep-to, 100cqw)); }
}

/* ---------- video wall ------------------------------------------------- */

.vwall {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}

@media (min-width: 700px) {
  .vwall--3 { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- pipeline / flow ---------------------------------------------
   Horizontally scrollable on narrow screens rather than wrapping into an
   ambiguous order — a pipeline that wraps stops reading as a sequence. */

.flow {
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-3);
  scroll-snap-type: x proximity;
}

.flow__step {
  flex: 0 0 auto;
  min-width: 132px;
  max-width: 172px;
  scroll-snap-align: start;
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.flow__step::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: var(--highlight-top);
}

.flow__n {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: var(--tracking-mono);
  color: var(--flame-400);
}

.flow__t {
  font-size: var(--text-body-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  line-height: 1.3;
}

.flow__d {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  line-height: 1.5;
}

.flow__arrow {
  flex: 0 0 auto;
  align-self: center;
  color: var(--border-strong);
}

/* ---------- alert card -------------------------------------------------- */

.alert {
  position: relative;
  background: var(--surface-1);
  border: 1px solid rgb(255 122 107 / 32%);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.alert__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.alert__sev {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--danger);
  background: rgb(255 122 107 / 12%);
  border: 1px solid rgb(255 122 107 / 32%);
  padding: 3px var(--space-2);
  border-radius: var(--radius-full);
}

.alert__sev i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--danger);
  display: block;
}

.alert__title {
  font-size: var(--text-h4);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.alert__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr));
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.alert__k {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 3px;
}

.alert__v {
  display: block;
  font-size: var(--text-body-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}

.alert__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* Non-interactive: these are mockup affordances, not real controls. Rendered
   as spans so they are not announced as buttons to a screen reader. */
.pseudo-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  background: rgb(255 255 255 / 4%);
}

.pseudo-btn--primary {
  background: var(--flame-500);
  border-color: transparent;
  color: var(--text-on-flame);
}

.pseudo-btn--danger {
  color: var(--danger);
  border-color: rgb(255 122 107 / 35%);
  background: rgb(255 122 107 / 8%);
}

/* ---------- intelligent video search ----------------------------------- */

.vsearch__bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}

.vsearch__label {
  font-family: var(--font-mono);
  font-size: var(--text-mono-label);
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-right: var(--space-1);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: var(--text-mono-label);
  color: var(--flame-200);
  background: var(--flame-wash);
  border: 1px solid var(--flame-edge);
  padding: 4px var(--space-2);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.chip--neutral {
  color: var(--text-secondary);
  background: rgb(255 255 255 / 5%);
  border-color: var(--border-default);
}

.chip__sw {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  border: 1px solid rgb(255 255 255 / 25%);
  display: block;
  flex-shrink: 0;
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.result {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.result__meta {
  padding: var(--space-3);
}

.result__cam {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.result__camname {
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.result__ts {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.result__attrs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: var(--space-3);
}

.result__attr {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.03em;
  color: var(--text-tertiary);
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  padding: 2px 5px;
  border-radius: 3px;
}

/* Confidence is a model score, so it is labelled as one and never rounded up
   to an implied certainty. */
.conf {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.conf__track {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}

.conf__fill {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--flame-600), var(--flame-400));
}

.conf__n {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ---------- command centre dashboard ------------------------------------ */

.soc {
  display: grid;
  gap: var(--space-3);
}

@media (min-width: 900px) {
  .soc { grid-template-columns: 1.9fr 1fr; align-items: start; }
}

.soc__panel {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.soc__ph {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.soc__pt {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.soc__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-2);
}

.soc__row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-caption);
  color: var(--text-secondary);
  padding: var(--space-2);
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.soc__row b {
  color: var(--text-primary);
  font-weight: var(--weight-medium);
}

.soc__row time {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  display: block;
}

.dot--red { background: var(--danger); }
.dot--amber { background: var(--warning); }
.dot--green { background: var(--success); }
.dot--blue { background: var(--info); }

/* small KPI grid inside the dashboard */
.kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}

.kpi {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
}

.kpi b {
  display: block;
  font-size: 1.25rem;
  font-weight: var(--weight-bold);
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.1;
}

.kpi span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-top: 3px;
}

/* ---------- heat map ---------------------------------------------------- */

.heat {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 3px;
}

.heat i {
  aspect-ratio: 1;
  border-radius: 2px;
  display: block;
  background: var(--flame-500);
  /* density set inline per cell via --d */
  opacity: var(--d, 0.08);
}

.heat-legend {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.heat-legend__ramp {
  flex: 0 0 96px;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(
    90deg,
    rgb(255 107 53 / 8%),
    rgb(255 107 53 / 45%),
    var(--flame-500)
  );
}

/* ---------- event lifecycle timeline ------------------------------------ */

.lifecycle {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding-bottom: var(--space-2);
  list-style: none;
  margin: 0;
}

.lifecycle li {
  flex: 1 0 auto;
  min-width: 118px;
  position: relative;
  padding: var(--space-6) var(--space-3) 0;
  text-align: center;
}

/* connecting rail */
.lifecycle li::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-default);
}

.lifecycle li:first-child::before { left: 50%; }
.lifecycle li:last-child::before { right: 50%; }

.lifecycle li::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 50%;
  translate: -50% 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--flame-500);
  box-shadow: 0 0 0 3px var(--surface-0);
}

.lifecycle b {
  display: block;
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.lifecycle span {
  display: block;
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  margin-top: 3px;
  line-height: 1.45;
}

/* ---------- RBAC hierarchy ---------------------------------------------- */

.rbac {
  display: grid;
  gap: var(--space-3);
}

.rbac__tier {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.rbac__tier::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  background: var(--flame-500);
  opacity: var(--tier-strength, 1);
}

.rbac__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.rbac__name {
  font-size: var(--text-h4);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.rbac__lvl {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  border: 1px solid var(--border-default);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
}

.perms {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
  margin: 0;
}

.perms li {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  padding: 3px var(--space-2);
  border-radius: var(--radius-sm);
}

.rbac__link {
  display: flex;
  justify-content: center;
  color: var(--border-strong);
}

/* ---------- architecture stack ------------------------------------------ */

.stack {
  display: grid;
  gap: var(--space-2);
  counter-reset: layer;
}

.stack__layer {
  display: grid;
  gap: var(--space-1);
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: var(--space-4);
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  position: relative;
}

.stack__layer::before {
  counter-increment: layer;
  content: counter(layer, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: var(--text-mono-label);
  color: var(--flame-400);
  letter-spacing: var(--tracking-mono);
}

.stack__body { min-width: 0; }

.stack__name {
  display: block;
  font-size: var(--text-body-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.stack__parts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: var(--space-2);
}

.stack__part {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.03em;
  color: var(--text-tertiary);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  padding: 2px 5px;
  border-radius: 3px;
}

.stack__sep {
  justify-self: center;
  color: var(--border-strong);
  grid-column: 1 / -1;
}

/* ---------- notification fan-out --------------------------------------- */

.fan {
  display: grid;
  gap: var(--space-4);
  align-items: center;
}

@media (min-width: 820px) {
  .fan { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.2fr); }
}

.fan__engine {
  background: var(--surface-1);
  border: 1px solid var(--border-flame);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
  box-shadow: var(--glow-flame-sm);
}

.fan__channels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: var(--space-2);
}

.channel {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.channel b {
  display: block;
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.channel span {
  display: block;
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ---------- capability groups ------------------------------------------ */

.capgroup {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
}

.capgroup::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: var(--highlight-top);
}

.capgroup__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.caplist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-2);
}

.caplist li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-body-sm);
  color: var(--text-secondary);
  line-height: var(--leading-body);
}

.caplist svg {
  flex-shrink: 0;
  color: var(--flame-400);
  margin-top: 4px;
}

/* ---------- reduced motion --------------------------------------------
   Ambient animation is decoration; none of it conveys information. */

@media (prefers-reduced-motion: reduce) {
  .feed__sweep { display: none; }
  .feed__live { animation: none; }
}
