/* ═══════════════════════════════════════════════════════════════
   SHELL — Persistent Platform Chrome
   Header · Navigation · Command Strip · Module Container
   Data Spine · Tech Overlay · Interconnection Callout · Skeleton
═══════════════════════════════════════════════════════════════ */

/* ── HEADER ── */
#platform-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.brand-mark {
  color: var(--accent);
  font-size: var(--text-lg);
  line-height: 1;
}

.brand-name {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.brand-divider {
  color: var(--border-active);
  margin: 0 var(--space-1);
}

.brand-title {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: border-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
}

.btn-ghost:hover {
  border-color: var(--border-active);
  color: var(--text);
  background: var(--surface-alt);
}

/* ── NAVIGATION ── */
#platform-nav {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 90;
}

.nav-track {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 var(--space-4);
  position: relative;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-track::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  height: 100%;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  transition: color var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}

.nav-tab:hover {
  color: var(--text-secondary);
}

.nav-tab.active {
  color: var(--text);
}

/* Live dot on Command Center tab */
.nav-live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  margin-right: 6px;
  animation: pulse 2s infinite;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Sliding indicator bar */
#nav-indicator {
  position: absolute;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  transition: left var(--duration-base) var(--ease-out),
              width var(--duration-base) var(--ease-out);
  pointer-events: none;
}

/* ── COMMAND STRIP ── */
#command-strip {
  position: fixed;
  top: calc(var(--header-height) + var(--nav-height));
  left: 0;
  right: 0;
  height: var(--command-strip-height);
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  z-index: 80;
  gap: 0;
}

.strip-metric {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 var(--space-6);
  flex: 1;
  min-width: 0;
}

.strip-metric:first-child {
  padding-left: 0;
}

.strip-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-muted-sm);
  white-space: nowrap;
}

.strip-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.strip-value.amber { color: var(--amber); }
.strip-value.emerald { color: var(--emerald); }
.strip-value.rose { color: var(--rose); }

.strip-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
}

/* Strip slot swap animation — fade + slide */
#strip-slot-4,
#strip-slot-5 {
  transition: opacity var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}

#strip-slot-4.swapping,
#strip-slot-5.swapping {
  opacity: 0;
  transform: translateY(4px);
}

/* ── MODULE CONTAINER ── */
#module-container {
  position: fixed;
  top: calc(var(--header-height) + var(--nav-height) + var(--command-strip-height));
  left: 0;
  right: 0;
  bottom: 52px; /* height of data spine */
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── MODULE ENTRANCE TRANSITION ── */
#module-container.module-enter {
  animation: fadeSlideUp var(--duration-base) var(--ease-out) both;
}

/* ── SKELETON LOADER ── */
.module-skeleton {
  padding: var(--space-8) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.skeleton-line {
  height: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    90deg,
    var(--surface) 0%,
    var(--surface-alt) 40%,
    var(--surface) 80%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.skeleton-line.wide   { width: 70%; }
.skeleton-line.medium { width: 50%; }
.skeleton-line.narrow { width: 35%; }

/* Full skeleton cards for richer loading state */
.skeleton-card {
  height: 120px;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    90deg,
    var(--surface) 0%,
    var(--surface-alt) 40%,
    var(--surface) 80%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border: 1px solid var(--border);
}

/* ── DATA SPINE ── */
#data-spine {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: 0;
  z-index: 80;
  overflow-x: auto;
  scrollbar-width: none;
}

#data-spine::-webkit-scrollbar { display: none; }

.spine-node {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: default;
  transition: color var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
  padding: 0 var(--space-2);
}

.spine-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--text-muted);
  background: transparent;
  transition: background var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}

/* INACTIVE state (default) */
.spine-node[data-state="inactive"] {
  color: var(--text-muted);
}
.spine-node[data-state="inactive"] .spine-dot {
  background: transparent;
  border-color: var(--border-active);
}

/* ACTIVE state */
.spine-node[data-state="active"] {
  color: var(--text);
}
.spine-node[data-state="active"] .spine-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.5);
  animation: nodeGlow 2s ease-in-out infinite;
}

/* CONNECTED state */
.spine-node[data-state="connected"] {
  color: var(--text-secondary);
}
.spine-node[data-state="connected"] .spine-dot {
  background: rgba(34, 211, 238, 0.3);
  border-color: var(--accent);
}

/* PULSE state (briefly) */
.spine-node[data-state="pulse"] .spine-dot {
  animation: spinePulse 0.6s ease-in-out;
  background: var(--accent);
  border-color: var(--accent);
}

