/* Silicon Bayou Designs - animated capability demos.
   Chrome for demo-player.js. Inherits --accent-* from <body data-accent>. */

.demo-stage {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #0b0618;
  border: 1px solid var(--border);
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
}

/* real-world context loop, sitting behind the interface */
.demo-stage video {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: .22; filter: saturate(.7);
  pointer-events: none;
}
.demo-stage::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(11,6,24,.72) 0%, rgba(11,6,24,.88) 100%);
}

/* === APP WINDOW === */
.demo-window {
  position: relative; z-index: 1;
  margin: 26px; border-radius: 12px;
  background: rgba(18,10,36,.92);
  border: 1px solid rgba(255,255,255,.1);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.demo-titlebar {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px;
  background: rgba(255,255,255,.035);
  border-bottom: 1px solid var(--border);
}
.demo-dots { display: flex; gap: 6px; flex-shrink: 0; }
.demo-dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.16); }
.demo-title { font-size: .8rem; font-weight: 700; color: var(--text); letter-spacing: .01em; }
.demo-subtitle { font-size: .72rem; color: var(--text-light); }
.demo-live {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  font-size: .62rem; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--accent-light);
}
.demo-live i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent-light);
  box-shadow: 0 0 0 0 rgba(var(--accent-rgb),.6);
}
.is-running .demo-live i { animation: demoPulse 1.6s ease-out infinite; }
@keyframes demoPulse {
  0%   { box-shadow: 0 0 0 0 rgba(var(--accent-rgb),.55); }
  100% { box-shadow: 0 0 0 9px rgba(var(--accent-rgb),0); }
}

.demo-body {
  padding: 18px 18px 20px; min-height: 292px;
  display: flex; flex-direction: column; gap: 18px;
}
.demo-col { display: flex; flex-direction: column; gap: 10px; }
.demo-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.demo-split > * { min-width: 0; }

.demo-caption {
  font-size: .66rem; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--text-light); margin-bottom: 9px;
}

/* === ROWS === */
.demo-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: 9px;
  background: rgba(255,255,255,.035);
  border: 1px solid var(--border);
  opacity: 0; transform: translateY(10px);
  transition: opacity .45s cubic-bezier(.16,1,.3,1), transform .45s cubic-bezier(.16,1,.3,1),
              border-color .35s, background .35s;
}
.demo-row.in { opacity: 1; transform: translateY(0); }
.demo-row.settled { border-color: rgba(var(--accent-rgb),.3); }
.demo-row.flagged { border-color: rgba(224,180,76,.45); background: rgba(224,180,76,.07); }
.demo-row-icon {
  width: 30px; height: 30px; min-width: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(var(--accent-rgb),.15); color: var(--accent-light);
}
.demo-row-main { flex: 1; min-width: 0; }
.demo-row-title {
  font-size: .82rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.demo-row-sub { font-size: .7rem; color: var(--text-light); margin-top: 2px; }
.demo-row-value { font-size: .84rem; font-weight: 700; color: var(--text); white-space: nowrap; }

/* === EXTRACTED FIELDS === */
.demo-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.demo-field {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 7px 0; border-bottom: 1px dashed var(--border);
}
.demo-field-label {
  font-size: .68rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-light); white-space: nowrap;
}
.demo-field-value {
  font-size: .8rem; font-weight: 600; color: var(--text);
  opacity: 0; transform: translateX(-6px);
  transition: opacity .3s, transform .3s;
}
.demo-field-value.in { opacity: 1; transform: translateX(0); }
.demo-field.reading { background: linear-gradient(90deg, rgba(var(--accent-rgb),.14), transparent); }

/* === BADGES === */
.demo-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 99px; white-space: nowrap;
  font-size: .66rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid transparent; transition: all .35s;
}
.demo-badge[data-state="idle"]    { background: rgba(255,255,255,.05); color: var(--text-light); }
.demo-badge[data-state="working"] { background: rgba(var(--accent-rgb),.16); color: var(--accent-light); border-color: rgba(var(--accent-rgb),.35); }
.demo-badge[data-state="pass"]    { background: rgba(34,160,80,.16); color: #4ED88A; border-color: rgba(34,160,80,.4); }
.demo-badge[data-state="flag"]    { background: rgba(224,180,76,.16); color: var(--gold-light); border-color: rgba(224,180,76,.42); }
.demo-badge .spin {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1.5px solid currentColor; border-top-color: transparent;
  display: none;
}
.demo-badge[data-state="working"] .spin { display: block; animation: demoSpin .7s linear infinite; }
@keyframes demoSpin { to { transform: rotate(360deg); } }

/* === COUNTERS === */
.demo-stat { display: flex; flex-direction: column; gap: 2px; }
.demo-stat-value { font-family: 'DM Serif Display', serif; font-size: 1.6rem; color: #fff; line-height: 1.1; }
.demo-stat-label { font-size: .66rem; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-light); }
.demo-stat-row { display: flex; gap: 28px; flex-wrap: wrap; }

/* === CHART === */
.demo-chart { display: flex; align-items: flex-end; gap: 9px; height: 132px; padding-top: 6px; }
.demo-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.demo-bar {
  width: 100%; border-radius: 5px 5px 0 0; height: 0;
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
  transition: height .7s cubic-bezier(.16,1,.3,1);
}
.demo-bar.alt { background: linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,.1)); }
.demo-bar-label { font-size: .64rem; color: var(--text-light); letter-spacing: .04em; }

