/* Live HMI iframe embeds — native resolution, scaled to fit, HMI panel chrome */

.demo-embed-layout {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 clamp(var(--space-sm), 2vw, var(--space-md));
}

.demo-embed-section {
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--color-border);
}

.demo-embed-section:last-of-type {
  border-bottom: none;
}

.demo-embed-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.demo-embed-title {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.demo-embed-route {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* ============================================================
   HMI panel chrome — in-cab display vs supervisor monitor
   ============================================================ */

.hmi-panel {
  --panel-bezel: #1a1d22;
  --panel-bezel-mid: #252930;
  --panel-bezel-light: #3a4049;
  --panel-bezel-dark: #0e1014;
  --panel-accent: #367c2b;
  --panel-glass: #060809;
  margin: 0 auto;
}

.hmi-panel--cab {
  max-width: min(100%, 1344px);
}

.hmi-panel--portal {
  max-width: 100%;
}

.hmi-panel__shell {
  position: relative;
  border-radius: 18px;
  background: linear-gradient(
    165deg,
    var(--panel-bezel-light) 0%,
    var(--panel-bezel-mid) 18%,
    var(--panel-bezel) 45%,
    var(--panel-bezel-dark) 100%
  );
  padding: 14px 14px 10px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 -1px 0 rgba(0, 0, 0, 0.45) inset,
    0 24px 64px -12px rgba(0, 0, 0, 0.75),
    0 8px 24px -8px rgba(0, 0, 0, 0.5);
}

.hmi-panel--portal .hmi-panel__shell {
  border-radius: 14px 14px 4px 4px;
  padding: 10px 10px 0;
  background: linear-gradient(
    180deg,
    #2a2e36 0%,
    #1c1f24 12%,
    #141619 100%
  );
}

/* Top status strip */
.hmi-panel__chrome {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 10px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.hmi-panel__chrome--portal {
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 0;
}

.hmi-panel__led {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--panel-accent);
  box-shadow:
    0 0 6px rgba(54, 124, 43, 0.9),
    0 0 14px rgba(54, 124, 43, 0.35);
}

.hmi-panel__brand {
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.08em;
}

.hmi-panel__meta {
  margin-left: auto;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.32);
}

/* Glass viewport recess */
.hmi-panel__viewport {
  position: relative;
  padding: 3px;
  border-radius: 6px;
  background: linear-gradient(180deg, #050607 0%, #0a0c0e 100%);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.85),
    0 0 0 2px rgba(255, 255, 255, 0.04),
    inset 0 2px 8px rgba(0, 0, 0, 0.65),
    inset 0 -1px 0 rgba(255, 255, 255, 0.03);
}

.hmi-panel__viewport::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 3px;
  border-radius: 4px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.04) 0%,
    transparent 38%,
    transparent 100%
  );
  z-index: 2;
}

.hmi-panel__viewport--portal {
  padding: 2px;
  border-radius: 4px;
}

/* Armrest chin / grip detail (cab only) */
.hmi-panel__chin {
  display: flex;
  justify-content: center;
  padding: 8px 0 2px;
}

.hmi-panel__chin-grip {
  display: block;
  width: 48px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(0, 0, 0, 0.35) 100%
  );
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Desktop monitor stand (portal only) */
.hmi-panel__stand {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 2px;
}

.hmi-panel__stand-neck {
  display: block;
  width: 56px;
  height: 28px;
  background: linear-gradient(
    90deg,
    #1a1c20 0%,
    #2e3238 50%,
    #1a1c20 100%
  );
  clip-path: polygon(30% 0, 70% 0, 100% 100%, 0 100%);
}

.hmi-panel__stand-base {
  display: block;
  width: 140px;
  height: 8px;
  margin-top: -1px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(
    180deg,
    #252830 0%,
    #141619 100%
  );
  box-shadow: 0 6px 20px -4px rgba(0, 0, 0, 0.6);
}

/* ============================================================
   Iframe viewport (inside panel recess)
   ============================================================ */

.demo-embed-frame {
  --demo-native-w: 1280;
  --demo-native-h: 800;
  container-type: inline-size;
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: calc(var(--demo-native-w) * 1px);
  margin: 0 auto;
  aspect-ratio: var(--demo-native-w) / var(--demo-native-h);
  border-radius: 4px;
  overflow: hidden;
  background: var(--panel-glass);
  border: none;
  box-shadow: none;
}

.demo-embed-frame--fleet {
  --demo-native-w: 1920;
  --demo-native-h: 1080;
  width: 100%;
  max-width: none;
  min-height: clamp(320px, 48vw, 864px);
  border-radius: 2px;
}

.demo-embed-frame--fleet .demo-embed-scaler {
  width: 100%;
  height: auto;
  aspect-ratio: var(--demo-native-w) / var(--demo-native-h);
  transform: none;
}

.demo-embed-frame--fleet .demo-embed-scaler iframe {
  width: 100%;
  height: 100%;
}

.demo-embed-scaler {
  width: calc(var(--demo-native-w) * 1px);
  height: calc(var(--demo-native-h) * 1px);
  transform-origin: top left;
  will-change: transform;
}

.demo-embed-scaler iframe {
  display: block;
  width: calc(var(--demo-native-w) * 1px);
  height: calc(var(--demo-native-h) * 1px);
  border: 0;
  overflow: hidden;
  background: #0a0f0a;
}

.demo-embed-hint {
  margin-top: var(--space-sm);
  font-size: 0.85rem;
  font-weight: 300;
  line-height: 1.5;
  color: var(--color-text-muted);
}

.demo-embed-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: var(--space-sm);
}

.demo-embed-btn {
  padding: 0.35rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.demo-embed-btn:hover,
.demo-embed-btn.is-active {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.demo-proof-intro {
  max-width: 52ch;
  margin-bottom: var(--space-xl);
  font-size: 1.02rem;
  font-weight: 300;
  line-height: 1.7;
  color: var(--color-text-muted);
}

.demo-proof-status {
  margin-top: var(--space-xl);
  padding: var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.demo-proof-status strong {
  color: var(--color-text);
  font-weight: 500;
}

@media (prefers-reduced-motion: no-preference) {
  .hmi-panel__led {
    animation: hmi-panel-led-pulse 3s ease-in-out infinite;
  }
}

@keyframes hmi-panel-led-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

@media (max-width: 640px) {
  .hmi-panel__shell {
    padding: 10px 10px 8px;
    border-radius: 14px;
  }

  .hmi-panel__chrome {
    flex-wrap: wrap;
    gap: 6px;
  }

  .hmi-panel__meta {
    margin-left: 0;
    width: 100%;
  }
}