/* Spine connectors between nodes */
.spine-connector {
  width: 20px;
  height: 1px;
  background: var(--border);
  flex-shrink: 0;
  position: relative;
  overflow: visible;
  transition: background var(--duration-base) var(--ease-out);
}

.spine-connector.animated {
  background: var(--accent-muted);
}

.spine-connector.animated::after {
  content: '';
  position: absolute;
  top: -3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.8;
  animation: flowParticle 1.2s linear infinite;
}

/* Spine flow particle (animateSpineFlow) */
.spine-flow-particle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  z-index: 10;
  pointer-events: none;
}

/* ── TECH STACK OVERLAY ── */
#tech-overlay {
  position: fixed;
  bottom: 52px; /* above data spine */
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 75;
  transform: translateY(100%);
  transition: transform var(--duration-slow) var(--ease-out);
  backdrop-filter: blur(12px);
}

#tech-overlay.visible {
  transform: translateY(0);
}

.tech-overlay-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
}

.tech-category {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.tech-tag {
  font-size: var(--text-xs);
  font-weight: 500;
  padding: var(--space-1) var(--space-2);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}

.tech-tag.highlighted {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── INTERCONNECTION CALLOUT ── */
#interconnection-callout {
  position: fixed;
  bottom: calc(52px + var(--space-3));
  left: 50%;
  transform: translateX(-50%) translateY(24px);
  background: var(--surface);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  z-index: 85;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-out),
              transform var(--duration-base) var(--ease-out);
  box-shadow: var(--shadow-md);
  max-width: 600px;
  white-space: nowrap;
}

#interconnection-callout.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.callout-icon {
  color: var(--accent);
  font-size: var(--text-base);
  flex-shrink: 0;
}

.callout-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.callout-link {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.callout-link:hover {
  text-decoration: underline;
}

.callout-dismiss {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-lg);
  line-height: 1;
  padding: 0 var(--space-1);
  flex-shrink: 0;
  transition: color var(--duration-fast);
}

.callout-dismiss:hover {
  color: var(--text-secondary);
}

/* ── TOAST CONTAINER (used by ToastNotification component) ── */
#toast-container {
  position: fixed;
  top: calc(var(--header-height) + var(--nav-height) + var(--command-strip-height) + var(--space-4));
  right: var(--space-4);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

/* ── UTILITY CLASSES ── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .brand-title,
  .brand-divider              { display: none; }

  .nav-track                  { mask-image: linear-gradient(to right, #000 85%, transparent);
                                -webkit-mask-image: linear-gradient(to right, #000 85%, transparent); }

  #strip-slot-4,
  #strip-slot-5               { display: none; }

  .spine-connector            { width: 10px; }
  .spine-node                 { font-size: 8px; padding: 0 var(--space-1); }

  .tech-overlay-inner          { grid-template-columns: repeat(2, 1fr); }

  #interconnection-callout    { white-space: normal; max-width: 90vw; }
}

@media (max-width: 768px) {
  #platform-header            { padding: 0 var(--space-3); }

  #command-strip              { display: none; }
  #module-container           { top: calc(var(--header-height) + var(--nav-height)); }

  #data-spine                 { display: none; }
  #module-container           { bottom: 0; }

  #toast-container            { right: var(--space-2); left: var(--space-2); }

  .tech-overlay-inner          { grid-template-columns: 1fr; }

  .shortcuts-overlay-inner    { width: 95%; padding: var(--space-4); }
}

/* ══════════════════════════════════════════════════════════════
   KEYBOARD SHORTCUTS OVERLAY
   ══════════════════════════════════════════════════════════════ */

.shortcuts-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-out);
}

.shortcuts-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.shortcuts-overlay-inner {
  background: var(--surface);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 420px;
  max-width: 95vw;
  padding: var(--space-5);
  animation: fadeSlideUp var(--duration-base) var(--ease-out) both;
}

.shortcuts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.shortcuts-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
}

.shortcuts-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-xl);
  cursor: pointer;
  padding: var(--space-1);
  line-height: 1;
  transition: color var(--duration-fast);
}

.shortcuts-close:hover {
  color: var(--text);
}

.shortcuts-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.shortcuts-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.shortcuts-group-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.shortcut-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.shortcut-row span {
  margin-left: auto;
}

.shortcut-row kbd {
  display: inline-block;
  min-width: 24px;
  padding: var(--space-1) var(--space-2);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
}
