/* Kubernetes Adventure — design.json purple theme (Harmony / PDSO purple) */

:root {
  /* design.json pdso-purple */
  --pdso-50: rgb(246, 245, 254);
  --pdso-100: rgb(231, 229, 253);
  --pdso-200: rgb(193, 189, 250);
  --pdso-300: rgb(160, 153, 248);
  --pdso-400: rgb(122, 112, 246);
  --pdso-500: rgb(89, 77, 246);
  --pdso-600: rgb(28, 11, 245);
  --pdso-700: rgb(15, 1, 191);
  --pdso-800: rgb(9, 0, 127);
  --pdso-900: rgb(5, 0, 63);
  --pdso-950: rgb(2, 0, 29);
  /* design.json backgrounds */
  --bg-primary: rgb(89, 77, 246);
  --bg-primary-hover: rgba(89, 77, 246, 0.9);
  --bg-elevated: rgb(244, 244, 245);
  --bg-subtle: rgb(246, 248, 249);
  /* design.json gradients.btn-primary */
  --gradient-btn-primary: linear-gradient(to bottom, #7f65f2 14.64%, #7154f2 87.97%);
  --gradient-btn-primary-hover: linear-gradient(180deg, #866EF2 14.64%, #7154F2 87.97%);
  --gradient-btn-primary-active: linear-gradient(180deg, #7154F2 6.03%, #7F65F2 94.44%);
  --gradient-btn-highlight: linear-gradient(to bottom, #927BF4, #7B61F2, #7154f2);
  /* design.json progress-linear (teal → purple) */
  --gradient-progress: linear-gradient(90deg, #67DEC1 0%, #594DF6 87.85%);
  /* design.json text / border */
  --text-default: rgb(2, 0, 29);
  --text-muted: rgb(82, 82, 91);
  --text-primary: rgb(89, 77, 246);
  --border-default: rgb(228, 228, 231);
  --border-magic: rgb(124, 58, 237);
  --border-magic-muted: rgb(196, 181, 253);
  /* magic-muted for cards */
  --bg-magic-muted: rgb(245, 243, 255);
  --bg-magic-muted-hover: rgb(237, 233, 254);
  /* shadows */
  --shadow-btn-primary: 0 1px 2px #381FA350;
  /* legacy aliases for K8s adventure */
  --k8s-blue: var(--pdso-500);
  --k8s-blue-light: var(--pdso-400);
  --k8s-purple: var(--pdso-500);
  --k8s-purple-light: var(--pdso-400);
  --k8s-emerald: #059669;
  --k8s-emerald-light: #10b981;
  --k8s-indigo: var(--pdso-600);
  --k8s-cyan: #0891b2;
  --k8s-text: var(--text-default);
  --k8s-muted: var(--text-muted);
  --k8s-bg: var(--bg-subtle);
  --k8s-card: #fff;
  --k8s-border: var(--border-default);
}

/* ----- Hero ----- */
.k8s-adventure-hero {
  position: relative;
  padding: 3rem 0 2.5rem;
  overflow: hidden;
}

.k8s-adventure-hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--pdso-50) 0%, rgba(89, 77, 246, 0.08) 50%, var(--pdso-100) 100%);
  pointer-events: none;
}

.k8s-adventure-hero-inner {
  position: relative;
  text-align: center;
}

.k8s-adventure-eyebrow {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--k8s-muted);
  margin-bottom: 0.75rem;
  letter-spacing: 0.02em;
}

.k8s-adventure-hero-title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  color: var(--k8s-text);
  line-height: 1.25;
  margin: 0 0 1rem;
}