.demo-svg { width: 100%; height: auto; aspect-ratio: 620 / 190; display: block; overflow: visible; }
.demo-svg .draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); }
.demo-svg .draw.in { transition: stroke-dashoffset 1.15s cubic-bezier(.4,0,.2,1); stroke-dashoffset: 0; }
.demo-svg .draw.dashed.in { transition: none; animation: drawThenDash 1.15s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes drawThenDash {
  from { stroke-dashoffset: var(--len); }
  99%  { stroke-dashoffset: 0; stroke-dasharray: var(--len); }
  to   { stroke-dashoffset: 0; stroke-dasharray: 6 5; }
}
.demo-svg .band { opacity: 0; transition: opacity .7s; }
.demo-svg .band.in { opacity: 1; }
.demo-svg .marker { opacity: 0; transform: scale(.4); transform-origin: center; transition: opacity .4s, transform .4s cubic-bezier(.34,1.56,.64,1); }
.demo-svg .marker.in { opacity: 1; transform: scale(1); }

/* === TYPEWRITER === */
.demo-type {
  font-size: .84rem; line-height: 1.7; color: var(--text-muted);
  min-height: 4.2em;
}
.demo-type .cursor {
  display: inline-block; width: 2px; height: 1em; vertical-align: -2px;
  background: var(--accent-light); margin-left: 2px;
}
.is-running .demo-type .cursor { animation: demoBlink 1s steps(2) infinite; }
@keyframes demoBlink { 50% { opacity: 0; } }

/* === ALERT === */
.demo-alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 15px; border-radius: 9px;
  background: rgba(224,180,76,.09); border: 1px solid rgba(224,180,76,.35);
  opacity: 0; transform: translateY(8px);
  transition: opacity .45s, transform .45s cubic-bezier(.16,1,.3,1);
}
.demo-alert.in { opacity: 1; transform: translateY(0); }
.demo-alert svg { color: var(--gold-light); min-width: 18px; margin-top: 1px; }
.demo-alert-title { font-size: .8rem; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.demo-alert-body { font-size: .76rem; line-height: 1.6; color: var(--text-muted); }

/* === FOOTER BAR === */
.demo-footer {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  margin: 0 26px 24px;
  padding: 13px 16px; border-radius: 10px;
  background: rgba(255,255,255,.04); border: 1px solid var(--border);
}
.demo-outcome { font-size: .8rem; color: var(--text-muted); }
.demo-outcome b { color: var(--accent-light); font-weight: 700; }
.demo-outcome s { color: var(--text-light); text-decoration-thickness: 1px; }
.demo-replay {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.06); border: 1px solid var(--border-hover);
  color: var(--text-muted); border-radius: 99px; padding: 7px 15px;
  font-family: 'DM Sans', sans-serif; font-size: .74rem; font-weight: 700;
  cursor: pointer; transition: all .25s;
}
.demo-replay:hover { color: var(--text); border-color: var(--accent-light); background: rgba(var(--accent-rgb),.1); }
.demo-replay svg { transition: transform .5s cubic-bezier(.16,1,.3,1); }
.demo-replay:hover svg { transform: rotate(-180deg); }

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .demo-split { grid-template-columns: 1fr; gap: 18px; }
  .demo-fields { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .demo-window { margin: 14px; }
  .demo-body { padding: 14px 13px 16px; min-height: 0; }
  .demo-footer { margin: 0 14px 14px; }
  .demo-row { padding: 10px; gap: 9px; }
  .demo-row-title { font-size: .78rem; }
  .demo-stat-row { gap: 18px; }
  .demo-stat-value { font-size: 1.3rem; }
  .demo-chart { height: 104px; gap: 6px; }
}

/* Motion is decoration here: the finished state carries the meaning. */
@media (prefers-reduced-motion: reduce) {
  .demo-row, .demo-field-value, .demo-alert, .demo-svg .band, .demo-svg .marker {
    opacity: 1 !important; transform: none !important; transition: none !important;
  }
  .demo-svg .draw { stroke-dashoffset: 0 !important; transition: none !important; animation: none !important; }
  .demo-svg .draw.dashed { stroke-dasharray: 6 5 !important; }
  .demo-bar, .demo-badge { transition: none !important; }
  .demo-live i, .demo-type .cursor { animation: none !important; }
  .demo-type .cursor { display: none; }
}