/* Same as k8s adventure: brand title gradient */
.k8s-adventure-hero-title.k8s-adventure-brand {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 800;
  background: linear-gradient(90deg, #a78bfa, #c084fc, #e879f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.k8s-adventure-subtitle {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 700;
  background: linear-gradient(90deg, #818cf8, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 1.25rem;
}

.k8s-adventure-accent {
  color: var(--k8s-blue);
  background: linear-gradient(135deg, var(--k8s-blue-light), var(--k8s-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.k8s-adventure-hero-desc {
  font-size: 1rem;
  color: var(--k8s-muted);
  max-width: 560px;
  margin: 0 auto 1.25rem;
  line-height: 1.55;
}

.k8s-adventure-hero-desc code {
  background: var(--k8s-border);
  padding: 0.15em 0.4em;
  border-radius: 0.25rem;
  font-size: 0.9em;
}

.k8s-adventure-back {
  display: inline-block;
  font-size: 0.9rem;
  color: var(--k8s-blue);
  text-decoration: none;
  transition: color 0.2s, transform 0.2s;
}

.k8s-adventure-back:hover {
  color: var(--k8s-purple);
  transform: translateX(-2px);
}

/* ----- Demo CTA ----- */
.k8s-adventure-demo-cta {
  padding: 2rem 0;
}

.k8s-adventure-cta-inner {
  text-align: center;
  padding: 2rem;
  background: var(--k8s-card);
  border: 1px solid var(--k8s-border);
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.k8s-adventure-cta-text {
  margin: 0 0 1.25rem;
  color: var(--k8s-text);
  font-size: 1rem;
}

.k8s-adventure-btn-start {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, #60a5fa 14%, var(--k8s-blue) 88%);
  border: none;
  border-radius: 0.625rem;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(29, 78, 216, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}

.k8s-adventure-btn-start:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.k8s-adventure-btn-start:active {
  transform: scale(0.98);
}

.k8s-adventure-btn-icon {
  display: inline-flex;
}

/* ----- Flow section (hidden until demo started) ----- */
.k8s-adventure-flow-section {
  padding: 2rem 0 3rem;
}

.k8s-adventure-flow-section[aria-hidden="true"] {
  display: none;
}

.k8s-adventure-flow-section[aria-hidden="false"] {
  animation: k8s-fade-in 0.5s ease-out;
}

.k8s-adventure-section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--k8s-text);
  margin: 0 0 1.5rem;
  text-align: center;
}

/* Flow row: nodes + connectors */
.k8s-flow-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 2rem;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.k8s-flow-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 1rem;
  min-width: 100px;
  border-radius: 0.75rem;
  border: 2px solid var(--k8s-border);
  background: var(--k8s-card);
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}

.k8s-flow-node-icon-wrap {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  margin-bottom: 0.5rem;
  transition: transform 0.3s, box-shadow 0.3s;
}

.k8s-flow-node-kubectl .k8s-flow-node-icon-wrap {
  background: linear-gradient(135deg, #1d4ed8, var(--k8s-blue));
  border: 2px solid #60a5fa;
  color: #fff;
}

.k8s-flow-node-api .k8s-flow-node-icon-wrap {
  background: linear-gradient(135deg, #6d28d9, var(--k8s-purple));
  border: 2px solid var(--k8s-purple-light);
  color: #fff;
}

.k8s-flow-node-etcd .k8s-flow-node-icon-wrap {
  background: linear-gradient(135deg, #047857, var(--k8s-emerald));
  border: 2px solid var(--k8s-emerald-light);
  color: #fff;
}

.k8s-flow-node.active .k8s-flow-node-icon-wrap {
  animation: k8s-node-pulse 0.6s ease-in-out;
}

.k8s-flow-node-kubectl.active .k8s-flow-node-icon-wrap {
  box-shadow: 0 0 24px rgba(59, 130, 246, 0.5);
}

.k8s-flow-node-api.active .k8s-flow-node-icon-wrap {
  box-shadow: 0 0 24px rgba(124, 58, 237, 0.5);
}

.k8s-flow-node-etcd.active .k8s-flow-node-icon-wrap {
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.5);
}

.k8s-flow-node-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--k8s-text);
}

.k8s-flow-node-sublabel {
  font-size: 0.7rem;
  color: var(--k8s-muted);
}

/* Connectors */
.k8s-flow-connector {
  flex: 0 0 48px;
  height: 4px;
  position: relative;
  overflow: hidden;
}

.k8s-flow-connector-line {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--k8s-border), var(--k8s-border));
  border-radius: 2px;
  transform-origin: left;
  transition: transform 0.5s ease-out, background 0.3s;
}

.k8s-flow-connector.visible .k8s-flow-connector-line {
  background: linear-gradient(90deg, var(--k8s-blue-light), var(--k8s-purple-light));
  transform: scaleX(1);
}

.k8s-flow-connector:not(.visible) .k8s-flow-connector-line {
  transform: scaleX(0);
}

.k8s-flow-particle {
  position: absolute;
  top: 50%;
  left: 0;
  width: 10px;
  height: 10px;
  background: var(--k8s-blue-light);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  box-shadow: 0 0 8px var(--k8s-blue);
}

.k8s-flow-connector.visible.active .k8s-flow-particle {
  animation: k8s-particle-flow 1s ease-in-out;
}

/* Explanation card */
.k8s-explanation-card {
  max-width: 560px;
  margin: 0 auto 2rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(124, 58, 237, 0.06));
  border: 1px solid rgba(79, 70, 229, 0.25);
  border-radius: 1rem;
  animation: k8s-fade-in 0.4s ease-out;
}

.k8s-explanation-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.k8s-explanation-icon {
  width: 28px;
  height: 28px;
  border-radius: 0.5rem;
  flex-shrink: 0;
}

.k8s-explanation-icon-step[data-icon="kubectl"] {
  background: var(--k8s-blue);
}

.k8s-explanation-icon-step[data-icon="api"] {
  background: var(--k8s-purple);
}

.k8s-explanation-icon-step[data-icon="etcd"] {
  background: var(--k8s-emerald);
}

.k8s-explanation-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--k8s-text);
  margin: 0;
}

.k8s-explanation-body {
  font-size: 0.95rem;
  color: var(--k8s-muted);
  line-height: 1.55;
  margin: 0 0 1rem;
}

.k8s-explanation-body code {
  background: rgba(15, 23, 42, 0.08);
  padding: 0.1em 0.35em;
  border-radius: 0.25rem;
  font-size: 0.9em;
}

.k8s-explanation-insight {
  padding: 0.75rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 0.5rem;
  font-size: 0.85rem;
  color: var(--k8s-text);
  margin-bottom: 1rem;
}

.k8s-explanation-insight[aria-hidden="true"] {
  display: none;
}

.k8s-explanation-actions {
  display: flex;
  justify-content: flex-end;
}

.k8s-adventure-btn-next {
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--k8s-blue);
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.k8s-adventure-btn-next:hover {
  background: #1d4ed8;
  transform: translateX(2px);
}

/* etcd preview (JSON) */
.k8s-etcd-preview {
  max-width: 560px;
  margin: 0 auto;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 0.75rem;
  animation: k8s-fade-in 0.4s ease-out;
}

.k8s-etcd-preview[aria-hidden="true"] {
  display: none;
}

.k8s-etcd-preview-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(16, 185, 129, 0.2);
}

.k8s-etcd-preview-dot {
  width: 8px;
  height: 8px;
  background: var(--k8s-emerald-light);
  border-radius: 50%;
  animation: k8s-dot-pulse 1.5s ease-in-out infinite;
}

.k8s-etcd-preview-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--k8s-emerald);
}

.k8s-etcd-preview-badge {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 0.2em 0.5em;
  background: rgba(16, 185, 129, 0.2);
  color: var(--k8s-emerald);
  border-radius: 0.25rem;
}

.k8s-etcd-preview-key {
  font-size: 0.8rem;
  color: var(--k8s-muted);
  margin-bottom: 0.5rem;
}

.k8s-etcd-preview-key code {
  color: var(--k8s-emerald);
  background: none;
  padding: 0;
}

.k8s-json-viewer {
  margin: 0;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.06);
  border-radius: 0.5rem;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--k8s-text);
  overflow-x: auto;
}

.k8s-json-viewer code {
  color: inherit;
}

/* ----- Watch section ----- */
.k8s-adventure-watch-section {
  padding: 3rem 0;
  background: var(--k8s-bg);
}

.k8s-adventure-section-desc {
  text-align: center;
  color: var(--k8s-muted);
  font-size: 0.95rem;
  margin: -0.5rem 0 1.5rem;
}

.k8s-watch-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.k8s-watch-etcd {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #047857, var(--k8s-emerald));
  border: 2px solid var(--k8s-emerald-light);
  border-radius: 1rem;
  color: #fff;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.25);
  animation: k8s-watch-etcd-glow 2.5s ease-in-out infinite;
}

.k8s-watch-etcd-icon {
  margin-bottom: 0.5rem;
}

.k8s-watch-etcd-label {
  font-weight: 700;
  font-size: 1rem;
}

.k8s-watch-etcd-sublabel {
  font-size: 0.75rem;
  opacity: 0.9;
}

.k8s-watch-components {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  flex: 1;
  min-width: 280px;
}

.k8s-watch-item {
  flex: 1 1 160px;
  position: relative;
  padding-top: 2rem;
}

.k8s-watch-line {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 24px;
  background: linear-gradient(180deg, var(--k8s-indigo), var(--k8s-purple));
  border-radius: 1px;
  transform: translateX(-50%);
  opacity: 0.7;
}

.k8s-watch-item:hover .k8s-watch-line {
  animation: k8s-line-pulse 1s ease-in-out infinite;
}

.k8s-watch-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  background: var(--k8s-card);
  border: 2px solid var(--k8s-border);
  border-radius: 0.75rem;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.k8s-watch-item:hover .k8s-watch-card {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.15);
  border-color: var(--k8s-indigo);
}

.k8s-watch-card-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  color: #fff;
}

.k8s-watch-icon-controller {
  background: linear-gradient(135deg, var(--k8s-indigo), #6366f1);
}

.k8s-watch-icon-scheduler {
  background: linear-gradient(135deg, var(--k8s-purple), #a78bfa);
}

.k8s-watch-icon-kubelet {
  background: linear-gradient(135deg, var(--k8s-cyan), #22d3ee);
}

.k8s-watch-card-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--k8s-text);
}

.k8s-watch-card-role {
  font-size: 0.7rem;
  color: var(--k8s-muted);
}

.k8s-watch-desc {
  font-size: 0.8rem;
  color: var(--k8s-muted);
  margin: 0.5rem 0 0;
  line-height: 1.4;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.3s, max-height 0.3s, margin 0.3s;
}

.k8s-watch-item:hover .k8s-watch-desc {
  opacity: 1;
  max-height: 120px;
  margin-top: 0.5rem;
}

.k8s-watch-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--k8s-muted);
  margin: 1.5rem 0 0;
}

/* ----- CTA footer ----- */
.k8s-adventure-cta-footer {
  padding: 2.5rem 0;
  text-align: center;
}

.k8s-adventure-cta-footer .k8s-adventure-hero-desc {
  margin-bottom: 1rem;
}

.k8s-adventure-btn-primary {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, #60a5fa 14%, var(--k8s-blue) 88%);
  border-radius: 0.625rem;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(29, 78, 216, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}

.k8s-adventure-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
  color: #fff;
}

/* ----- Animations ----- */
@keyframes k8s-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes k8s-node-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes k8s-particle-flow {
  0% {
    left: 0;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    left: 100%;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
  }
}

@keyframes k8s-dot-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.2);
  }
}

@keyframes k8s-watch-etcd-glow {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.25);
  }
  50% {
    box-shadow: 0 4px 28px rgba(16, 185, 129, 0.4);
  }
}

@keyframes k8s-line-pulse {
  0%, 100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .k8s-flow-row {
    flex-direction: column;
    gap: 1rem;
  }

  .k8s-flow-connector {
    flex: none;
    width: 4px;
    height: 32px;
  }

  .k8s-flow-connector-line {
    width: 4px;
    height: 100%;
    transform-origin: top;
  }

  .k8s-flow-connector.visible .k8s-flow-connector-line {
    transform: scaleY(1);
  }

  .k8s-flow-connector:not(.visible) .k8s-flow-connector-line {
    transform: scaleY(0);
  }

  .k8s-flow-particle {
    left: 50%;
    top: 0;
  }

  .k8s-flow-connector.visible.active .k8s-flow-particle {
    animation: k8s-particle-flow-vertical 1s ease-in-out;
  }

  .k8s-watch-layout {
    flex-direction: column;
  }
}

@keyframes k8s-particle-flow-vertical {
  0% {
    top: 0;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    top: 100%;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
  }
}
